MatrixNxM< TYPE > Class Template Reference

#include <matrix_nxm.h>

Detailed Description

template<typename TYPE>
class maxon::MatrixNxM< TYPE >

General n x m matrix.

Public Types

using ValueType = TYPE
 

Public Member Functions

 MatrixNxM ()
 
 MatrixNxM (MatrixNxM &&src)
 
 MAXON_OPERATOR_MOVE_ASSIGNMENT (MatrixNxM)
 
Result< void > Resize (Int new_xcnt, Int new_ycnt)
 
Result< void > CopyFrom (const MatrixNxM &src)
 
TYPE & operator() (Int x, Int y)
 
const TYPE & operator() (const Int x, const Int y) const
 
Int GetXCount () const
 
Int GetYCount () const
 
Result< void > ShiftMatrix ()
 
String ToString (const FormatStatement *formatStatement=nullptr) const
 
 MAXON_OPERATOR_EQUALITY_HASHCODE (MatrixNxM, _xcnt, _ycnt, _arr)
 

Private Member Functions

 MAXON_DISALLOW_COPY_AND_ASSIGN (MatrixNxM)
 

Private Attributes

BaseArray< TYPE > _arr
 
Int _xcnt
 
Int _ycnt
 

Member Typedef Documentation

◆ ValueType

using ValueType = TYPE

Constructor & Destructor Documentation

◆ MatrixNxM() [1/2]

MatrixNxM ( )

Creates a matrix with no rows or columns.

◆ MatrixNxM() [2/2]

MatrixNxM ( MatrixNxM< TYPE > &&  src)

Member Function Documentation

◆ MAXON_DISALLOW_COPY_AND_ASSIGN()

MAXON_DISALLOW_COPY_AND_ASSIGN ( MatrixNxM< TYPE >  )
private

◆ MAXON_OPERATOR_MOVE_ASSIGNMENT()

MAXON_OPERATOR_MOVE_ASSIGNMENT ( MatrixNxM< TYPE >  )

◆ Resize()

Result<void> Resize ( Int  new_xcnt,
Int  new_ycnt 
)

Resizes the matrix to contain new_xcnt*new_ycnt elements. If new_xcnt or new_ycnt differ from the existing values the internal array is expanded.

Parameters
[in]new_xcntnew number of columns
[in]new_ycntnew number of rows

◆ CopyFrom()

Result<void> CopyFrom ( const MatrixNxM< TYPE > &  src)

Copy matrix elements from src matrix. The number of rows and columns are resized if necessary.

Parameters
[in]srcsource matrix

◆ operator()() [1/2]

TYPE& operator() ( Int  x,
Int  y 
)

Operator to access a matrix element.

Parameters
[in]xcolumn
[in]yrow
Returns
matrix element value

◆ operator()() [2/2]

const TYPE& operator() ( const Int  x,
const Int  y 
) const

Operator to access a matrix element.

Parameters
[in]xcolumn
[in]yrow
Returns
matrix element value

◆ GetXCount()

Int GetXCount ( ) const

Get number of columns.

Returns
number of columns

◆ GetYCount()

Int GetYCount ( ) const

Get number of rows.

Returns
number of rows

◆ ShiftMatrix()

Result<void> ShiftMatrix ( )

Reorganises the matrix so that the four quadrants

| A | B |

| C | D |

are then

| D | C |

| B | A |

This function is especially useful for dealing with FFT transformed data Note: If either number of rows or columns are not a multiple of 2 you get an error.

◆ ToString()

String ToString ( const FormatStatement formatStatement = nullptr) const

Returns a readable string of the content.

Parameters
[in]formatStatementNullptr or additional formatting instruction. See also Formatting Floating point values.
Returns
The converted result.

◆ MAXON_OPERATOR_EQUALITY_HASHCODE()

MAXON_OPERATOR_EQUALITY_HASHCODE ( MatrixNxM< TYPE >  ,
_xcnt  ,
_ycnt  ,
_arr   
)

Member Data Documentation

◆ _arr

BaseArray<TYPE> _arr
private

◆ _xcnt

Int _xcnt
private

◆ _ycnt

Int _ycnt
private