Audacity 3.2.0
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Matrix Class Reference

Holds a matrix of doubles and supports arithmetic, subsetting, and matrix inversion. Used by InterpolateAudio. More...

#include <Matrix.h>

Collaboration diagram for Matrix:
[legend]

Public Member Functions

 Matrix (const Matrix &copyFrom)
 
 Matrix (unsigned rows, unsigned cols, double **data=NULL)
 
 ~Matrix ()
 
Matrixoperator= (const Matrix &other)
 
Vectoroperator[] (unsigned i)
 
Vectoroperator[] (unsigned i) const
 
unsigned Rows () const
 
unsigned Cols () const
 
void SwapRows (unsigned i, unsigned j)
 

Private Member Functions

void CopyFrom (const Matrix &other)
 

Private Attributes

unsigned mRows
 
unsigned mCols
 
ArrayOf< VectormRowVec
 

Detailed Description

Holds a matrix of doubles and supports arithmetic, subsetting, and matrix inversion. Used by InterpolateAudio.

Definition at line 57 of file Matrix.h.

Constructor & Destructor Documentation

◆ Matrix() [1/2]

Matrix::Matrix ( const Matrix copyFrom)

Definition at line 102 of file Matrix.cpp.

103{
104 CopyFrom(other);
105}
void CopyFrom(const Matrix &other)
Definition: Matrix.cpp:107

References CopyFrom().

Here is the call graph for this function:

◆ Matrix() [2/2]

Matrix::Matrix ( unsigned  rows,
unsigned  cols,
double **  data = NULL 
)

Definition at line 80 of file Matrix.cpp.

81 : mRows{ rows }
82 , mCols{ cols }
83 , mRowVec{ mRows }
84{
85 for(unsigned i = 0; i < mRows; i++) {
86 mRowVec[i].Reinit( mCols );
87 for(unsigned j = 0; j < mCols; j++) {
88 if (data)
89 (*this)[i][j] = data[i][j];
90 else
91 (*this)[i][j] = 0.0;
92 }
93 }
94}
ArrayOf< Vector > mRowVec
Definition: Matrix.h:78
unsigned mRows
Definition: Matrix.h:76
unsigned mCols
Definition: Matrix.h:77

References mCols, mRows, and mRowVec.

◆ ~Matrix()

Matrix::~Matrix ( )

Definition at line 118 of file Matrix.cpp.

119{
120}

Member Function Documentation

◆ Cols()

unsigned Matrix::Cols ( ) const
inline

Definition at line 69 of file Matrix.h.

69{ return mCols; }

References mCols.

Referenced by InterpolateAudio(), InvertMatrix(), MatrixConcatenateCols(), MatrixMultiply(), operator*(), operator+(), ScalarMultiply(), and TransposeMatrix().

Here is the caller graph for this function:

◆ CopyFrom()

void Matrix::CopyFrom ( const Matrix other)
private

Definition at line 107 of file Matrix.cpp.

108{
109 mRows = other.mRows;
110 mCols = other.mCols;
112 for (unsigned i = 0; i < mRows; i++) {
113 mRowVec[i].Reinit( mCols );
114 mRowVec[i] = other.mRowVec[i];
115 }
116}
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:58

References mCols, mRows, mRowVec, and ArrayOf< X >::reinit().

Referenced by Matrix(), and operator=().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

Matrix & Matrix::operator= ( const Matrix other)

Definition at line 96 of file Matrix.cpp.

97{
98 CopyFrom(other);
99 return *this;
100}

References CopyFrom().

Here is the call graph for this function:

◆ operator[]() [1/2]

Vector & Matrix::operator[] ( unsigned  i)
inline

Definition at line 66 of file Matrix.h.

66{ return mRowVec[i]; }

References mRowVec.

◆ operator[]() [2/2]

Vector & Matrix::operator[] ( unsigned  i) const
inline

Definition at line 67 of file Matrix.h.

67{ return mRowVec[i]; }

References mRowVec.

◆ Rows()

unsigned Matrix::Rows ( ) const
inline

Definition at line 68 of file Matrix.h.

68{ return mRows; }

References mRows.

Referenced by InterpolateAudio(), InvertMatrix(), MatrixConcatenateCols(), MatrixMultiply(), operator*(), operator+(), ScalarMultiply(), and TransposeMatrix().

Here is the caller graph for this function:

◆ SwapRows()

void Matrix::SwapRows ( unsigned  i,
unsigned  j 
)

Definition at line 122 of file Matrix.cpp.

123{
124 mRowVec[i].Swap(mRowVec[j]);
125}

References mRowVec.

Referenced by InvertMatrix().

Here is the caller graph for this function:

Member Data Documentation

◆ mCols

unsigned Matrix::mCols
private

Definition at line 77 of file Matrix.h.

Referenced by Cols(), CopyFrom(), and Matrix().

◆ mRows

unsigned Matrix::mRows
private

Definition at line 76 of file Matrix.h.

Referenced by CopyFrom(), Matrix(), and Rows().

◆ mRowVec

ArrayOf<Vector> Matrix::mRowVec
private

Definition at line 78 of file Matrix.h.

Referenced by CopyFrom(), Matrix(), operator[](), and SwapRows().


The documentation for this class was generated from the following files: