![]() |
ISSDK
1.8
IoT Sensing Software Development Kit
|
Matrix manipulation functions. More...
#include "stdio.h"#include "math.h"#include "stdlib.h"#include "time.h"#include "sensor_fusion.h"#include "matrix.h"
Go to the source code of this file.
Macros | |
| #define | CORRUPTMATRIX 0.001F |
| #define | NITERATIONS 15 |
| #define | NITERATIONS 15 |
Functions | |
| void | f3x3matrixAeqI (float A[][3]) |
| function sets the 3x3 matrix A to the identity matrix More... | |
| void | f3x3matrixAeqB (float A[][3], float B[][3]) |
| function sets 3x3 matrix A to 3x3 matrix B More... | |
| void | fmatrixAeqI (float *A[], int16 rc) |
| function sets the matrix A to the identity matrix More... | |
| void | f3x3matrixAeqScalar (float A[][3], float Scalar) |
| function sets every entry in the 3x3 matrix A to a constant scalar More... | |
| void | f3x3matrixAeqAxScalar (float A[][3], float Scalar) |
| function multiplies all elements of 3x3 matrix A by the specified scalar More... | |
| void | f3x3matrixAeqMinusA (float A[][3]) |
| function negates all elements of 3x3 matrix A More... | |
| void | f3x3matrixAeqInvSymB (float A[][3], float B[][3]) |
| float | f3x3matrixDetA (float A[][3]) |
| function calculates the determinant of a 3x3 matrix More... | |
| void | fEigenCompute10 (float A[][10], float eigval[], float eigvec[][10], int8 n) |
| void | fEigenCompute4 (float A[][4], float eigval[], float eigvec[][4], int8 n) |
| void | fComputeEigSlice (float fmatA[10][10], float fmatB[10][10], float fvecA[10], int8 i, int8 j, int8 iMatrixSize) |
| void | fmatrixAeqInvA (float *A[], int8 iColInd[], int8 iRowInd[], int8 iPivot[], int8 isize, int8 *pierror) |
| void | fveqRu (float fv[], float fR[][3], float fu[], int8 itranspose) |
| void | fVeq3x3AxV (float V[3], float A[][3]) |
| function multiplies the 3x1 vector V by a 3x3 matrix A More... | |
Matrix manipulation functions.
Contains functions for basic manipulation of 3x3 matrices
Definition in file matrix.c.
| #define NITERATIONS 15 |
Referenced by fEigenCompute10(), and fEigenCompute4().
| #define NITERATIONS 15 |
| void f3x3matrixAeqAxScalar | ( | float | A[][3], |
| float | Scalar | ||
| ) |
function multiplies all elements of 3x3 matrix A by the specified scalar
Definition at line 110 of file matrix.c.
Referenced by fComputeMagCalibration10(), fComputeMagCalibration7(), and fUpdateMagCalibration10Slice().

| void f3x3matrixAeqB | ( | float | A[][3], |
| float | B[][3] | ||
| ) |
function sets 3x3 matrix A to 3x3 matrix B
Definition at line 48 of file matrix.c.
Referenced by fRun_6DOF_GY_KALMAN().

| void f3x3matrixAeqI | ( | float | A[][3] | ) |
function sets the 3x3 matrix A to the identity matrix
Definition at line 27 of file matrix.c.
Referenced by f3DOFMagnetometerMatrixAndroid(), f3DOFMagnetometerMatrixNED(), f3x3matrixAeqInvSymB(), fComputeMagCalibration4(), fComputeMagCalibration7(), feCompassAndroid(), feCompassNED(), feCompassWin8(), fInit_3DOF_Y_BASIC(), fInitializeAccelCalibration(), fInitializeMagCalibration(), and fUpdateMagCalibration4Slice().

| void f3x3matrixAeqInvSymB | ( | float | A[][3], |
| float | B[][3] | ||
| ) |
function directly calculates the symmetric inverse of a symmetric 3x3 matrix only the on and above diagonal terms in B are used and need to be specified
Definition at line 150 of file matrix.c.
References f3x3matrixAeqI().
Referenced by fComputeAccelCalibration10(), fComputeMagCalibration10(), and fUpdateMagCalibration10Slice().


| void f3x3matrixAeqMinusA | ( | float | A[][3] | ) |
function negates all elements of 3x3 matrix A
Definition at line 129 of file matrix.c.
Referenced by fComputeAccelCalibration10(), fComputeMagCalibration10(), fComputeMagCalibration7(), and fUpdateMagCalibration10Slice().

| void f3x3matrixAeqScalar | ( | float | A[][3], |
| float | Scalar | ||
| ) |
function sets every entry in the 3x3 matrix A to a constant scalar
Definition at line 91 of file matrix.c.
Referenced by fComputeAccelCalibration7(), and fComputeMagCalibration7().

| float f3x3matrixDetA | ( | float | A[][3] | ) |
function calculates the determinant of a 3x3 matrix
Definition at line 191 of file matrix.c.
Referenced by fComputeAccelCalibration10(), fComputeMagCalibration10(), and fUpdateMagCalibration10Slice().

| void fComputeEigSlice | ( | float | fmatA[10][10], |
| float | fmatB[10][10], | ||
| float | fvecA[10], | ||
| int8 | i, | ||
| int8 | j, | ||
| int8 | iMatrixSize | ||
| ) |
Definition at line 554 of file matrix.c.
Referenced by fUpdateMagCalibration10Slice(), and fUpdateMagCalibration7Slice().

| void fEigenCompute10 | ( | float | A[][10], |
| float | eigval[], | ||
| float | eigvec[][10], | ||
| int8 | n | ||
| ) |
function computes all eigenvalues and eigenvectors of a real symmetric matrix A[0..n-1][0..n-1] stored in the top left of a 10x10 array A[10][10]
| A | real symmetric matrix A[0..n-1][0..n-1] |
| eigval | eigval[0..n-1] returns the eigenvalues of A[][]. |
| eigvec | eigvec[0..n-1][0..n-1] returns the normalized eigenvectors of A[][] |
| n | n can vary up to and including 10 but the matrices A and eigvec must have 10 columns. |
Definition at line 216 of file matrix.c.
References NITERATIONS.
Referenced by fComputeAccelCalibration10(), fComputeAccelCalibration7(), fComputeMagCalibration10(), and fComputeMagCalibration7().

| void fEigenCompute4 | ( | float | A[][4], |
| float | eigval[], | ||
| float | eigvec[][4], | ||
| int8 | n | ||
| ) |
function computes all eigenvalues and eigenvectors of a real symmetric matrix A[0..n-1][0..n-1] stored in the top left of a 4x4 array A[4][4] A[][] is changed on output. The eigenvectors are not sorted by value. This function is identical to eigencompute10 except for the workaround for 4x4 matrices since C cannot handle functions accepting matrices with variable numbers of columns.
| eigval | eigval[0..n-1] returns the eigenvalues of A[][]. |
| eigvec | eigvec[0..n-1][0..n-1] returns the normalized eigenvectors of A[][] |
| n | n can vary up to and including 4 but the matrices A and eigvec must have 4 columns. |
Definition at line 389 of file matrix.c.
References NITERATIONS.
| void fmatrixAeqI | ( | float * | A[], |
| int16 | rc | ||
| ) |
function sets the matrix A to the identity matrix
| A | pointer to the matrix |
| rc | dimension of the matrix |
Definition at line 69 of file matrix.c.
Referenced by fmatrixAeqInvA().

| void fmatrixAeqInvA | ( | float * | A[], |
| int8 | iColInd[], | ||
| int8 | iRowInd[], | ||
| int8 | iPivot[], | ||
| int8 | isize, | ||
| int8 * | pierror | ||
| ) |
function uses Gauss-Jordan elimination to compute the inverse of matrix A in situ on exit, A is replaced with its inverse
Definition at line 648 of file matrix.c.
References fmatrixAeqI().
Referenced by fComputeAccelCalibration4(), fComputeMagCalibration4(), fRun_6DOF_GY_KALMAN(), and fUpdateMagCalibration4Slice().


| void fVeq3x3AxV | ( | float | V[3], |
| float | A[][3] | ||
| ) |
| void fveqRu | ( | float | fv[], |
| float | fR[][3], | ||
| float | fu[], | ||
| int8 | itranspose | ||
| ) |
function rotates 3x1 vector u onto 3x1 vector using 3x3 rotation matrix fR. the rotation is applied in the inverse direction if itranpose is true
| fv | 3x1 output vector |
| fR | rotation matrix |
| fu | 3x1 input vector |
| itranspose | true if inverse direction desired |
Definition at line 802 of file matrix.c.
Referenced by fRun_6DOF_GY_KALMAN().
