Basic NxN matrix.
More...
#include <JMatrixND.hh>
Basic NxN matrix.
Definition at line 36 of file JMatrixND.hh.
◆ JMatrixND_t() [1/3]
JMATH::JMatrixND_t::JMatrixND_t |
( |
| ) |
|
|
inline |
Default constructor.
Definition at line 40 of file JMatrixND.hh.
double * __p
pointer to data
size_t __m
capacity of matrix
size_t __n
dimension of matrix
◆ JMatrixND_t() [2/3]
JMATH::JMatrixND_t::JMatrixND_t |
( |
const JMatrixND_t & |
A | ) |
|
|
inline |
Copy constructor.
- Parameters
-
Definition at line 52 of file JMatrixND.hh.
void set(const JMatrixND_t &A)
Set matrix.
JMatrixND_t()
Default constructor.
◆ JMatrixND_t() [3/3]
Move constructor.
- Parameters
-
Definition at line 64 of file JMatrixND.hh.
void swap(JMatrixND_t &A)
Swap matrices.
◆ ~JMatrixND_t()
JMATH::JMatrixND_t::~JMatrixND_t |
( |
| ) |
|
|
inline |
Destructor.
Definition at line 74 of file JMatrixND.hh.
void clear()
Clear memory.
◆ clear()
void JMATH::JMatrixND_t::clear |
( |
| ) |
|
|
inline |
◆ resize()
void JMATH::JMatrixND_t::resize |
( |
const size_t |
size | ) |
|
|
inline |
Resize matrix.
Note that this method does not maintain data in the matrix.
- Parameters
-
Definition at line 102 of file JMatrixND.hh.
116 THROW(JNewException,
"JMatrixND::resize(" <<
size <<
"): Memory allocation failure.");
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
size_t size() const
Get dimension of matrix.
◆ reset()
Set matrix to the null matrix.
- Returns
- this matrix
Definition at line 130 of file JMatrixND.hh.
132 double* p0 = this->
data();
133 double*
p1 = this->
data();
135 if (!this->
empty()) {
137 for (
size_t i = this->
size(); i != 0; --i, ++
p1) {
141 for (
size_t i = this->
size(); i != 1; --i,
p1 += this->
size()) {
142 memcpy(
p1, p0, this->
size() *
sizeof(
double));
const double * data() const
Get pointer to data.
bool empty() const
Check emptyness.
◆ set()
Set matrix.
- Parameters
-
Definition at line 155 of file JMatrixND.hh.
void resize(const size_t size)
Resize matrix.
◆ swap()
◆ transpose()
Transpose.
- Returns
- this matrix
Definition at line 183 of file JMatrixND.hh.
187 for (
size_t row = 0; row != this->
size(); ++row) {
188 for (
size_t col = 0; col != row; ++col) {
189 swap((*
this)(row,col), (*
this)(col,row));
◆ size()
size_t JMATH::JMatrixND_t::size |
( |
| ) |
const |
|
inline |
Get dimension of matrix.
- Returns
- dimension
Definition at line 202 of file JMatrixND.hh.
◆ capacity()
size_t JMATH::JMatrixND_t::capacity |
( |
| ) |
const |
|
inline |
Get capacity of dimension.
- Returns
- capacity
Definition at line 213 of file JMatrixND.hh.
◆ empty()
bool JMATH::JMatrixND_t::empty |
( |
| ) |
const |
|
inline |
Check emptyness.
- Returns
- true if empty; else false
Definition at line 224 of file JMatrixND.hh.
◆ data() [1/2]
const double* JMATH::JMatrixND_t::data |
( |
| ) |
const |
|
inline |
Get pointer to data.
- Returns
- pointer to data.
Definition at line 235 of file JMatrixND.hh.
◆ data() [2/2]
double* JMATH::JMatrixND_t::data |
( |
| ) |
|
|
inline |
Get pointer to data.
- Returns
- pointer to data.
Definition at line 246 of file JMatrixND.hh.
◆ operator[]() [1/2]
const double* JMATH::JMatrixND_t::operator[] |
( |
size_t |
row | ) |
const |
|
inline |
Get row data.
- Parameters
-
- Returns
- pointer to row data
Definition at line 258 of file JMatrixND.hh.
◆ operator[]() [2/2]
double* JMATH::JMatrixND_t::operator[] |
( |
size_t |
row | ) |
|
|
inline |
Get row data.
- Parameters
-
- Returns
- pointer to row data
Definition at line 270 of file JMatrixND.hh.
◆ operator()() [1/2]
double JMATH::JMatrixND_t::operator() |
( |
const size_t |
row, |
|
|
const size_t |
col |
|
) |
| const |
|
inline |
Get matrix element.
- Parameters
-
row | row number |
col | column number |
- Returns
- matrix element at (row,col)
Definition at line 283 of file JMatrixND.hh.
285 return *(
__p + row*
__n + col);
◆ operator()() [2/2]
double& JMATH::JMatrixND_t::operator() |
( |
const size_t |
row, |
|
|
const size_t |
col |
|
) |
| |
|
inline |
Get matrix element.
- Parameters
-
row | row number |
col | column number |
- Returns
- matrix element at (row,col)
Definition at line 296 of file JMatrixND.hh.
298 return *(
__p + row*
__n + col);
◆ at() [1/2]
double JMATH::JMatrixND_t::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 309 of file JMatrixND.hh.
311 if (row >= this->
size() ||
312 col >= this->
size()) {
313 THROW(JIndexOutOfRange,
"JMatrixND::at(" << row <<
"," << col <<
"): index out of range.");
316 return (*
this)(row, col);
◆ at() [2/2]
double& JMATH::JMatrixND_t::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 327 of file JMatrixND.hh.
329 if (row >= this->
size() ||
330 col >= this->
size()) {
331 THROW(JIndexOutOfRange,
"JMatrixND::at(" << row <<
"," << col <<
"): index out of range.");
334 return (*
this)(row, col);
◆ __p
double* JMATH::JMatrixND_t::__p |
|
protected |
◆ __n
size_t JMATH::JMatrixND_t::__n |
|
protected |
◆ __m
size_t JMATH::JMatrixND_t::__m |
|
protected |
The documentation for this struct was generated from the following file: