10 instance.pData = NULL;
13 arm_mat_init_f32(&instance, rs, cs, dt);
16 arm_mat_init_f32(&instance, rs, cs, (
float*)dt);
20 : data(NULL), rows(0), columns(0) {}
22 : data(dt), rows(rs), columns(cs) {}
24 : data((float*)dt), rows(rs), columns(cs) {}
29 arm_mat_add_f32(&instance, &operand2.instance, &destination.instance);
38 for(
size_t i=0; i<
getSize(); i++)
39 destination.data[i] = data[i] + operand2.data[i];;
50 for(
size_t i=0; i<size; i++)
56 arm_mat_mult_f32(&instance, &operand2.instance, &destination.instance);
59 ASSERT(destination.rows >= rows,
"Insufficient rows in destination");
60 ASSERT(destination.columns >= operand2.columns,
"Insufficient columns in destination");
71 for(
size_t i=0; i<
getRows(); i++){
74 for(
size_t k=0; k<operand2.
getRows(); k++){
89 for(
size_t i=0; i<size; i++)
96 for(
size_t i=0; i<size; i++)
103 float* dest = destination.
getData();
106 for(
size_t i = 0; i < size; i++) {
111 for(
size_t i = 0; i < size; i++)
112 sum += expf(src[i] - m);
113 float offset = m + logf(sum);
114 for(
size_t i = 0; i < size; i++)
115 dest[i] = expf(src[i] - offset);
122 float* dest = destination.
getData();
124 for(
size_t i = 0; i < size; i++)
125 dest[i] = 1.0f / (1 + expf(-src[i]));
146 delete[] array.instance.pData;
This class contains useful methods for manipulating NxN dimensioned matrices of floats.
static FloatMatrix create(size_t rows, size_t columns)
Creates a new FloatMatrix.
float getElement(int row, int col)
Get a single float stored in the FloatMatrix.
void clear()
Clear the array.
size_t getColumns() const
static void destroy(FloatMatrix array)
Destroys a FloatMatrix created with the create() method.
void multiply(FloatMatrix operand2, FloatMatrix destination)
Element-wise multiplication between arrays.
void setAll(float value)
Set all the values in the array.
size_t getSize() const
Get the number of elements in this matrix.
void add(FloatMatrix operand2, FloatMatrix destination)
Element-wise sum between matrices.
void copyFrom(FloatMatrix source)
Copies the content of another matrix into this matrix.
void setElement(int row, int col, float value)
Set a single float in the FloatMatrix.
void copyTo(FloatMatrix destination)
Copies the content of this matrix to another matrix.
float * getData()
Get the data stored in the FloatMatrix.
#define ASSERT(cond, msg)