Mercurial > hg > octave-nkf
diff liboctave/array/fMatrix.cc @ 19039:aa9ca67f09fb
make all permutation matrices column permutations (bug #42418)
Making all permutation matrices column permutations allows permutation
matrices to be iterated over in column-major order just like any other
matrix.
* PermMatrix.h, PermMatrix.cc (PermMatrix::_colp): Delete member
variable and all uses.
(PermMatrix::transpose): Create new matrix with internal
representation flipped.
(PermMatrix::pos_power): New function.
(PermMatrix::eye): Call the one-argument constructor which already
defaults to the identity matrix.
(PermMatrix::is_col_perm): Unconditionally return true.
(PermMatrix::is_row_perm): Unconditionally return false.
(PermMatrix::data, PermMatrix::fortran_vec, PermMatrix::pvec): Delete.
(PermMatrix::col_perm_vec): New function.
* lu.cc: New test.
* base-lu.cc (base_lu<lu_type>::base_lu): Call transpose in ipvt
initialization.
* find.cc, kron.cc, pr-output.cc, ov-perm.cc, PermMatrix.cc,
PermMatrix.h, Sparse.cc, dMatrix.cc, fMatrix.cc, CmplxQRP.cc,
base-lu.cc, dbleQRP.cc, fCmplxQRP.cc, floatQRP.cc,
Sparse-perm-op-defs.h, mx-op-defs.h: Adapt to PermMatrix changes.
author | David Spies <dnspies@gmail.com> |
---|---|
date | Wed, 18 Jun 2014 19:38:40 -0600 |
parents | cb37b17b6091 |
children | 479d1d3cb5c3 |
line wrap: on
line diff
--- a/liboctave/array/fMatrix.cc +++ b/liboctave/array/fMatrix.cc @@ -259,14 +259,10 @@ FloatMatrix::FloatMatrix (const PermMatrix& a) : MArray<float> (a.dims (), 0.0) { - const Array<octave_idx_type> ia (a.pvec ()); + const Array<octave_idx_type> ia (a.col_perm_vec ()); octave_idx_type len = a.rows (); - if (a.is_col_perm ()) - for (octave_idx_type i = 0; i < len; i++) - elem (ia(i), i) = 1.0; - else - for (octave_idx_type i = 0; i < len; i++) - elem (i, ia(i)) = 1.0; + for (octave_idx_type i = 0; i < len; i++) + elem (ia(i), i) = 1.0; } // FIXME: could we use a templated mixed-type copy function here?