11 #ifndef __UT_RefMatrixImpl__
12 #define __UT_RefMatrixImpl__
14 #ifndef __UT_RefMatrix_h__
15 #error Do not include this file directly. Include UT_RefMatrix.h instead.
46 myArray.swap(other.myArray);
47 UTswap(myRows, other.myRows);
48 UTswap(myCols, other.myCols);
59 myArray.entries(myRows*myCols);
60 for (
int i = rows(); i-- > index+1; )
61 for (
int j = 0;
j < cols();
j++)
62 (*
this)(i,
j) = (*
this)(i-1,
j);
70 return insertRow(r, rows());
79 for (
int j = 0;
j < cols();
j++)
94 myArray.entries(myRows*myCols);
95 for (
int i = rows(); i-- > 0; )
97 for (
int j = cols();
j-- > index+1; )
98 myArray(i*myCols+
j) = myArray(i*pcols+
j-1);
99 for (
int j = index;
j-- > 0; )
100 myArray(i*myCols+
j) = myArray(i*pcols+
j);
109 return insertCol(r, cols());
117 for (
int i = 0; i < rows(); i++)
126 for (
int i = index; i < rows()-1; i++)
128 for (
int j = 0;
j < cols();
j++)
129 (*
this)(i,
j) = (*
this)(i+1,
j);
132 myArray.entries(myRows*myCols);
140 int ncols = myCols-1;
141 for (
int i = 0; i < rows(); i++)
144 myArray(i*ncols+
j) = myArray(i*myCols+
j);
145 for (
int j = index;
j < cols()-1;
j++)
146 myArray(i*ncols+
j) = myArray(i*myCols+
j+1);
149 myArray.entries(myRows*myCols);
157 if (rowshift || colshift)
162 ic = rowshift % rows();
163 ic = ic < 0 ? ic+rows() : ic;
164 for (
int i = 0; i < rows(); i++)
166 jc = colshift % cols();
167 jc = jc < 0 ? jc+cols() : jc;
168 for (
int j = 0;
j < cols();
j++)
170 (*this)(ic, jc) = tmp(i,
j);
171 jc++;
if (jc >= cols()) jc -= cols();
173 ic++;
if (ic >= rows()) ic -= rows();
181 unsigned int *
n)
const
183 for (*m = 0; *m < rows(); (*m)++)
184 for (*n = 0; *n < cols(); (*n)++)
185 if ((*
this)(*m,*
n) == t)
return 0;
193 if (mSz == rows() && nSz == cols())
203 myArray.entries(myRows*myCols);
205 for (
int i = 0; i <
SYSmin(rows(), tmp.
rows()); i++)
207 (*
this)(i,
j) = tmp(i,
j);
214 if (
this == &m)
return *
this;
225 if (
this == &m)
return 1;
226 if (!(rows() == m.
rows() && cols() == m.
cols()))
228 return myArray == m.myArray;
235 if (myArray.apply(apply_func,d) != myArray.entries())
240 #endif // __UT_RefMatrixImpl__
int apply(int(*apply_func)(T &t, void *d), void *d)
UT_RefMatrix< T > & operator=(const UT_RefMatrix< T > &m)
int removeRow(unsigned int index)
unsigned int insertRow(unsigned int index)
void swap(UT_RefMatrix< T > &other)
UT_RefMatrix(unsigned int mSz=0, unsigned int nSz=0)
void resize(unsigned int mSz, unsigned int nSz)
unsigned int rows() const
int find(const T &t, unsigned int *m, unsigned int *n) const
unsigned int insertCol(unsigned int index)
int removeCol(unsigned int index)
void cycle(int rowshift, int colshift)
unsigned int appendCol(const UT_Array< T > &c)
unsigned int cols() const
int operator==(const UT_RefMatrix< T > &m) const
unsigned int appendRow(const UT_Array< T > &r)