- Main Page
- Related Pages
- Classes
- Files

# work/git/mixpp/pmsm/simulator_zdenek/ekf_example/matrix.h

    00001 /************************************
    00002         Extended Kalman Filter
    00003         Matrix operations
    00004
    00005         Z. Peroutka
    00006
    00007 Rev. 15.3.2008
    00008
    00009 15.3. 2008      Kompletni kontrola vypoctu + zamena q15->int a q30->long
    00010
    00011 *************************************/
    00012
    00013 /* Vsechny meze se udavaji ve tvaru (rozmer_matice - 1), abych mel ve FOR konstantni horni mez) */
    00014
    00015 /* Matrix addition in q15: m1 + m2 = result[rows, columns] */
    00016 extern void madd(int *m1, int *m2, int *result, unsigned int rows, unsigned int columns);
    00017
    00018 /* add diagonal matrix m2 to matrix m1 - both in format q15, minrowcol = min(rows, columns) */
    00019 extern void maddD(int *m1, int *m2, unsigned int minrowcol, unsigned int columns);
    00020
    00021 /* Matrix substraction in q15: m1 - m2 = result[rows, columns] */
    00022 extern void msub(int *m1, int *m2, int *result, unsigned int rows, unsigned int columns);
    00023
    00024 /* Matrix multiply in q15: m1[rows,columnsx]*m2[columnsx,columns] = result[rows,columns] */
    00025 extern void mmult(int *m1, int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00026 columns);
    00027
    00028 /* Matrix multiplication in q15: m1[rows,columnsx]*(m2[columnsx,columns]transpose) = result[rows,columns] */
    00029 extern void mmultt(int *m1, int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00030 columns);
    00031
    00032 /* matrix multiplication in q15: sum is in q15 */
    00033 extern void mmult15(int *m1, int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00034 columns);
    00035
    00036 /* Matrix multiplication in q15 (sum is in q15): m1[rows,columnsx]*(m2[columns,columnsx]transpose) = result[rows,columns] */
    00037 extern void mmultt15(int *m1, int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00038 columns);
    00039
    00040 /* Matrix multiplication - Q15 * Q30 format -> RESULT in Q15 */
    00041 extern void mmult1530(int *m1, long *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00042 columns);
    00043
    00044 /* Left matrix multiplication with DIAG ones matrix in q15: DIAG[rows,columnsx]*m2[columnsx,columns] = result[rows,columns]
    00045 minrowcol=minimum(rows, columnsx) */
    00046 extern void mmultDl(int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00047 columns, unsigned int minrowcol);
    00048
    00049 /* Left matrix multiplication with DIAG matrix in q15: DIAG[rows,columnsx]*m2[columnsx,columns] = result[rows,columns]
    00050 minrowcol=minimum(rows, columnsx) */
    00051 extern void mmultDl15(int *DIAG, int *m2, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00052 columns, unsigned int minrowcol);
    00053
    00054 /* Right matrix multiplication with DIAG ones matrix in q15: m1[rows,columnsx]*DIAG[columnsx,columns] = result[rows,columns]
    00055 minrowcol=minimum(columnsx,columns) */
    00056 extern void mmultDr(int *m1, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00057 columns, unsigned int minrowcol);
    00058
    00059 /* Right matrix multiplication with DIAG matrix in q15: m1[rows,columnsx]*DIAG[columnsx,columns] = result[rows,columns]
    00060 minrowcol=minimum(columnsx,columns) */
    00061 extern void mmultDr15(int *m1, int *DIAG, int *result, unsigned int rows, unsigned int columnsx, unsigned int
    00062 columns, unsigned int minrowcol);
    00063
    00064 /* Matrix transposition in q15: m1.' = result[rows, columns] */
    00065 extern void mtrans(int *m1, int *result, unsigned int rows, unsigned int columns);
    00066
    00067 /* Matrix [2,2] inversion in q15: inv(m1) = result[rows, columns] */
    00068 extern void minv2(int *matrix, long *result);
    00069
    00070 extern void choice_P(int *m, int *result, unsigned int columns);
    00071 extern void choice_x(int *m, int *result);
    00072