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