Mercurial > octave-libgccjit
comparison src/DLD-FUNCTIONS/pinv.cc @ 8916:a2878ba31a9e
add diag & perm matrix query methods to octave_value
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Fri, 06 Mar 2009 12:00:11 +0100 |
parents | c690e3772583 |
children | eb63fbe60fab |
comparison
equal
deleted
inserted
replaced
8915:485eabc0cfec | 8916:a2878ba31a9e |
---|---|
77 if (arg.is_diag_matrix ()) | 77 if (arg.is_diag_matrix ()) |
78 { | 78 { |
79 if (nargin == 2) | 79 if (nargin == 2) |
80 warning ("pinv: tol is ignored for diagonal matrices"); | 80 warning ("pinv: tol is ignored for diagonal matrices"); |
81 | 81 |
82 const octave_base_value& a = arg.get_rep (); | |
83 if (arg.is_complex_type ()) | 82 if (arg.is_complex_type ()) |
84 { | 83 { |
85 if (isfloat) | 84 if (isfloat) |
86 { | 85 retval = arg.float_complex_diag_matrix_value ().pseudo_inverse (); |
87 CAST_CONV_ARG (const octave_float_complex_diag_matrix&); | |
88 retval = v.float_complex_diag_matrix_value ().pseudo_inverse (); | |
89 } | |
90 else | 86 else |
91 { | 87 retval = arg.complex_diag_matrix_value ().pseudo_inverse (); |
92 CAST_CONV_ARG (const octave_complex_diag_matrix&); | |
93 retval = v.complex_diag_matrix_value ().pseudo_inverse (); | |
94 } | |
95 } | 88 } |
96 else | 89 else |
97 { | 90 { |
98 if (isfloat) | 91 if (isfloat) |
99 { | 92 retval = arg.float_diag_matrix_value ().pseudo_inverse (); |
100 CAST_CONV_ARG (const octave_float_diag_matrix&); | |
101 retval = v.float_diag_matrix_value ().pseudo_inverse (); | |
102 } | |
103 else | 93 else |
104 { | 94 retval = arg.diag_matrix_value ().pseudo_inverse (); |
105 CAST_CONV_ARG (const octave_diag_matrix&); | |
106 retval = v.diag_matrix_value ().pseudo_inverse (); | |
107 } | |
108 } | 95 } |
109 } | 96 } |
110 else if (arg.is_perm_matrix ()) | 97 else if (arg.is_perm_matrix ()) |
111 { | 98 { |
112 const octave_base_value& a = arg.get_rep (); | |
113 if (isfloat) | 99 if (isfloat) |
114 { | 100 retval = octave_value (arg.perm_matrix_value ().inverse (), true); |
115 CAST_CONV_ARG (const octave_float_perm_matrix&); | |
116 retval = v.perm_matrix_value ().inverse (); | |
117 } | |
118 else | 101 else |
119 { | 102 retval = arg.perm_matrix_value ().inverse (); |
120 CAST_CONV_ARG (const octave_perm_matrix&); | |
121 retval = v.perm_matrix_value ().inverse (); | |
122 } | |
123 } | 103 } |
124 else if (isfloat) | 104 else if (isfloat) |
125 { | 105 { |
126 float tol = 0.0; | 106 float tol = 0.0; |
127 if (nargin == 2) | 107 if (nargin == 2) |