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
145mat<T> operator*(
const perm_mat& p,
const mat<T>& m)
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++)
162mat<T> operator*(
const mat<T>& m,
const perm_mat& p)
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++)
180vec<T> operator*(
const perm_mat& p,
const vec<T>& v)
183 for(
unsigned i = 0; i < v.size(); i++)
193inline perm_mat transpose(
const perm_mat &p)
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
void resize(unsigned dim)
resize the vector
unsigned size() const
number of elements
std::ostream & operator<<(std::ostream &os, const vr_device_info &di)
stream out operator for device infos
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