Mercurial > hg > octave-lyh
annotate src/sparse-xdiv.cc @ 9151:d8f9588c6ba1
object exemplars
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 23 Apr 2009 16:05:52 -0400 |
parents | 0631d397fbe0 |
children | c229bfb14d8d |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
7017 | 3 Copyright (C) 2004, 2005, 2006, 2007 David Bateman |
7016 | 4 Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Andy Adler |
5 | |
6 This file is part of Octave. | |
5164 | 7 |
8 Octave is free software; you can redistribute it and/or modify it | |
9 under the terms of the GNU General Public License as published by the | |
7016 | 10 Free Software Foundation; either version 3 of the License, or (at your |
11 option) any later version. | |
5164 | 12 |
13 Octave is distributed in the hope that it will be useful, but WITHOUT | |
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
16 for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
7016 | 19 along with Octave; see the file COPYING. If not, see |
20 <http://www.gnu.org/licenses/>. | |
5164 | 21 |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include <config.h> | |
26 #endif | |
27 | |
28 #include <cassert> | |
29 | |
30 #include "Array-util.h" | |
31 #include "oct-cmplx.h" | |
32 #include "quit.h" | |
33 #include "error.h" | |
9003
0631d397fbe0
replace lo_ieee_isnan by xisnan, add missing includes
Jaroslav Hajek <highegg@gmail.com>
parents:
8965
diff
changeset
|
34 #include "lo-ieee.h" |
5164 | 35 |
36 #include "dSparse.h" | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
37 #include "dDiagMatrix.h" |
5164 | 38 #include "CSparse.h" |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
39 #include "CDiagMatrix.h" |
5164 | 40 #include "oct-spparms.h" |
41 #include "sparse-xdiv.h" | |
42 | |
43 static void | |
44 solve_singularity_warning (double rcond) | |
45 { | |
46 warning ("matrix singular to machine precision, rcond = %g", rcond); | |
47 warning ("attempting to find minimum norm solution"); | |
48 } | |
49 | |
50 template <class T1, class T2> | |
51 bool | |
52 mx_leftdiv_conform (const T1& a, const T2& b) | |
53 { | |
5275 | 54 octave_idx_type a_nr = a.rows (); |
55 octave_idx_type b_nr = b.rows (); | |
5164 | 56 |
57 if (a_nr != b_nr) | |
58 { | |
5275 | 59 octave_idx_type a_nc = a.cols (); |
60 octave_idx_type b_nc = b.cols (); | |
5164 | 61 |
62 gripe_nonconformant ("operator \\", a_nr, a_nc, b_nr, b_nc); | |
63 return false; | |
64 } | |
65 | |
66 return true; | |
67 } | |
68 | |
69 #define INSTANTIATE_MX_LEFTDIV_CONFORM(T1, T2) \ | |
70 template bool mx_leftdiv_conform (const T1&, const T2&) | |
71 | |
72 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, SparseMatrix); | |
73 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, SparseComplexMatrix); | |
74 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, SparseMatrix); | |
75 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, SparseComplexMatrix); | |
76 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, Matrix); | |
77 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseMatrix, ComplexMatrix); | |
78 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, Matrix); | |
79 INSTANTIATE_MX_LEFTDIV_CONFORM (SparseComplexMatrix, ComplexMatrix); | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
80 INSTANTIATE_MX_LEFTDIV_CONFORM (DiagMatrix, SparseMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
81 INSTANTIATE_MX_LEFTDIV_CONFORM (DiagMatrix, SparseComplexMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
82 INSTANTIATE_MX_LEFTDIV_CONFORM (ComplexDiagMatrix, SparseMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
83 INSTANTIATE_MX_LEFTDIV_CONFORM (ComplexDiagMatrix, SparseComplexMatrix); |
5164 | 84 |
85 template <class T1, class T2> | |
86 bool | |
87 mx_div_conform (const T1& a, const T2& b) | |
88 { | |
5275 | 89 octave_idx_type a_nc = a.cols (); |
90 octave_idx_type b_nc = b.cols (); | |
5164 | 91 |
92 if (a_nc != b_nc) | |
93 { | |
5275 | 94 octave_idx_type a_nr = a.rows (); |
95 octave_idx_type b_nr = b.rows (); | |
5164 | 96 |
97 gripe_nonconformant ("operator /", a_nr, a_nc, b_nr, b_nc); | |
98 return false; | |
99 } | |
100 | |
101 return true; | |
102 } | |
103 | |
104 #define INSTANTIATE_MX_DIV_CONFORM(T1, T2) \ | |
105 template bool mx_div_conform (const T1&, const T2&) | |
106 | |
107 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, SparseMatrix); | |
108 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, SparseComplexMatrix); | |
109 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, SparseMatrix); | |
110 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, SparseComplexMatrix); | |
111 INSTANTIATE_MX_DIV_CONFORM (Matrix, SparseMatrix); | |
112 INSTANTIATE_MX_DIV_CONFORM (Matrix, SparseComplexMatrix); | |
113 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, SparseMatrix); | |
114 INSTANTIATE_MX_DIV_CONFORM (ComplexMatrix, SparseComplexMatrix); | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
115 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, DiagMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
116 INSTANTIATE_MX_DIV_CONFORM (SparseMatrix, ComplexDiagMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
117 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, DiagMatrix); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
118 INSTANTIATE_MX_DIV_CONFORM (SparseComplexMatrix, ComplexDiagMatrix); |
5164 | 119 |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
120 // Right division functions. X / Y = X * inv(Y) = (inv (Y') * X')' |
5164 | 121 // |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
122 // Y / X: m cm sm scm |
5164 | 123 // +-- +---+----+----+----+ |
124 // sparse matrix | 1 | 3 | 5 | 7 | | |
125 // +---+----+----+----+ | |
126 // sparse complex_matrix | 2 | 4 | 6 | 8 | | |
127 // +---+----+----+----+ | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
128 // diagonal matrix | 9 | 11 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
129 // +----+----+ |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
130 // complex diag. matrix | 10 | 12 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
131 // +----+----+ |
5164 | 132 |
133 // -*- 1 -*- | |
134 Matrix | |
5785 | 135 xdiv (const Matrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 136 { |
137 if (! mx_div_conform (a, b)) | |
138 return Matrix (); | |
139 | |
140 Matrix atmp = a.transpose (); | |
141 SparseMatrix btmp = b.transpose (); | |
5785 | 142 MatrixType btyp = typ.transpose (); |
5164 | 143 |
5275 | 144 octave_idx_type info; |
5681 | 145 double rcond = 0.0; |
146 Matrix result = btmp.solve (btyp, atmp, info, rcond, | |
147 solve_singularity_warning); | |
5164 | 148 |
5322 | 149 typ = btyp.transpose (); |
5164 | 150 return result.transpose (); |
151 } | |
152 | |
153 // -*- 2 -*- | |
154 ComplexMatrix | |
5785 | 155 xdiv (const Matrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 156 { |
157 if (! mx_div_conform (a, b)) | |
158 return ComplexMatrix (); | |
159 | |
160 Matrix atmp = a.transpose (); | |
161 SparseComplexMatrix btmp = b.hermitian (); | |
5785 | 162 MatrixType btyp = typ.transpose (); |
5164 | 163 |
5275 | 164 octave_idx_type info; |
5681 | 165 double rcond = 0.0; |
166 ComplexMatrix result | |
167 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 168 |
5322 | 169 typ = btyp.transpose (); |
5164 | 170 return result.hermitian (); |
171 } | |
172 | |
173 // -*- 3 -*- | |
174 ComplexMatrix | |
5785 | 175 xdiv (const ComplexMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 176 { |
177 if (! mx_div_conform (a, b)) | |
178 return ComplexMatrix (); | |
179 | |
180 ComplexMatrix atmp = a.hermitian (); | |
181 SparseMatrix btmp = b.transpose (); | |
5785 | 182 MatrixType btyp = typ.transpose (); |
5164 | 183 |
5275 | 184 octave_idx_type info; |
5681 | 185 double rcond = 0.0; |
186 ComplexMatrix result | |
187 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 188 |
5322 | 189 typ = btyp.transpose (); |
5164 | 190 return result.hermitian (); |
191 } | |
192 | |
193 // -*- 4 -*- | |
194 ComplexMatrix | |
5785 | 195 xdiv (const ComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 196 { |
197 if (! mx_div_conform (a, b)) | |
198 return ComplexMatrix (); | |
199 | |
200 ComplexMatrix atmp = a.hermitian (); | |
201 SparseComplexMatrix btmp = b.hermitian (); | |
5785 | 202 MatrixType btyp = typ.transpose (); |
5164 | 203 |
5275 | 204 octave_idx_type info; |
5681 | 205 double rcond = 0.0; |
206 ComplexMatrix result | |
207 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 208 |
5322 | 209 typ = btyp.transpose (); |
5164 | 210 return result.hermitian (); |
211 } | |
212 | |
213 // -*- 5 -*- | |
214 SparseMatrix | |
5785 | 215 xdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 216 { |
217 if (! mx_div_conform (a, b)) | |
218 return SparseMatrix (); | |
219 | |
220 SparseMatrix atmp = a.transpose (); | |
221 SparseMatrix btmp = b.transpose (); | |
5785 | 222 MatrixType btyp = typ.transpose (); |
5164 | 223 |
5275 | 224 octave_idx_type info; |
5681 | 225 double rcond = 0.0; |
226 SparseMatrix result = btmp.solve (btyp, atmp, info, rcond, | |
227 solve_singularity_warning); | |
5164 | 228 |
5322 | 229 typ = btyp.transpose (); |
5164 | 230 return result.transpose (); |
231 } | |
232 | |
233 // -*- 6 -*- | |
234 SparseComplexMatrix | |
5785 | 235 xdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 236 { |
237 if (! mx_div_conform (a, b)) | |
238 return SparseComplexMatrix (); | |
239 | |
240 SparseMatrix atmp = a.transpose (); | |
241 SparseComplexMatrix btmp = b.hermitian (); | |
5785 | 242 MatrixType btyp = typ.transpose (); |
5164 | 243 |
5275 | 244 octave_idx_type info; |
5681 | 245 double rcond = 0.0; |
246 SparseComplexMatrix result | |
247 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 248 |
5322 | 249 typ = btyp.transpose (); |
5164 | 250 return result.hermitian (); |
251 } | |
252 | |
253 // -*- 7 -*- | |
254 SparseComplexMatrix | |
5785 | 255 xdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 256 { |
257 if (! mx_div_conform (a, b)) | |
258 return SparseComplexMatrix (); | |
259 | |
260 SparseComplexMatrix atmp = a.hermitian (); | |
261 SparseMatrix btmp = b.transpose (); | |
5785 | 262 MatrixType btyp = typ.transpose (); |
5164 | 263 |
5275 | 264 octave_idx_type info; |
5681 | 265 double rcond = 0.0; |
266 SparseComplexMatrix result | |
267 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 268 |
5322 | 269 typ = btyp.transpose (); |
5164 | 270 return result.hermitian (); |
271 } | |
272 | |
273 // -*- 8 -*- | |
274 SparseComplexMatrix | |
5785 | 275 xdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 276 { |
277 if (! mx_div_conform (a, b)) | |
278 return SparseComplexMatrix (); | |
279 | |
280 SparseComplexMatrix atmp = a.hermitian (); | |
281 SparseComplexMatrix btmp = b.hermitian (); | |
5785 | 282 MatrixType btyp = typ.transpose (); |
5164 | 283 |
5275 | 284 octave_idx_type info; |
5681 | 285 double rcond = 0.0; |
286 SparseComplexMatrix result | |
287 = btmp.solve (btyp, atmp, info, rcond, solve_singularity_warning); | |
5164 | 288 |
5322 | 289 typ = btyp.transpose (); |
5164 | 290 return result.hermitian (); |
291 } | |
292 | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
293 template <typename RT, typename SM, typename DM> |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
294 RT do_rightdiv_sm_dm (const SM& a, const DM& d) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
295 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
296 const octave_idx_type d_nr = d.rows (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
297 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
298 const octave_idx_type a_nr = a.rows (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
299 const octave_idx_type a_nc = a.cols (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
300 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
301 using std::min; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
302 const octave_idx_type nc = min (d_nr, a_nc); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
303 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
304 if ( ! mx_div_conform (a, d)) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
305 return RT (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
306 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
307 const octave_idx_type nz = a.nnz (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
308 RT r (a_nr, nc, nz); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
309 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
310 const typename DM::element_type zero = typename DM::element_type (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
311 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
312 octave_idx_type k_result = 0; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
313 for (octave_idx_type j = 0; j < nc; ++j) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
314 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
315 OCTAVE_QUIT; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
316 const typename DM::element_type s = d.dgelem (j); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
317 const octave_idx_type colend = a.cidx (j+1); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
318 r.xcidx (j) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
319 if (s != zero) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
320 for (octave_idx_type k = a.cidx (j); k < colend; ++k) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
321 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
322 r.xdata (k_result) = a.data (k) / s; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
323 r.xridx (k_result) = a.ridx (k); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
324 ++k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
325 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
326 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
327 r.xcidx (nc) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
328 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
329 r.maybe_compress (true); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
330 return r; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
331 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
332 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
333 // -*- 9 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
334 SparseMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
335 xdiv (const SparseMatrix& a, const DiagMatrix& b, MatrixType &) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
336 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
337 return do_rightdiv_sm_dm<SparseMatrix> (a, b); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
338 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
339 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
340 // -*- 10 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
341 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
342 xdiv (const SparseMatrix& a, const ComplexDiagMatrix& b, MatrixType &) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
343 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
344 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
345 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
346 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
347 // -*- 11 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
348 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
349 xdiv (const SparseComplexMatrix& a, const DiagMatrix& b, MatrixType &) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
350 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
351 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
352 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
353 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
354 // -*- 12 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
355 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
356 xdiv (const SparseComplexMatrix& a, const ComplexDiagMatrix& b, MatrixType &) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
357 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
358 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
359 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
360 |
5164 | 361 // Funny element by element division operations. |
362 // | |
363 // op2 \ op1: s cs | |
364 // +-- +---+----+ | |
365 // matrix | 1 | 3 | | |
366 // +---+----+ | |
367 // complex_matrix | 2 | 4 | | |
368 // +---+----+ | |
369 | |
370 Matrix | |
371 x_el_div (double a, const SparseMatrix& b) | |
372 { | |
5275 | 373 octave_idx_type nr = b.rows (); |
374 octave_idx_type nc = b.cols (); | |
5164 | 375 |
376 Matrix result; | |
377 if (a == 0.) | |
378 result = Matrix (nr, nc, octave_NaN); | |
379 else if (a > 0.) | |
380 result = Matrix (nr, nc, octave_Inf); | |
381 else | |
382 result = Matrix (nr, nc, -octave_Inf); | |
383 | |
384 | |
5275 | 385 for (octave_idx_type j = 0; j < nc; j++) |
386 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 387 { |
388 OCTAVE_QUIT; | |
389 result.elem (b.ridx(i), j) = a / b.data (i); | |
390 } | |
391 | |
392 return result; | |
393 } | |
394 | |
395 ComplexMatrix | |
396 x_el_div (double a, const SparseComplexMatrix& b) | |
397 { | |
5275 | 398 octave_idx_type nr = b.rows (); |
399 octave_idx_type nc = b.cols (); | |
5164 | 400 |
401 ComplexMatrix result (nr, nc, Complex(octave_NaN, octave_NaN)); | |
402 | |
5275 | 403 for (octave_idx_type j = 0; j < nc; j++) |
404 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 405 { |
406 OCTAVE_QUIT; | |
407 result.elem (b.ridx(i), j) = a / b.data (i); | |
408 } | |
409 | |
410 return result; | |
411 } | |
412 | |
413 ComplexMatrix | |
414 x_el_div (const Complex a, const SparseMatrix& b) | |
415 { | |
5275 | 416 octave_idx_type nr = b.rows (); |
417 octave_idx_type nc = b.cols (); | |
5164 | 418 |
419 ComplexMatrix result (nr, nc, (a / 0.0)); | |
420 | |
5275 | 421 for (octave_idx_type j = 0; j < nc; j++) |
422 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 423 { |
424 OCTAVE_QUIT; | |
425 result.elem (b.ridx(i), j) = a / b.data (i); | |
426 } | |
427 | |
428 return result; | |
429 } | |
430 | |
431 ComplexMatrix | |
432 x_el_div (const Complex a, const SparseComplexMatrix& b) | |
433 { | |
5275 | 434 octave_idx_type nr = b.rows (); |
435 octave_idx_type nc = b.cols (); | |
5164 | 436 |
437 ComplexMatrix result (nr, nc, (a / 0.0)); | |
438 | |
5275 | 439 for (octave_idx_type j = 0; j < nc; j++) |
440 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 441 { |
442 OCTAVE_QUIT; | |
443 result.elem (b.ridx(i), j) = a / b.data (i); | |
444 } | |
445 | |
446 return result; | |
447 } | |
448 | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
449 // Left division functions. X \ Y = inv(X) * Y |
5164 | 450 // |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
451 // Y \ X : sm scm dm dcm |
5164 | 452 // +-- +---+----+ |
453 // matrix | 1 | 5 | | |
454 // +---+----+ | |
455 // complex_matrix | 2 | 6 | | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
456 // +---+----+----+----+ |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
457 // sparse matrix | 3 | 7 | 9 | 11 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
458 // +---+----+----+----+ |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
459 // sparse complex_matrix | 4 | 8 | 10 | 12 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
460 // +---+----+----+----+ |
5164 | 461 |
462 // -*- 1 -*- | |
463 Matrix | |
5785 | 464 xleftdiv (const SparseMatrix& a, const Matrix& b, MatrixType &typ) |
5164 | 465 { |
466 if (! mx_leftdiv_conform (a, b)) | |
467 return Matrix (); | |
468 | |
5275 | 469 octave_idx_type info; |
5681 | 470 double rcond = 0.0; |
471 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 472 } |
473 | |
474 // -*- 2 -*- | |
475 ComplexMatrix | |
5785 | 476 xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, MatrixType &typ) |
5164 | 477 { |
478 if (! mx_leftdiv_conform (a, b)) | |
479 return ComplexMatrix (); | |
480 | |
5275 | 481 octave_idx_type info; |
5681 | 482 double rcond = 0.0; |
483 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 484 } |
485 | |
486 // -*- 3 -*- | |
487 SparseMatrix | |
5785 | 488 xleftdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 489 { |
490 if (! mx_leftdiv_conform (a, b)) | |
491 return SparseMatrix (); | |
492 | |
5275 | 493 octave_idx_type info; |
5681 | 494 double rcond = 0.0; |
495 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 496 } |
497 | |
498 // -*- 4 -*- | |
499 SparseComplexMatrix | |
5785 | 500 xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 501 { |
502 if (! mx_leftdiv_conform (a, b)) | |
503 return SparseComplexMatrix (); | |
504 | |
5275 | 505 octave_idx_type info; |
5681 | 506 double rcond = 0.0; |
507 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 508 } |
509 | |
510 // -*- 5 -*- | |
511 ComplexMatrix | |
5785 | 512 xleftdiv (const SparseComplexMatrix& a, const Matrix& b, MatrixType &typ) |
5164 | 513 { |
514 if (! mx_leftdiv_conform (a, b)) | |
515 return ComplexMatrix (); | |
516 | |
5275 | 517 octave_idx_type info; |
5681 | 518 double rcond = 0.0; |
519 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 520 } |
521 | |
522 // -*- 6 -*- | |
523 ComplexMatrix | |
5785 | 524 xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b, MatrixType &typ) |
5164 | 525 { |
526 if (! mx_leftdiv_conform (a, b)) | |
527 return ComplexMatrix (); | |
528 | |
5275 | 529 octave_idx_type info; |
5681 | 530 double rcond = 0.0; |
531 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 532 } |
533 | |
534 // -*- 7 -*- | |
535 SparseComplexMatrix | |
5785 | 536 xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 537 { |
538 if (! mx_leftdiv_conform (a, b)) | |
539 return SparseComplexMatrix (); | |
540 | |
5275 | 541 octave_idx_type info; |
5681 | 542 double rcond = 0.0; |
543 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 544 } |
545 | |
546 // -*- 8 -*- | |
547 SparseComplexMatrix | |
5322 | 548 xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, |
5785 | 549 MatrixType &typ) |
5164 | 550 { |
551 if (! mx_leftdiv_conform (a, b)) | |
552 return SparseComplexMatrix (); | |
553 | |
5275 | 554 octave_idx_type info; |
5681 | 555 double rcond = 0.0; |
556 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 557 } |
558 | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
559 template <typename RT, typename DM, typename SM> |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
560 RT do_leftdiv_dm_sm (const DM& d, const SM& a) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
561 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
562 const octave_idx_type a_nr = a.rows (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
563 const octave_idx_type a_nc = a.cols (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
564 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
565 const octave_idx_type d_nc = d.cols (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
566 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
567 using std::min; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
568 const octave_idx_type nr = min (d_nc, a_nr); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
569 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
570 if ( ! mx_leftdiv_conform (d, a)) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
571 return RT (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
572 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
573 const octave_idx_type nz = a.nnz (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
574 RT r (nr, a_nc, nz); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
575 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
576 const typename DM::element_type zero = typename DM::element_type (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
577 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
578 octave_idx_type k_result = 0; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
579 for (octave_idx_type j = 0; j < a_nc; ++j) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
580 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
581 OCTAVE_QUIT; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
582 const octave_idx_type colend = a.cidx (j+1); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
583 r.xcidx (j) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
584 for (octave_idx_type k = a.cidx (j); k < colend; ++k) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
585 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
586 const octave_idx_type i = a.ridx (k); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
587 if (i < nr) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
588 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
589 const typename DM::element_type s = d.dgelem (i); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
590 if (s != zero) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
591 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
592 r.xdata (k_result) = a.data (k) / s; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
593 r.xridx (k_result) = i; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
594 ++k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
595 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
596 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
597 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
598 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
599 r.xcidx (a_nc) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
600 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
601 r.maybe_compress (true); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
602 return r; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
603 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
604 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
605 // -*- 9 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
606 SparseMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
607 xleftdiv (const DiagMatrix& d, const SparseMatrix& a, MatrixType&) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
608 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
609 return do_leftdiv_dm_sm<SparseMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
610 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
611 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
612 // -*- 10 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
613 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
614 xleftdiv (const DiagMatrix& d, const SparseComplexMatrix& a, MatrixType&) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
615 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
616 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
617 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
618 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
619 // -*- 11 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
620 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
621 xleftdiv (const ComplexDiagMatrix& d, const SparseMatrix& a, MatrixType&) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
622 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
623 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
624 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
625 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
626 // -*- 12 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
627 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
628 xleftdiv (const ComplexDiagMatrix& d, const SparseComplexMatrix& a, MatrixType&) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
629 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
630 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
631 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
632 |
5164 | 633 /* |
634 ;;; Local Variables: *** | |
635 ;;; mode: C++ *** | |
636 ;;; End: *** | |
637 */ |