58 for(
unsigned i = 0; i < n; i++)
67 for(
unsigned i = 0; i <
_data.size(); i++)
73 operator const mat<T>()
const
78 for(
unsigned i =0; i <
size();i++)
90 for(
unsigned i = 0; i <
size();i++)
92 r(i) = m(
operator()(i));
104 for(
unsigned i = 0; i <
_data.size(); i++)
109 void swap(
unsigned i,
unsigned j)
115 unsigned& operator()(
unsigned i)
121 unsigned& operator[](
unsigned i)
127 unsigned operator()(
unsigned i)
const
133 unsigned operator[](
unsigned i)
const
147 mat<T> r(m.nrows(),m.ncols());
149 for(
unsigned i = 0; i < m.nrows(); i++)
151 for(
unsigned j = 0; j < m.ncols(); j++)
164 mat<T> r(m.nrows(),m.ncols());
166 for(
unsigned i = 0; i < m.nrows(); i++)
168 for(
unsigned j = 0; j < m.ncols(); j++)
183 for(
unsigned i = 0; i < v.size(); i++)
203inline std::ostream& operator<<(std::ostream& out,
const perm_mat& m)
206 for (
int i=0;i<(int)m.size();++i)
207 out << i <<
"->"<< m(i)<<
"\n";
A matrix type (full column major storage) The matrix can be loaded directly into OpenGL without need ...
void zeros()
set zero matrix
this header is dependency free
a permutation matrix type
void identity()
set to identity matrix
void transpose()
compute the transpose permutation matrix (equal to inverse permutation)
vec< unsigned > _data
internal storage of the permutation
unsigned ncols() const
number of rows
void resize(unsigned n)
resize the permutation matrix
perm_mat operator*(const perm_mat &m)
product with another permutation matrix
perm_mat(unsigned n)
create an nxn identity permutation matrix (storage is only n)
unsigned size() const
number of stored elements
perm_mat(vec< unsigned > p)
creates a permutation from a given permutation vector
perm_mat()
standard constructor
unsigned nrows() const
number of rows