OpenWareLaboratory
|
This class contains useful methods for manipulating NxN dimensioned matrices of floats. More...
Public Member Functions | |
void | add (float scalar) |
Matrix-scalar sum. More... | |
void | add (FloatMatrix operand2) |
Element-wise sum between arrays. More... | |
void | add (FloatMatrix operand2, FloatMatrix destination) |
Element-wise sum between matrices. More... | |
void | clear () |
Clear the array. More... | |
void | copyFrom (FloatMatrix source) |
Copies the content of another matrix into this matrix. More... | |
void | copyTo (FloatMatrix destination) |
Copies the content of this matrix to another matrix. More... | |
FloatMatrix () | |
FloatMatrix (const float *data, size_t rows, size_t columns) | |
FloatMatrix (float *data, size_t rows, size_t columns) | |
size_t | getColumns () const |
float * | getData () |
Get the data stored in the FloatMatrix. More... | |
float | getElement (int row, int col) |
Get a single float stored in the FloatMatrix. More... | |
size_t | getRows () const |
size_t | getSize () const |
Get the number of elements in this matrix. More... | |
void | multiply (float scalar) |
Matrix scalar multiplication. More... | |
void | multiply (FloatMatrix operand2) |
Element-wise multiplication between arrays. More... | |
void | multiply (FloatMatrix operand2, FloatMatrix destination) |
Element-wise multiplication between arrays. More... | |
operator float * () | |
Casting operator to float*. More... | |
float * | operator[] (const int index) |
void | setAll (float value) |
Set all the values in the array. More... | |
void | setElement (int row, int col, float value) |
Set a single float in the FloatMatrix. More... | |
void | sigmoid () |
void | sigmoid (FloatMatrix destination) |
void | softmax () |
void | softmax (FloatMatrix destination) |
Static Public Member Functions | |
static FloatMatrix | create (size_t rows, size_t columns) |
Creates a new FloatMatrix. More... | |
static void | destroy (FloatMatrix array) |
Destroys a FloatMatrix created with the create() method. More... | |
This class contains useful methods for manipulating NxN dimensioned matrices of floats.
Definition at line 10 of file FloatMatrix.h.
FloatMatrix::FloatMatrix | ( | ) |
Definition at line 19 of file FloatMatrix.cpp.
FloatMatrix::FloatMatrix | ( | float * | data, |
size_t | rows, | ||
size_t | columns | ||
) |
Definition at line 21 of file FloatMatrix.cpp.
FloatMatrix::FloatMatrix | ( | const float * | data, |
size_t | rows, | ||
size_t | columns | ||
) |
Definition at line 23 of file FloatMatrix.cpp.
void FloatMatrix::add | ( | float | scalar | ) |
Matrix-scalar sum.
Adds scalar to the values in the array.
scalar | value to be added to the array |
Definition at line 47 of file FloatMatrix.cpp.
void FloatMatrix::add | ( | FloatMatrix | operand2 | ) |
Element-wise sum between arrays.
Adds each element of operand2 to the corresponding element in the array.
operand2 | second operand for the sum |
Definition at line 43 of file FloatMatrix.cpp.
References add().
void FloatMatrix::add | ( | FloatMatrix | operand2, |
FloatMatrix | destination | ||
) |
Element-wise sum between matrices.
[in] | operand2 | second operand for the sum |
[out] | destination | the destination array |
Definition at line 27 of file FloatMatrix.cpp.
References ASSERT, and getSize().
Referenced by add(), and InterpolatedCompositeTransform< matrix_order >::process().
|
inline |
Clear the array.
Set all the values in the array to 0.
Definition at line 49 of file FloatMatrix.h.
References setAll().
Referenced by create(), and AbstractMatrix< matrix_order >::resetMatrix().
void FloatMatrix::copyFrom | ( | FloatMatrix | source | ) |
Copies the content of another matrix into this matrix.
This matrix needs to be at least as big as the other matrix.
[in] | source | the source matrix |
Definition at line 133 of file FloatMatrix.cpp.
References ASSERT, getData(), and getSize().
Referenced by CompositeTransform< matrix_order >::computeMatrix(), InterpolatedCompositeTransform< matrix_order >::computeMatrix(), and InterpolatedCompositeTransform< matrix_order >::process().
void FloatMatrix::copyTo | ( | FloatMatrix | destination | ) |
Copies the content of this matrix to another matrix.
The other matrix needs to be at least as big as this matrix.
[out] | destination | the destination matrix |
Definition at line 128 of file FloatMatrix.cpp.
|
static |
Creates a new FloatMatrix.
Allocates rows*columns*sizeof(float) bytes of memory and returns a FloatMatrix that points to it.
rows | the number of rows of the new FloatMatrix. |
columns | the number of columns of the new FloatMatrix. |
Definition at line 138 of file FloatMatrix.cpp.
References clear().
Referenced by TransformationMatrix< matrix_order, Operation >::create(), CompositeTransform< matrix_order >::create(), and InterpolatedCompositeTransform< matrix_order >::create().
|
static |
Destroys a FloatMatrix created with the create() method.
array | the FloatMatrix to be destroyed. |
Definition at line 144 of file FloatMatrix.cpp.
Referenced by CompositeTransform< matrix_order >::destroy(), InterpolatedCompositeTransform< matrix_order >::destroy(), and TransformationMatrix< matrix_order, Operation >::destroy().
|
inline |
Definition at line 37 of file FloatMatrix.h.
Referenced by getElement(), getSize(), multiply(), operator[](), and setElement().
|
inline |
Get the data stored in the FloatMatrix.
Definition at line 135 of file FloatMatrix.h.
Referenced by add(), copyFrom(), copyTo(), getElement(), multiply(), operator float *(), operator[](), setAll(), setElement(), sigmoid(), and softmax().
|
inline |
Get a single float stored in the FloatMatrix.
Definition at line 147 of file FloatMatrix.h.
References getColumns(), and getData().
Referenced by multiply().
|
inline |
Definition at line 29 of file FloatMatrix.h.
Referenced by getSize(), and multiply().
|
inline |
Get the number of elements in this matrix.
Definition at line 25 of file FloatMatrix.h.
References getColumns(), and getRows().
Referenced by add(), copyFrom(), copyTo(), multiply(), setAll(), sigmoid(), and softmax().
void FloatMatrix::multiply | ( | float | scalar | ) |
Matrix scalar multiplication.
Multiplies each value in the matrix by scalar.
scalar | to be subtracted from the array |
Definition at line 86 of file FloatMatrix.cpp.
void FloatMatrix::multiply | ( | FloatMatrix | operand2 | ) |
Element-wise multiplication between arrays.
Multiplies each element in the array by the corresponding element in operand2.
operand2 | second operand for the sum |
Definition at line 82 of file FloatMatrix.cpp.
References multiply().
void FloatMatrix::multiply | ( | FloatMatrix | operand2, |
FloatMatrix | destination | ||
) |
Element-wise multiplication between arrays.
Sets each element in destination to the product of the corresponding element of the array and operand2 Multiplying an M x N matrix with an N x P matrix results in an M x P matrix.
[in] | operand2 | second operand for the product |
[out] | destination | the destination array |
Definition at line 54 of file FloatMatrix.cpp.
References ASSERT, getColumns(), getElement(), getRows(), and setElement().
Referenced by CompositeTransform< matrix_order >::computeMatrix(), InterpolatedCompositeTransform< matrix_order >::computeMatrix(), and multiply().
|
inline |
Casting operator to float*.
Definition at line 123 of file FloatMatrix.h.
References getData().
|
inline |
Definition at line 127 of file FloatMatrix.h.
References getColumns(), and getData().
void FloatMatrix::setAll | ( | float | value | ) |
Set all the values in the array.
Sets all the elements of the array to value.
[in] | value | all the elements are set to this value. |
Definition at line 93 of file FloatMatrix.cpp.
References getData(), and getSize().
Referenced by clear().
|
inline |
Set a single float in the FloatMatrix.
Definition at line 154 of file FloatMatrix.h.
References getColumns(), and getData().
Referenced by multiply().
|
inline |
Definition at line 166 of file FloatMatrix.h.
void FloatMatrix::sigmoid | ( | FloatMatrix | destination | ) |
Definition at line 119 of file FloatMatrix.cpp.
|
inline |
Definition at line 160 of file FloatMatrix.h.
void FloatMatrix::softmax | ( | FloatMatrix | destination | ) |
Definition at line 100 of file FloatMatrix.cpp.