40 cout <<
"Hi, I'm a matrix with " << rows_ <<
" rows and " << cols_ <<
" cols_" << endl;
42 for (
int i = 0;
i < rows_ * cols_;
i ++){
43 cout <<data_[
i] <<
" ";
48 double &Matrix::operator() (
int r,
int c){
49 assert ( 0 <= r && r <= rows_ && 0 <= c && c <= cols_);
50 return data_[r*cols_ + c];
53 double Matrix::operator() (
int r,
int c)
const {
54 assert ( 0 <= r && r <= rows_ && 0 <= c && c <= cols_);
55 return data_[r*cols_ + c];
58 const Matrix &Matrix::operator = (
const Matrix &right){
63 for (
int r = 0; r < rows_; r ++){
64 for (
int c = 0; c < cols_; c ++ ){
65 data_[r*cols_+c] = right.data_[r*cols_+c];
74 const Matrix &Matrix::operator ^= (
const Matrix &right){
79 for (
int r = 0; r < rows_; r ++){
80 for (
int c = 0; c < rows_; c ++ ){
82 for (
int j = 0;
j < right.rows_;
j ++){
83 data_[r*rows_+c] += right(
j,r) * right(
j,c) ;
93 for (
int r = 0; r <m.rows_; r++){
94 for (
int c = 0; c < m.cols_; c++){
95 output << m(r,c) <<
" ";
115 for (
int r = 0; r < cols_; r++){
116 for (
int c = 0; c < 3; c++){
117 data_[c*cols_+r] = pnts[r][c];
133 assert( (rows_ == 3) && (cols_ == 2 || cols_ ==3) );
136 double s1 = (*this)(1,0)*(*
this)(2,1) - (*
this)(1,1)*(*
this)(2,0);
137 double s2 = (*this)(2,0)*(*
this)(0,1) - (*
this)(2,1)*(*
this)(0,0);
138 double s3 = (*this)(0,0)*(*
this)(1,1) - (*
this)(0,1)*(*
this)(1,0);
142 return sqrt ( s1 + s2 + s3 );
146 (*
this)(0,0) * ((*
this)(1,1)*(*
this)(2,2)-(*
this)(1,2)*(*
this)(2,1)) -
147 (*this)(0,1) * ((*
this)(1,0)*(*
this)(2,2)-(*
this)(1,2)*(*
this)(2,0)) +
148 (*this)(0,2) * ((*
this)(1,0)*(*
this)(2,1)-(*
this)(1,1)*(*
this)(2,0));
#define MOP_END_NAMESPACE
Declaration of Matrix class.
double det(const Matrix3D &A)
#define MOP_BEGIN_NAMESPACE
std::ostream & operator<<(std::ostream &os, const COM_exception &ex)
Print out a given exception.
void info()
Print informations about CImg environement variables.