ISSDK  1.8
IoT Sensing Software Development Kit
Macros | Functions
matrix.c File Reference

Matrix manipulation functions. More...

#include "stdio.h"
#include "math.h"
#include "stdlib.h"
#include "time.h"
#include "sensor_fusion.h"
#include "matrix.h"
Include dependency graph for matrix.c:

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...
 

Detailed Description

Matrix manipulation functions.

Contains functions for basic manipulation of 3x3 matrices

Definition in file matrix.c.

Macro Definition Documentation

◆ CORRUPTMATRIX

#define CORRUPTMATRIX   0.001F

Definition at line 24 of file matrix.c.

◆ NITERATIONS [1/2]

#define NITERATIONS   15

Referenced by fEigenCompute10(), and fEigenCompute4().

◆ NITERATIONS [2/2]

#define NITERATIONS   15

Function Documentation

◆ f3x3matrixAeqAxScalar()

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().

Here is the caller graph for this function:

◆ f3x3matrixAeqB()

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().

Here is the caller graph for this function:

◆ f3x3matrixAeqI()

void f3x3matrixAeqI ( float  A[][3])

◆ f3x3matrixAeqInvSymB()

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().

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

◆ f3x3matrixAeqMinusA()

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().

Here is the caller graph for this function:

◆ f3x3matrixAeqScalar()

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().

Here is the caller graph for this function:

◆ f3x3matrixDetA()

float f3x3matrixDetA ( float  A[][3])

function calculates the determinant of a 3x3 matrix

Definition at line 191 of file matrix.c.

References CHX, CHY, and CHZ.

Referenced by fComputeAccelCalibration10(), fComputeMagCalibration10(), and fUpdateMagCalibration10Slice().

Here is the caller graph for this function:

◆ fComputeEigSlice()

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().

Here is the caller graph for this function:

◆ fEigenCompute10()

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]

Parameters
Areal symmetric matrix A[0..n-1][0..n-1]
eigvaleigval[0..n-1] returns the eigenvalues of A[][].
eigveceigvec[0..n-1][0..n-1] returns the normalized eigenvectors of A[][]
nn 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().

Here is the caller graph for this function:

◆ fEigenCompute4()

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.

Parameters
eigvaleigval[0..n-1] returns the eigenvalues of A[][].
eigveceigvec[0..n-1][0..n-1] returns the normalized eigenvectors of A[][]
nn 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.

◆ fmatrixAeqI()

void fmatrixAeqI ( float *  A[],
int16  rc 
)

function sets the matrix A to the identity matrix

Parameters
Apointer to the matrix
rcdimension of the matrix

Definition at line 69 of file matrix.c.

Referenced by fmatrixAeqInvA().

Here is the caller graph for this function:

◆ 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().

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

◆ fVeq3x3AxV()

void fVeq3x3AxV ( float  V[3],
float  A[][3] 
)

function multiplies the 3x1 vector V by a 3x3 matrix A

Parameters
Vused for both input and output

Definition at line 853 of file matrix.c.

References CHX, CHY, and CHZ.

Referenced by fRunAccelCalibration().

Here is the caller graph for this function:

◆ fveqRu()

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

Parameters
fv3x1 output vector
fRrotation matrix
fu3x1 input vector
itransposetrue if inverse direction desired

Definition at line 802 of file matrix.c.

References CHX, CHY, and CHZ.

Referenced by fRun_6DOF_GY_KALMAN().

Here is the caller graph for this function: