Mercurial > hg > octave-lyh
comparison liboctave/CSparse.cc @ 8366:8b1a2555c4e2
implement diagonal matrix objects
* * *
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Wed, 03 Dec 2008 13:32:57 +0100 |
parents | 64cf956a109c |
children | 25bc2d31e1bf |
comparison
equal
deleted
inserted
replaced
8365:65ca196fff28 | 8366:8b1a2555c4e2 |
---|---|
142 data (i) = Complex (a.data (i)); | 142 data (i) = Complex (a.data (i)); |
143 ridx (i) = a.ridx (i); | 143 ridx (i) = a.ridx (i); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 SparseComplexMatrix::SparseComplexMatrix (const ComplexDiagMatrix& a) | |
148 : MSparse<Complex> (a.rows (), a.cols (), a.nnz ()) | |
149 { | |
150 octave_idx_type nz = a.nnz (), l = a.length (); | |
151 for (octave_idx_type i = 0, j = 0; i < l; i++) | |
152 { | |
153 if (a(i, i) != Complex (0.0, 0.0)) | |
154 { | |
155 data (j) = a(i, i); | |
156 ridx (j) = i; | |
157 cidx (j) = j; | |
158 j++; | |
159 } | |
160 } | |
161 cidx (nz) = nz; | |
162 } | |
147 bool | 163 bool |
148 SparseComplexMatrix::operator == (const SparseComplexMatrix& a) const | 164 SparseComplexMatrix::operator == (const SparseComplexMatrix& a) const |
149 { | 165 { |
150 octave_idx_type nr = rows (); | 166 octave_idx_type nr = rows (); |
151 octave_idx_type nc = cols (); | 167 octave_idx_type nc = cols (); |