#include "sparse_block_matrix.h"
#include <iostream>
Go to the source code of this file.
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 46 of file sparse_block_matrix_test.cpp.
References g2o::SparseBlockMatrix< MatrixType >::add(), g2o::SparseBlockMatrix< MatrixType >::block(), g2o::SparseBlockMatrix< MatrixType >::clear(), g2o::SparseBlockMatrix< MatrixType >::multiply(), g2o::SparseBlockMatrix< MatrixType >::symmPermutation(), and g2o::SparseBlockMatrix< MatrixType >::transpose().
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 ...
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
Sparse matrix which uses blocks.
Definition at line 37 of file sparse_block_matrix_test.cpp.
38 for (
int i=0; i<m.rows(); ++i){
39 for (
int j=0; j<m.cols(); ++j)
40 cerr << m(i,j) <<
" ";