30template<
class T,
int _Rows,
int _Cols>
31class gsAsMatrix :
public gsEigen::Map< gsEigen::Matrix<T,_Rows,_Cols> >
34 typedef gsEigen::Map< gsEigen::Matrix<T,_Rows,_Cols> > Base;
46 typedef gsEigen::Transpose<Base> Tr;
49 typedef const gsEigen::Transpose<const Base> constTr;
53 : Base( v.data(), n, m)
60 : Base( v.data(), 1, v.size() )
76 template <
class EigenExpr>
77 gsAsMatrix& operator= (
const EigenExpr & other)
79 this->Base::operator=(other);
83 using Base::operator=;
91 const index_t mrows = this->rows()-1,
92 mcols = this->cols()-1;
95 result.resize(mrows,mcols);
96 result.block(0,0,i,j) = this->block(0,0,i,j);
97 result.block(i,0,mrows-i,j) = this->block(i+1,0,mrows-i,j);
98 result.block(0,j,i,mcols-j) = this->block(0,j+1,i,mcols-j);
99 result.block(i,j,mrows-i,mcols-j) = this->block(i+1,j+1,mrows-i,mcols-j);
107 const index_t mrows = this->rows()-1;
109 result.resize(mrows, this->cols());
110 result.topRows(i) = this->topRows(i);
111 result.bottomRows(mrows-i) = this->bottomRows(mrows-i);
119 const index_t mcols = this->cols()-1;
120 GISMO_ASSERT( 0 <= j && j <= mcols,
"Invalid column." );
121 result.resize( this->rows(), mcols);
122 result.leftCols(j) = this->leftCols(j);
123 result.rightCols(mcols-j) = this->rightCols(mcols-j);
139template<
class T,
int _Rows,
int _Cols>
143 typedef gsEigen::Map<const gsEigen::Matrix<T,_Rows,_Cols> > Base;
146 typedef gsEigen::Transpose<Base> Tr;
149 typedef const gsEigen::Transpose<const Base> constTr;
163 : Base( v.data(), n, m)
169 : Base( v.data(), 1, v.size() )
175 : Base( pt, n, m) { }
177 gsAsConstMatrix(
const gsEigen::Map< gsEigen::Matrix<T,_Rows,_Cols> > & mat)
178 : Base( mat.data(), mat.rows(), mat.cols())
188 const index_t mrows = this->rows()-1,
189 mcols = this->cols()-1;
192 result.resize(mrows,mcols);
193 result.block(0,0,i,j) = this->block(0,0,i,j);
194 result.block(i,0,mrows-i,j) = this->block(i+1,0,mrows-i,j);
195 result.block(0,j,i,mcols-j) = this->block(0,j+1,i,mcols-j);
196 result.block(i,j,mrows-i,mcols-j) = this->block(i+1,j+1,mrows-i,mcols-j);
204 const index_t mrows = this->rows()-1;
206 result.resize(mrows, this->cols());
207 result.topRows(i) = this->topRows(i);
208 result.bottomRows(mrows-i) = this->bottomRows(mrows-i);
216 const index_t mcols = this->cols()-1;
217 GISMO_ASSERT( 0 <= j && j <= mcols,
"Invalid column." );
218 result.resize( this->rows(), mcols);
219 result.leftCols(j) = this->leftCols(j);
220 result.rightCols(mcols-j) = this->rightCols(mcols-j);
236template<
class T,
int _Rows>
246 typedef gsEigen::PermutationMatrix<_Rows> Permutation;
250 :
Base( v.data(), v.size(), 1 )
256 :
Base( pt, n, 1) { }
259 template <
class EigenExpr>
260 gsAsVector& operator= (
const EigenExpr & other)
262 this->Base::operator=(other);
266 using Base::operator=;
282template<
class T,
int _Rows>
294 :
Base( v.data(), v.size(), 1)
300 :
Base( pt, n, 1) { }
308template<
class T,
class iterator>
312 for (
index_t i = 0; i!=n; ++i)
313 for (
index_t j = 0; j!=m; ++j)
314 result(i,j)= *(it++);
Creates a mapped object or data pointer to a const matrix without copying data.
Definition gsAsMatrix.h:141
void colMinor(index_t j, ColMinorMatrixType &result) const
Definition gsAsMatrix.h:214
void firstMinor(index_t i, index_t j, FirstMinorMatrixType &result) const
Definition gsAsMatrix.h:186
void rowMinor(index_t i, RowMinorMatrixType &result) const
Definition gsAsMatrix.h:202
Creates a mapped object or data pointer to a const vector without copying data.
Definition gsAsMatrix.h:285
Creates a mapped object or data pointer to a matrix without copying data.
Definition gsAsMatrix.h:32
void colMinor(index_t j, ColMinorMatrixType &result) const
Definition gsAsMatrix.h:117
void firstMinor(index_t i, index_t j, FirstMinorMatrixType &result) const
Definition gsAsMatrix.h:89
void rowMinor(index_t i, RowMinorMatrixType &result) const
Definition gsAsMatrix.h:105
Creates a mapped object or data pointer to a vector without copying data.
Definition gsAsMatrix.h:239
A matrix with arbitrary coefficient type and fixed or dynamic size.
Definition gsMatrix.h:41
#define index_t
Definition gsConfig.h:32
#define GISMO_ASSERT(cond, message)
Definition gsDebug.h:89
The G+Smo namespace, containing all definitions for the library.
gsMatrix< T > makeMatrix(iterator it, index_t n, index_t m)
Utility to make a matrix out of an iterator to values.
Definition gsAsMatrix.h:309