32 using namespace Eigen;
38 for (
int i=0; i<m.rows(); ++i){
39 for (
int j=0; j<m.cols(); ++j)
40 cerr << m(i,j) <<
" ";
46 int main (
int argc,
char** argv){
47 int rcol[] = {3,6,8,12};
48 int ccol[] = {2,4,13};
49 cerr <<
"creation" << endl;
52 cerr <<
"block access" << endl;
55 cerr << b->rows() <<
" " << b->cols() << endl;
56 for (
int i=0; i<b->rows(); ++i)
57 for (
int j=0; j<b->cols(); ++j){
58 (*b)(i,j)=i*b->cols()+j;
62 cerr <<
"block access 2" << endl;
63 b=M->
block(0,2,
true);
64 cerr << b->rows() <<
" " << b->cols() << endl;
65 for (
int i=0; i<b->rows(); ++i)
66 for (
int j=0; j<b->cols(); ++j){
67 (*b)(i,j)=i*b->cols()+j;
70 b=M->
block(3,2,
true);
71 cerr << b->rows() <<
" " << b->cols() << endl;
72 for (
int i=0; i<b->rows(); ++i)
73 for (
int j=0; j<b->cols(); ++j){
74 (*b)(i,j)=i*b->cols()+j;
79 cerr <<
"SUM" << endl;
94 int iperm[]={3,2,1,0};
101 Mp->
block(3,0)->fill(0.);
103 cerr << *PMp << endl;
bool transpose(SparseBlockMatrix< MatrixTransposedType > *&dest) const
transposes a block matrix, The transposed type should match the argument false on failure ...
std::ostream & operator<<(std::ostream &os, const SparseBlockMatrixX::SparseMatrixBlock &m)
SparseMatrixBlock * block(int r, int c, bool alloc=false)
returns the block at location r,c. if alloc=true he block is created if it does not exist ...
void clear(bool dealloc=false)
this zeroes all the blocks. If dealloc=true the blocks are removed from memory
MatrixType SparseMatrixBlock
this is the type of the elementary block, it is an Eigen::Matrix.
SparseBlockMatrix< MatrixXd > SparseBlockMatrixX
bool symmPermutation(SparseBlockMatrix< MatrixType > *&dest, const int *pinv, bool onlyUpper=false) const
bool multiply(SparseBlockMatrix< MatrixResultType > *&dest, const SparseBlockMatrix< MatrixFactorType > *M) const
dest = (*this) * M
bool add(SparseBlockMatrix< MatrixType > *&dest) const
adds the current matrix to the destination
int main(int argc, char **argv)
Sparse matrix which uses blocks.