Mercurial > hg > octave-nkf
annotate src/sparse-xdiv.cc @ 12121:87237a866c71 release-3-2-x
this branch is no longer maintained and is closed for further development
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 22 Jan 2011 01:00:54 -0500 |
parents | 16f53d29049f |
children | 829e69ec3110 |
rev | line source |
---|---|
5164 | 1 /* |
2 | |
9245 | 3 Copyright (C) 2004, 2005, 2006, 2007, 2009 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 |
9196
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
310 typedef typename DM::element_type DM_elt_type; |
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
311 const DM_elt_type zero = DM_elt_type (); |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
312 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
313 octave_idx_type k_result = 0; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
314 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
|
315 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
316 OCTAVE_QUIT; |
9196
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
317 const DM_elt_type s = d.dgelem (j); |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
318 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
|
319 r.xcidx (j) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
320 if (s != zero) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
321 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
|
322 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
323 r.xdata (k_result) = a.data (k) / s; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
324 r.xridx (k_result) = a.ridx (k); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
325 ++k_result; |
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 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
328 r.xcidx (nc) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
329 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
330 r.maybe_compress (true); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
331 return r; |
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 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
334 // -*- 9 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
335 SparseMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
336 xdiv (const SparseMatrix& a, const DiagMatrix& b, MatrixType &) |
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 return do_rightdiv_sm_dm<SparseMatrix> (a, b); |
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 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
341 // -*- 10 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
342 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
343 xdiv (const SparseMatrix& a, const ComplexDiagMatrix& b, MatrixType &) |
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 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
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 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
348 // -*- 11 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
349 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
350 xdiv (const SparseComplexMatrix& a, const DiagMatrix& b, MatrixType &) |
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 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
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 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
355 // -*- 12 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
356 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
357 xdiv (const SparseComplexMatrix& a, const ComplexDiagMatrix& b, MatrixType &) |
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 return do_rightdiv_sm_dm<SparseComplexMatrix> (a, b); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
360 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
361 |
5164 | 362 // Funny element by element division operations. |
363 // | |
364 // op2 \ op1: s cs | |
365 // +-- +---+----+ | |
366 // matrix | 1 | 3 | | |
367 // +---+----+ | |
368 // complex_matrix | 2 | 4 | | |
369 // +---+----+ | |
370 | |
371 Matrix | |
372 x_el_div (double a, const SparseMatrix& b) | |
373 { | |
5275 | 374 octave_idx_type nr = b.rows (); |
375 octave_idx_type nc = b.cols (); | |
5164 | 376 |
377 Matrix result; | |
378 if (a == 0.) | |
379 result = Matrix (nr, nc, octave_NaN); | |
380 else if (a > 0.) | |
381 result = Matrix (nr, nc, octave_Inf); | |
382 else | |
383 result = Matrix (nr, nc, -octave_Inf); | |
384 | |
385 | |
5275 | 386 for (octave_idx_type j = 0; j < nc; j++) |
387 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 388 { |
389 OCTAVE_QUIT; | |
390 result.elem (b.ridx(i), j) = a / b.data (i); | |
391 } | |
392 | |
393 return result; | |
394 } | |
395 | |
396 ComplexMatrix | |
397 x_el_div (double a, const SparseComplexMatrix& b) | |
398 { | |
5275 | 399 octave_idx_type nr = b.rows (); |
400 octave_idx_type nc = b.cols (); | |
5164 | 401 |
402 ComplexMatrix result (nr, nc, Complex(octave_NaN, octave_NaN)); | |
403 | |
5275 | 404 for (octave_idx_type j = 0; j < nc; j++) |
405 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 406 { |
407 OCTAVE_QUIT; | |
408 result.elem (b.ridx(i), j) = a / b.data (i); | |
409 } | |
410 | |
411 return result; | |
412 } | |
413 | |
414 ComplexMatrix | |
415 x_el_div (const Complex a, const SparseMatrix& b) | |
416 { | |
5275 | 417 octave_idx_type nr = b.rows (); |
418 octave_idx_type nc = b.cols (); | |
5164 | 419 |
420 ComplexMatrix result (nr, nc, (a / 0.0)); | |
421 | |
5275 | 422 for (octave_idx_type j = 0; j < nc; j++) |
423 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 424 { |
425 OCTAVE_QUIT; | |
426 result.elem (b.ridx(i), j) = a / b.data (i); | |
427 } | |
428 | |
429 return result; | |
430 } | |
431 | |
432 ComplexMatrix | |
433 x_el_div (const Complex a, const SparseComplexMatrix& b) | |
434 { | |
5275 | 435 octave_idx_type nr = b.rows (); |
436 octave_idx_type nc = b.cols (); | |
5164 | 437 |
438 ComplexMatrix result (nr, nc, (a / 0.0)); | |
439 | |
5275 | 440 for (octave_idx_type j = 0; j < nc; j++) |
441 for (octave_idx_type i = b.cidx(j); i < b.cidx(j+1); i++) | |
5164 | 442 { |
443 OCTAVE_QUIT; | |
444 result.elem (b.ridx(i), j) = a / b.data (i); | |
445 } | |
446 | |
447 return result; | |
448 } | |
449 | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
450 // Left division functions. X \ Y = inv(X) * Y |
5164 | 451 // |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
452 // Y \ X : sm scm dm dcm |
5164 | 453 // +-- +---+----+ |
454 // matrix | 1 | 5 | | |
455 // +---+----+ | |
456 // complex_matrix | 2 | 6 | | |
8965
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 matrix | 3 | 7 | 9 | 11 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
459 // +---+----+----+----+ |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
460 // sparse complex_matrix | 4 | 8 | 10 | 12 | |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
461 // +---+----+----+----+ |
5164 | 462 |
463 // -*- 1 -*- | |
464 Matrix | |
5785 | 465 xleftdiv (const SparseMatrix& a, const Matrix& b, MatrixType &typ) |
5164 | 466 { |
467 if (! mx_leftdiv_conform (a, b)) | |
468 return Matrix (); | |
469 | |
5275 | 470 octave_idx_type info; |
5681 | 471 double rcond = 0.0; |
472 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 473 } |
474 | |
475 // -*- 2 -*- | |
476 ComplexMatrix | |
5785 | 477 xleftdiv (const SparseMatrix& a, const ComplexMatrix& b, MatrixType &typ) |
5164 | 478 { |
479 if (! mx_leftdiv_conform (a, b)) | |
480 return ComplexMatrix (); | |
481 | |
5275 | 482 octave_idx_type info; |
5681 | 483 double rcond = 0.0; |
484 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 485 } |
486 | |
487 // -*- 3 -*- | |
488 SparseMatrix | |
5785 | 489 xleftdiv (const SparseMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 490 { |
491 if (! mx_leftdiv_conform (a, b)) | |
492 return SparseMatrix (); | |
493 | |
5275 | 494 octave_idx_type info; |
5681 | 495 double rcond = 0.0; |
496 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 497 } |
498 | |
499 // -*- 4 -*- | |
500 SparseComplexMatrix | |
5785 | 501 xleftdiv (const SparseMatrix& a, const SparseComplexMatrix& b, MatrixType &typ) |
5164 | 502 { |
503 if (! mx_leftdiv_conform (a, b)) | |
504 return SparseComplexMatrix (); | |
505 | |
5275 | 506 octave_idx_type info; |
5681 | 507 double rcond = 0.0; |
508 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 509 } |
510 | |
511 // -*- 5 -*- | |
512 ComplexMatrix | |
5785 | 513 xleftdiv (const SparseComplexMatrix& a, const Matrix& b, MatrixType &typ) |
5164 | 514 { |
515 if (! mx_leftdiv_conform (a, b)) | |
516 return ComplexMatrix (); | |
517 | |
5275 | 518 octave_idx_type info; |
5681 | 519 double rcond = 0.0; |
520 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 521 } |
522 | |
523 // -*- 6 -*- | |
524 ComplexMatrix | |
5785 | 525 xleftdiv (const SparseComplexMatrix& a, const ComplexMatrix& b, MatrixType &typ) |
5164 | 526 { |
527 if (! mx_leftdiv_conform (a, b)) | |
528 return ComplexMatrix (); | |
529 | |
5275 | 530 octave_idx_type info; |
5681 | 531 double rcond = 0.0; |
532 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 533 } |
534 | |
535 // -*- 7 -*- | |
536 SparseComplexMatrix | |
5785 | 537 xleftdiv (const SparseComplexMatrix& a, const SparseMatrix& b, MatrixType &typ) |
5164 | 538 { |
539 if (! mx_leftdiv_conform (a, b)) | |
540 return SparseComplexMatrix (); | |
541 | |
5275 | 542 octave_idx_type info; |
5681 | 543 double rcond = 0.0; |
544 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 545 } |
546 | |
547 // -*- 8 -*- | |
548 SparseComplexMatrix | |
5322 | 549 xleftdiv (const SparseComplexMatrix& a, const SparseComplexMatrix& b, |
5785 | 550 MatrixType &typ) |
5164 | 551 { |
552 if (! mx_leftdiv_conform (a, b)) | |
553 return SparseComplexMatrix (); | |
554 | |
5275 | 555 octave_idx_type info; |
5681 | 556 double rcond = 0.0; |
557 return a.solve (typ, b, info, rcond, solve_singularity_warning); | |
5164 | 558 } |
559 | |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
560 template <typename RT, typename DM, typename SM> |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
561 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
|
562 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
563 const octave_idx_type a_nr = a.rows (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
564 const octave_idx_type a_nc = a.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 const octave_idx_type d_nc = d.cols (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
567 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
568 using std::min; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
569 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
|
570 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
571 if ( ! mx_leftdiv_conform (d, a)) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
572 return RT (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
573 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
574 const octave_idx_type nz = a.nnz (); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
575 RT r (nr, a_nc, nz); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
576 |
9196
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
577 typedef typename DM::element_type DM_elt_type; |
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
578 const DM_elt_type zero = DM_elt_type (); |
8965
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_idx_type k_result = 0; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
581 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
|
582 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
583 OCTAVE_QUIT; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
584 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
|
585 r.xcidx (j) = k_result; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
586 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
|
587 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
588 const octave_idx_type i = a.ridx (k); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
589 if (i < nr) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
590 { |
9196
c229bfb14d8d
avoid apparent MSVC bug with typedef
John W. Eaton <jwe@octave.org>
parents:
9003
diff
changeset
|
591 const DM_elt_type s = d.dgelem (i); |
8965
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
592 if (s != zero) |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
593 { |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
594 r.xdata (k_result) = a.data (k) / s; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
595 r.xridx (k_result) = i; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
596 ++k_result; |
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 } |
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.xcidx (a_nc) = k_result; |
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 r.maybe_compress (true); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
604 return r; |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
605 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
606 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
607 // -*- 9 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
608 SparseMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
609 xleftdiv (const DiagMatrix& d, const SparseMatrix& a, MatrixType&) |
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 return do_leftdiv_dm_sm<SparseMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
612 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
613 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
614 // -*- 10 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
615 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
616 xleftdiv (const DiagMatrix& d, const SparseComplexMatrix& a, MatrixType&) |
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 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
619 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
620 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
621 // -*- 11 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
622 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
623 xleftdiv (const ComplexDiagMatrix& d, const SparseMatrix& a, MatrixType&) |
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 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
626 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
627 |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
628 // -*- 12 -*- |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
629 SparseComplexMatrix |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
630 xleftdiv (const ComplexDiagMatrix& d, const SparseComplexMatrix& a, MatrixType&) |
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 return do_leftdiv_dm_sm<SparseComplexMatrix> (d, a); |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
633 } |
42aff15e059b
Implement diag \ sparse and sparse / diag.
Jason Riedy <jason@acm.org>
parents:
7017
diff
changeset
|
634 |
5164 | 635 /* |
636 ;;; Local Variables: *** | |
637 ;;; mode: C++ *** | |
638 ;;; End: *** | |
639 */ |