Mercurial > octave-nkf
comparison src/DLD-FUNCTIONS/det.cc @ 5070:1e6f653ef1e3 ss-2-1-61
[project @ 2004-11-06 00:33:38 by jwe]
author | jwe |
---|---|
date | Sat, 06 Nov 2004 00:33:38 +0000 |
parents | a6755bc45f15 |
children | 57077d0ddc8e |
comparison
equal
deleted
inserted
replaced
5069:b9dae14b5ada | 5070:1e6f653ef1e3 |
---|---|
77 { | 77 { |
78 Matrix m = arg.matrix_value (); | 78 Matrix m = arg.matrix_value (); |
79 | 79 |
80 if (! error_state) | 80 if (! error_state) |
81 { | 81 { |
82 // Always compute rcond, so we can detect numerically | |
83 // singular matrices. | |
84 | |
82 int info; | 85 int info; |
83 double rcond = 0.0; | 86 double rcond = 0.0; |
84 | 87 DET det = m.determinant (info, rcond); |
85 if (nargout > 1) | 88 retval(1) = rcond; |
86 { | 89 volatile double xrcond = rcond; |
87 DET det = m.determinant (info, rcond); | 90 xrcond += 1.0; |
88 retval(1) = rcond; | 91 retval(0) = ((info == -1 || xrcond == 1.0) ? 0.0 : det.value ()); |
89 volatile double xrcond = rcond; | |
90 xrcond += 1.0; | |
91 retval(0) = ((info == -1 || xrcond == 1.0) | |
92 ? 0.0 : det.value ()); | |
93 } | |
94 else | |
95 { | |
96 DET det = m.determinant (info); | |
97 volatile double xrcond = rcond; | |
98 xrcond += 1.0; | |
99 retval(0) = ((info == -1 || xrcond == 1.0) | |
100 ? 0.0 : det.value ()); | |
101 } | |
102 } | 92 } |
103 } | 93 } |
104 else if (arg.is_complex_type ()) | 94 else if (arg.is_complex_type ()) |
105 { | 95 { |
106 ComplexMatrix m = arg.complex_matrix_value (); | 96 ComplexMatrix m = arg.complex_matrix_value (); |
107 | 97 |
108 if (! error_state) | 98 if (! error_state) |
109 { | 99 { |
100 // Always compute rcond, so we can detect numerically | |
101 // singular matrices. | |
102 | |
110 int info; | 103 int info; |
111 double rcond = 0.0; | 104 double rcond = 0.0; |
112 | 105 ComplexDET det = m.determinant (info, rcond); |
113 if (nargout > 1) | 106 retval(1) = rcond; |
114 { | 107 volatile double xrcond = rcond; |
115 ComplexDET det = m.determinant (info, rcond); | 108 xrcond += 1.0; |
116 retval(1) = rcond; | 109 retval(0) = ((info == -1 || xrcond == 1.0) |
117 volatile double xrcond = rcond; | 110 ? Complex (0.0) : det.value ()); |
118 xrcond += 1.0; | |
119 retval(0) = ((info == -1 || xrcond == 1.0) | |
120 ? Complex (0.0) : det.value ()); | |
121 } | |
122 else | |
123 { | |
124 ComplexDET det = m.determinant (info); | |
125 volatile double xrcond = rcond; | |
126 xrcond += 1.0; | |
127 retval(0) = ((info == -1 || xrcond == 1.0) | |
128 ? Complex (0.0) : det.value ()); | |
129 } | |
130 } | 111 } |
131 } | 112 } |
132 else | 113 else |
133 { | 114 { |
134 gripe_wrong_type_arg ("det", arg); | 115 gripe_wrong_type_arg ("det", arg); |