comparison liboctave/array/fMatrix.cc @ 18849: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
comparison
equal deleted inserted replaced
18846:3d33fe79816c 18849:aa9ca67f09fb
257 } 257 }
258 258
259 FloatMatrix::FloatMatrix (const PermMatrix& a) 259 FloatMatrix::FloatMatrix (const PermMatrix& a)
260 : MArray<float> (a.dims (), 0.0) 260 : MArray<float> (a.dims (), 0.0)
261 { 261 {
262 const Array<octave_idx_type> ia (a.pvec ()); 262 const Array<octave_idx_type> ia (a.col_perm_vec ());
263 octave_idx_type len = a.rows (); 263 octave_idx_type len = a.rows ();
264 if (a.is_col_perm ()) 264 for (octave_idx_type i = 0; i < len; i++)
265 for (octave_idx_type i = 0; i < len; i++) 265 elem (ia(i), i) = 1.0;
266 elem (ia(i), i) = 1.0;
267 else
268 for (octave_idx_type i = 0; i < len; i++)
269 elem (i, ia(i)) = 1.0;
270 } 266 }
271 267
272 // FIXME: could we use a templated mixed-type copy function here? 268 // FIXME: could we use a templated mixed-type copy function here?
273 269
274 FloatMatrix::FloatMatrix (const boolMatrix& a) 270 FloatMatrix::FloatMatrix (const boolMatrix& a)