OpenShot Library | OpenShotAudio 0.2.2
|
General matrix and vectors class, meant for classic math manipulation such as additions, multiplications, and linear systems of equations solving. More...
#include <juce_Matrix.h>
Public Member Functions | |
Matrix (size_t numRows, size_t numColumns) | |
Creates a new matrix with a given number of rows and columns. More... | |
Matrix (size_t numRows, size_t numColumns, const ElementType *dataPointer) | |
Creates a new matrix with a given number of rows and columns, with initial data coming from an array, stored in row-major order. More... | |
Matrix (const Matrix &)=default | |
Creates a copy of another matrix. | |
Matrix (Matrix &&) noexcept=default | |
Moves a copy of another matrix. | |
Matrix & | operator= (const Matrix &)=default |
Creates a copy of another matrix. | |
Matrix & | operator= (Matrix &&) noexcept=default |
Moves another matrix into this one. | |
size_t | getNumRows () const noexcept |
Returns the number of rows in the matrix. More... | |
size_t | getNumColumns () const noexcept |
Returns the number of columns in the matrix. More... | |
Array< size_t > | getSize () const noexcept |
Returns an Array of 2 integers with the number of rows and columns in the matrix. More... | |
void | clear () noexcept |
Fills the contents of the matrix with zeroes. More... | |
Matrix & | swapRows (size_t rowOne, size_t rowTwo) noexcept |
Swaps the contents of two rows in the matrix and returns a reference to itself. More... | |
Matrix & | swapColumns (size_t columnOne, size_t columnTwo) noexcept |
Swaps the contents of two columns in the matrix and returns a reference to itself. More... | |
ElementType | operator() (size_t row, size_t column) const noexcept |
Returns the value of the matrix at a given row and column (for reading). More... | |
ElementType & | operator() (size_t row, size_t column) noexcept |
Returns the value of the matrix at a given row and column (for modifying). More... | |
ElementType * | getRawDataPointer () noexcept |
Returns a pointer to the raw data of the matrix object, ordered in row-major order (for modifying). More... | |
const ElementType * | getRawDataPointer () const noexcept |
Returns a pointer to the raw data of the matrix object, ordered in row-major order (for reading). More... | |
Matrix & | operator+= (const Matrix &other) noexcept |
Addition of two matrices. More... | |
Matrix & | operator-= (const Matrix &other) noexcept |
Subtraction of two matrices. More... | |
Matrix & | operator*= (ElementType scalar) noexcept |
Scalar multiplication. More... | |
Matrix | operator+ (const Matrix &other) const |
Addition of two matrices. More... | |
Matrix | operator- (const Matrix &other) const |
Addition of two matrices. More... | |
Matrix | operator* (ElementType scalar) const |
Scalar multiplication. More... | |
Matrix | operator* (const Matrix &other) const |
Matrix multiplication. More... | |
Matrix & | hadarmard (const Matrix &other) noexcept |
Does a hadarmard product with the receiver and other and stores the result in the receiver. More... | |
bool | operator== (const Matrix &other) const noexcept |
bool | isSquare () const noexcept |
Tells if the matrix is a square matrix. More... | |
bool | isVector () const noexcept |
Tells if the matrix is a vector. More... | |
bool | isOneColumnVector () const noexcept |
Tells if the matrix is a one column vector. More... | |
bool | isOneRowVector () const noexcept |
Tells if the matrix is a one row vector. More... | |
bool | isNullMatrix () const noexcept |
Tells if the matrix is a null matrix. More... | |
bool | solve (Matrix &b) const noexcept |
Solves a linear system of equations represented by this object and the argument b, using various algorithms depending on the size of the arguments. More... | |
String | toString () const |
Returns a String displaying in a convenient way the matrix contents. More... | |
ElementType * | begin () noexcept |
ElementType * | end () noexcept |
const ElementType * | begin () const noexcept |
const ElementType * | end () const noexcept |
Static Public Member Functions | |
static Matrix | identity (size_t size) |
Creates the identity matrix. More... | |
static Matrix | toeplitz (const Matrix &vector, size_t size) |
Creates a Toeplitz Matrix from a vector with a given squared size. More... | |
static Matrix | hankel (const Matrix &vector, size_t size, size_t offset=0) |
Creates a squared size x size Hankel Matrix from a vector with an optional offset. More... | |
static Matrix | hadarmard (const Matrix &a, const Matrix &b) |
Does a hadarmard product with a and b returns the result. More... | |
static bool | compare (const Matrix &a, const Matrix &b, ElementType tolerance=0) noexcept |
Compare to matrices with a given tolerance. More... | |
General matrix and vectors class, meant for classic math manipulation such as additions, multiplications, and linear systems of equations solving.
Definition at line 45 of file juce_Matrix.h.
|
inline |
Creates a new matrix with a given number of rows and columns.
Definition at line 50 of file juce_Matrix.h.
References juce::dsp::Matrix< ElementType >::clear().
|
inline |
Creates a new matrix with a given number of rows and columns, with initial data coming from an array, stored in row-major order.
Definition at line 60 of file juce_Matrix.h.
|
static |
Creates the identity matrix.
Definition at line 33 of file juce_Matrix.cpp.
Referenced by juce::dsp::FilterDesign< FloatType >::designFIRLowpassLeastSquaresMethod().
|
static |
Creates a Toeplitz Matrix from a vector with a given squared size.
Definition at line 44 of file juce_Matrix.cpp.
References juce::dsp::Matrix< ElementType >::isOneColumnVector().
Referenced by juce::dsp::FilterDesign< FloatType >::designFIRLowpassLeastSquaresMethod().
|
static |
Creates a squared size x size Hankel Matrix from a vector with an optional offset.
vector | The vector from which the Hankel matrix should be generated. Its number of rows should be at least 2 * (size - 1) + 1 |
size | The size of resulting square matrix. |
offset | An optional offset into the given vector. |
Definition at line 62 of file juce_Matrix.cpp.
References juce::dsp::Matrix< ElementType >::isOneColumnVector().
Referenced by juce::dsp::FilterDesign< FloatType >::designFIRLowpassLeastSquaresMethod().
|
inlinenoexcept |
Returns the number of rows in the matrix.
Definition at line 97 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::operator*().
|
inlinenoexcept |
Returns the number of columns in the matrix.
Definition at line 100 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::operator*().
|
inlinenoexcept |
Returns an Array of 2 integers with the number of rows and columns in the matrix.
Definition at line 105 of file juce_Matrix.h.
|
inlinenoexcept |
Fills the contents of the matrix with zeroes.
Definition at line 108 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::Matrix().
|
noexcept |
Swaps the contents of two rows in the matrix and returns a reference to itself.
Definition at line 97 of file juce_Matrix.cpp.
|
noexcept |
Swaps the contents of two columns in the matrix and returns a reference to itself.
Definition at line 81 of file juce_Matrix.cpp.
|
inlinenoexcept |
Returns the value of the matrix at a given row and column (for reading).
Definition at line 119 of file juce_Matrix.h.
References juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference().
|
inlinenoexcept |
Returns the value of the matrix at a given row and column (for modifying).
Definition at line 126 of file juce_Matrix.h.
References juce::Array< ElementType, TypeOfCriticalSectionToUse, minimumAllocatedSize >::getReference().
|
inlinenoexcept |
Returns a pointer to the raw data of the matrix object, ordered in row-major order (for modifying).
Definition at line 135 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::operator*().
|
inlinenoexcept |
Returns a pointer to the raw data of the matrix object, ordered in row-major order (for reading).
Definition at line 140 of file juce_Matrix.h.
|
inlinenoexcept |
Addition of two matrices.
Definition at line 144 of file juce_Matrix.h.
|
inlinenoexcept |
Subtraction of two matrices.
Definition at line 147 of file juce_Matrix.h.
|
inlinenoexcept |
Scalar multiplication.
Definition at line 150 of file juce_Matrix.h.
|
inline |
Addition of two matrices.
Definition at line 157 of file juce_Matrix.h.
|
inline |
Addition of two matrices.
Definition at line 160 of file juce_Matrix.h.
|
inline |
Scalar multiplication.
Definition at line 163 of file juce_Matrix.h.
Matrix< ElementType > juce::dsp::Matrix< ElementType >::operator* | ( | const Matrix< ElementType > & | other | ) | const |
Matrix multiplication.
Definition at line 114 of file juce_Matrix.cpp.
References juce::dsp::Matrix< ElementType >::getNumColumns(), juce::dsp::Matrix< ElementType >::getNumRows(), and juce::dsp::Matrix< ElementType >::getRawDataPointer().
|
inlinenoexcept |
Does a hadarmard product with the receiver and other and stores the result in the receiver.
Definition at line 169 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::hadarmard().
|
inlinestatic |
Does a hadarmard product with a and b returns the result.
Definition at line 172 of file juce_Matrix.h.
References juce::dsp::Matrix< ElementType >::hadarmard().
|
staticnoexcept |
Compare to matrices with a given tolerance.
Definition at line 149 of file juce_Matrix.cpp.
|
inlinenoexcept |
Definition at line 179 of file juce_Matrix.h.
|
inlinenoexcept |
Tells if the matrix is a square matrix.
Definition at line 183 of file juce_Matrix.h.
|
inlinenoexcept |
Tells if the matrix is a vector.
Definition at line 186 of file juce_Matrix.h.
References juce::dsp::Matrix< ElementType >::isOneColumnVector(), and juce::dsp::Matrix< ElementType >::isOneRowVector().
|
inlinenoexcept |
Tells if the matrix is a one column vector.
Definition at line 189 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::hankel(), juce::dsp::Matrix< ElementType >::isVector(), and juce::dsp::Matrix< ElementType >::toeplitz().
|
inlinenoexcept |
Tells if the matrix is a one row vector.
Definition at line 192 of file juce_Matrix.h.
Referenced by juce::dsp::Matrix< ElementType >::isVector().
|
inlinenoexcept |
Tells if the matrix is a null matrix.
Definition at line 195 of file juce_Matrix.h.
|
noexcept |
Solves a linear system of equations represented by this object and the argument b, using various algorithms depending on the size of the arguments.
The matrix must be a square matrix N times N, and b must be a vector N times 1, with the coefficients of b. After the execution of the algorithm, the vector b will contain the solution.
Returns true if the linear system of equations was successfully solved.
Definition at line 166 of file juce_Matrix.cpp.
String juce::dsp::Matrix< ElementType >::toString |
Returns a String displaying in a convenient way the matrix contents.
Definition at line 279 of file juce_Matrix.cpp.
References juce::StringArray::add(), juce::StringArray::begin(), juce::String::length(), juce::StringArray::size(), and juce::MemoryOutputStream::toString().
|
inlinenoexcept |
Definition at line 214 of file juce_Matrix.h.
|
inlinenoexcept |
Definition at line 215 of file juce_Matrix.h.
|
inlinenoexcept |
Definition at line 217 of file juce_Matrix.h.
|
inlinenoexcept |
Definition at line 218 of file juce_Matrix.h.