Carmen Code
 All Classes Files Functions Variables Macros Pages
Functions
Matrix.cpp File Reference

Construct the data structures. More...

#include "Carmen.h"
Include dependency graph for Matrix.cpp:

Functions

Matrix operator* (const real a, const Matrix &M)
 Returns the product of the current matrix and a real a. More...
 
ostream & operator<< (ostream &out, const Matrix &M)
 Writes the components of the matrix M on screen. More...
 

Detailed Description

Construct the data structures.

Function Documentation

Matrix operator* ( const real  a,
const Matrix M 
)

Returns the product of the current matrix and a real a.

Example :

#include "Matrix.h"

Matrix M(5,3);
Matrix P;
real b = 2.;
...
P = b*M;

The operation P = M*b can also be done. See Matrix Matrix::operator*(const real a) const.

Parameters
aReal value
MMatrix
Returns
Matrix

1041 {
1042  return M*a;
1043 }
ostream& operator<< ( ostream &  out,
const Matrix M 
)

Writes the components of the matrix M on screen.

Parameters
out
MMatrix
Returns
ostream&
1054 {
1055  int n;
1056  int m;
1057 
1058  for (n = 1; n <= M.lines(); n++)
1059  {
1060  for (m = 1; m <= M.columns(); m++)
1061  {
1062  out<<n<<","<<m<<": "<<M.value(n,m)<<endl;
1063  }
1064  }
1065  return out;
1066 }
real value(const int i, const int j) const
Returns the value of the component i, j.
Definition: Matrix.h:515
int lines() const
Returns the number of lines of the matrix.
Definition: Matrix.h:486
int columns() const
Returns the number of columns of the matrix.
Definition: Matrix.h:495