N x N matrix.  
 More...
#include <JMatrixND.hh>
N x N matrix. 
Definition at line 63 of file JMatrixND.hh.
 
◆ matrix_type
◆ const_row_type
◆ const_col_type
◆ row_type
◆ col_type
◆ JMatrixND() [1/2]
  
  
      
        
          | JMATH::JMatrixND::JMatrixND  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ JMatrixND() [2/2]
  
  
      
        
          | JMATH::JMatrixND::JMatrixND  | 
          ( | 
          const size_t  | 
          size | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
 
◆ resize()
  
  
      
        
          | void JMATH::JMatrixND::resize  | 
          ( | 
          const size_t  | 
          size | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Resize matrix. 
Note that this method resets the matrix.
- Parameters
 - 
  
  
 
Definition at line 98 of file JMatrixND.hh.
  100       matrix_type::resize(size);
 
  102       for (
row_type row = this->begin(); row != this->end(); ++row) {
 
  106         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ at() [1/2]
  
  
      
        
          | double JMATH::JMatrixND::at  | 
          ( | 
          size_t  | 
          row,  | 
         
        
           | 
           | 
          size_t  | 
          col  | 
         
        
           | 
          ) | 
           |  const | 
         
       
   | 
  
inline   | 
  
 
Get matrix element. 
- Parameters
 - 
  
    | row | row number  | 
    | col | column number  | 
  
   
- Returns
 - matrix element at (row,col) 
 
Definition at line 120 of file JMatrixND.hh.
  122       return (*
this)[row][col];
 
 
 
 
◆ at() [2/2]
  
  
      
        
          | double& JMATH::JMatrixND::at  | 
          ( | 
          size_t  | 
          row,  | 
         
        
           | 
           | 
          size_t  | 
          col  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Get matrix element. 
- Parameters
 - 
  
    | row | row number  | 
    | col | column number  | 
  
   
- Returns
 - matrix element at (row,col) 
 
Definition at line 133 of file JMatrixND.hh.
  135       return (*
this)[row][col];
 
 
 
 
◆ operator()() [1/2]
  
  
      
        
          | double JMATH::JMatrixND::operator()  | 
          ( | 
          size_t  | 
          row,  | 
         
        
           | 
           | 
          size_t  | 
          col  | 
         
        
           | 
          ) | 
           |  const | 
         
       
   | 
  
inline   | 
  
 
Get matrix element. 
- Parameters
 - 
  
    | row | row number  | 
    | col | column number  | 
  
   
- Returns
 - matrix element at (row,col) 
 
Definition at line 146 of file JMatrixND.hh.
 
 
◆ operator()() [2/2]
  
  
      
        
          | double& JMATH::JMatrixND::operator()  | 
          ( | 
          size_t  | 
          row,  | 
         
        
           | 
           | 
          size_t  | 
          col  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inline   | 
  
 
Get matrix element. 
- Parameters
 - 
  
    | row | row number  | 
    | col | column number  | 
  
   
- Returns
 - matrix element at (row,col) 
 
Definition at line 159 of file JMatrixND.hh.
 
 
◆ reset()
Set matrix to the null matrix. 
- Returns
 - this matrix 
 
Definition at line 170 of file JMatrixND.hh.
  172       for (
row_type row = this->begin(); row != this->end(); ++row) {
 
  173         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ setIdentity()
Set to identity matrix. 
- Returns
 - this matrix 
 
Definition at line 187 of file JMatrixND.hh.
  189       for (
size_t i = 0; i != this->size(); ++i) {
 
  193         for (
size_t j = 0; 
j != i; ++
j) {
 
 
 
 
◆ transpose()
Transpose. 
- Returns
 - this matrix 
 
Definition at line 207 of file JMatrixND.hh.
  209       for (
size_t i = 0; i != this->size(); ++i) {
 
  210         for (
size_t j = 0; 
j != i; ++
j) {
 
  211           std::swap(
at(i,
j), 
at(
j,i));
 
 
 
 
◆ negate()
Negate matrix. 
- Returns
 - this matrix 
 
Definition at line 224 of file JMatrixND.hh.
  226       for (
row_type row = this->begin(); row != this->end(); ++row) {
 
  227         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ add()
Matrix addition. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 242 of file JMatrixND.hh.
  244       if (this->size() == A.size()) {
 
  246         for (
size_t i = 0; i != this->size(); ++i) {
 
  247           for (
size_t j = 0; 
j != this->size(); ++
j) {
 
  253         THROW(JException, 
"JMatrixND::add() inconsistent matrix dimensions " << this->size() << 
' ' << A.size());
 
 
 
 
◆ sub()
Matrix subtraction. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 266 of file JMatrixND.hh.
  268       if (this->size() == A.size()) {
 
  270         for (
size_t i = 0; i != this->size(); ++i) {
 
  271           for (
size_t j = 0; 
j != this->size(); ++
j) {
 
  277         THROW(JException, 
"JMatrixND::sub() inconsistent matrix dimensions " << this->size() << 
' ' << A.size());
 
 
 
 
◆ mul() [1/3]
  
  
      
        
          | JMatrixND& JMATH::JMatrixND::mul  | 
          ( | 
          const double  | 
          factor | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Scale matrix. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 290 of file JMatrixND.hh.
  292       for (
row_type row = this->begin(); row != this->end(); ++row) {
 
  293         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ div()
  
  
      
        
          | JMatrixND& JMATH::JMatrixND::div  | 
          ( | 
          const double  | 
          factor | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Scale matrix. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 308 of file JMatrixND.hh.
  310       for (
row_type row = this->begin(); row != this->end(); ++row) {
 
  311         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ mul() [2/3]
Matrix multiplication. 
- Parameters
 - 
  
  
 
- Returns
 - this matrix 
 
Definition at line 327 of file JMatrixND.hh.
  330       if (A.size() == B.size()) {
 
  334         for (
size_t i = 0; i != A.size(); ++i) {
 
  335           for (
size_t j = 0; 
j != A.size(); ++
j) {
 
  339             for (
size_t k = 0; k != A.size(); ++k) {
 
  340               this->
at(i,
j) += A[i][k] * B[k][
j];
 
  347         THROW(JException, 
"JMatrixND::mul() inconsistent matrix dimensions " << A.size() << 
' ' << B.size());
 
 
 
 
◆ equals()
  
  
      
        
          | bool JMATH::JMatrixND::equals  | 
          ( | 
          const JMatrixND &  | 
          A,  | 
         
        
           | 
           | 
          const double  | 
          eps = std::numeric_limits<double>::min()  | 
         
        
           | 
          ) | 
           |  const | 
         
       
   | 
  
inline   | 
  
 
Equality. 
- Parameters
 - 
  
    | A | matrix  | 
    | eps | numerical precision  | 
  
   
- Returns
 - true if matrices identical; else false 
 
Definition at line 361 of file JMatrixND.hh.
  364       if (this->size() == A.size()) {
 
  366         for (
const_row_type row1 = this->begin(), row2 = A.begin(); row1 != this->end(); ++row1, ++row2) {
 
  367           for (
const_col_type col1 = row1->begin(), col2 = row2->begin(); col1 != row1->end(); ++col1, ++col2) {
 
  368             if (fabs(*col1 - *col2) > eps) {
 
  377         THROW(JException, 
"JMatrixND::equals() inconsistent matrix dimensions " << this->size() << 
' ' << A.size());
 
 
 
 
◆ isIdentity()
  
  
      
        
          | bool JMATH::JMatrixND::isIdentity  | 
          ( | 
          const double  | 
          eps = std::numeric_limits<double>::min() | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Test identity. 
- Parameters
 - 
  
  
 
- Returns
 - true if identity matrix; else false 
 
Definition at line 388 of file JMatrixND.hh.
  390       for (
size_t i = 0; i != this->size(); ++i) {
 
  392         if (fabs(1.0 - 
at(i,i)) > eps) {
 
  396         for (
size_t j = 0; 
j != i; ++
j) {
 
  397           if (fabs(
at(i,
j)) > eps || fabs(
at(
j,i)) > eps) {
 
 
 
 
◆ getDeterminant()
  
  
      
        
          | double JMATH::JMatrixND::getDeterminant  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Get determinant of matrix. 
- Returns
 - determinant of matrix 
 
Definition at line 412 of file JMatrixND.hh.
  420       for (
size_t i = 0; i != A.size(); ++i) {
 
  424       return det * A.getSign();
 
 
 
 
◆ isPositiveDefinite()
  
  
      
        
          | bool JMATH::JMatrixND::isPositiveDefinite  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Test positive definiteness. 
- Returns
 - true if positive definite; else false 
 
Definition at line 433 of file JMatrixND.hh.
  439       for (
size_t i = 0; i != A.size(); ++i) {
 
  440         if (A[i][i] <= 0.0) {
 
 
 
 
◆ isPositiveSemiDefinite()
  
  
      
        
          | const bool JMATH::JMatrixND::isPositiveSemiDefinite  | 
          ( | 
           | ) | 
           const | 
         
       
   | 
  
inline   | 
  
 
Test positive semi-definiteness. 
- Returns
 - true if positive semi-definite; else false 
 
Definition at line 454 of file JMatrixND.hh.
  460       for (
size_t i = 0; i != A.size(); ++i) {
 
 
 
 
◆ mul() [3/3]
Multiply with object. 
- Parameters
 - 
  
  
 
- Returns
 - result object 
 
Definition at line 273 of file JMath.hh.
 
 
◆ operator>>
Read matrix from input. 
- Parameters
 - 
  
  
 
- Returns
 - reader 
 
Definition at line 477 of file JMatrixND.hh.
  485       for (
row_type row = matrix.begin(); row != matrix.end(); ++row) {
 
  486         for (
col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ operator<< [1/2]
Write matrix to output. 
- Parameters
 - 
  
  
 
- Returns
 - writer 
 
Definition at line 502 of file JMatrixND.hh.
  504       int size = matrix.size();
 
  508       for (
const_row_type row = matrix.begin(); row != matrix.end(); ++row) {
 
  509         for (
const_col_type col = row->begin(); col != row->end(); ++col) {
 
 
 
 
◆ operator<< [2/2]
  
  
      
        
          | std::ostream& operator<<  | 
          ( | 
          std::ostream &  | 
          out,  | 
         
        
           | 
           | 
          const JMatrixND &  | 
          A  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
friend   | 
  
 
Print ASCII formatted output. 
- Parameters
 - 
  
  
 
- Returns
 - output stream 
 
Definition at line 525 of file JMatrixND.hh.
  533         for (
const_col_type col = row->begin(); col != row->end(); ++col) {
 
  534           out << 
FIXED(10,2) << *col << 
' ';
 
 
 
 
The documentation for this class was generated from the following file: