| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bmth_fix_matrix.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 8/26/10 7:48p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/mth/bmth_fix_matrix.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/1 8/26/10 7:48p albertl |
|---|
| 21 | * SW7405-4556, SW7405-4515: Initial revision. |
|---|
| 22 | * |
|---|
| 23 | ***************************************************************************/ |
|---|
| 24 | #ifndef BMTH_FIX_MATRIX_H__ |
|---|
| 25 | #define BMTH_FIX_MATRIX_H__ |
|---|
| 26 | |
|---|
| 27 | #ifdef __cplusplus |
|---|
| 28 | extern "C" { |
|---|
| 29 | #endif |
|---|
| 30 | |
|---|
| 31 | #include "bstd.h" |
|---|
| 32 | #include "bmth_fix.h" |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | /*************************************************************************** |
|---|
| 36 | Structures: |
|---|
| 37 | ***************************************************************************/ |
|---|
| 38 | typedef struct BMTH_FIX_Matrix |
|---|
| 39 | { |
|---|
| 40 | uint32_t data[4][4]; |
|---|
| 41 | uint32_t ulSize; |
|---|
| 42 | uint32_t ulFractBits; |
|---|
| 43 | } BMTH_FIX_Matrix; |
|---|
| 44 | |
|---|
| 45 | typedef struct BMTH_FIX_Vector |
|---|
| 46 | { |
|---|
| 47 | uint32_t data[4]; |
|---|
| 48 | uint32_t ulSize; |
|---|
| 49 | uint32_t ulFractBits; |
|---|
| 50 | } BMTH_FIX_Vector; |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | /*************************************************************************** |
|---|
| 54 | Summary: |
|---|
| 55 | Takes two matrices and multiplies them together. Result is a matrix |
|---|
| 56 | with the same size and fixed point fractional bits. Currently only |
|---|
| 57 | supports matrices of same size. |
|---|
| 58 | ***************************************************************************/ |
|---|
| 59 | void BMTH_FIX_Matrix_Mult |
|---|
| 60 | ( BMTH_FIX_Matrix *pMatrix1, |
|---|
| 61 | BMTH_FIX_Matrix *pMatrix2, |
|---|
| 62 | BMTH_FIX_Matrix *pRetMatrix); |
|---|
| 63 | |
|---|
| 64 | /*************************************************************************** |
|---|
| 65 | Summary: |
|---|
| 66 | Multiplies a Matrix with a Vector. Result is a vector with the same |
|---|
| 67 | size as the original vector and same fixed point fractional bits. |
|---|
| 68 | ***************************************************************************/ |
|---|
| 69 | void BMTH_FIX_Matrix_MultVector |
|---|
| 70 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 71 | BMTH_FIX_Vector *pVector, |
|---|
| 72 | BMTH_FIX_Vector *pRetVector); |
|---|
| 73 | |
|---|
| 74 | /*************************************************************************** |
|---|
| 75 | Summary: |
|---|
| 76 | Takes a 3x3 matrix and converts it to a 4x4 matrix. |
|---|
| 77 | ***************************************************************************/ |
|---|
| 78 | void BMTH_FIX_Matrix_Make4x4 |
|---|
| 79 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 80 | BMTH_FIX_Matrix *pRetMatrix); |
|---|
| 81 | |
|---|
| 82 | /*************************************************************************** |
|---|
| 83 | Summary: |
|---|
| 84 | Transposes a matrix. |
|---|
| 85 | ***************************************************************************/ |
|---|
| 86 | void BMTH_FIX_Matrix_Transpose |
|---|
| 87 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 88 | BMTH_FIX_Matrix *pRetMatrix); |
|---|
| 89 | |
|---|
| 90 | /*************************************************************************** |
|---|
| 91 | Summary: |
|---|
| 92 | Calculates the inverse matrix. |
|---|
| 93 | ***************************************************************************/ |
|---|
| 94 | void BMTH_FIX_Matrix_Inverse |
|---|
| 95 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 96 | BMTH_FIX_Matrix *pRetMatrix); |
|---|
| 97 | |
|---|
| 98 | /*************************************************************************** |
|---|
| 99 | Summary: |
|---|
| 100 | Calculates the determinant of a matrix. If cofactor matrix is present, |
|---|
| 101 | precaculated cofactors from the table are used. |
|---|
| 102 | ***************************************************************************/ |
|---|
| 103 | uint32_t BMTH_FIX_Matrix_Determinant |
|---|
| 104 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 105 | BMTH_FIX_Matrix *pCofactors); |
|---|
| 106 | |
|---|
| 107 | /*************************************************************************** |
|---|
| 108 | Summary: |
|---|
| 109 | Multiplies a matrix by a scalar. |
|---|
| 110 | ***************************************************************************/ |
|---|
| 111 | void BMTH_FIX_Matrix_MultScalar |
|---|
| 112 | ( BMTH_FIX_Matrix *pMatrix, |
|---|
| 113 | uint32_t ulScalar, |
|---|
| 114 | BMTH_FIX_Matrix *pRetMatrix); |
|---|
| 115 | |
|---|
| 116 | /*************************************************************************** |
|---|
| 117 | Summary: |
|---|
| 118 | Prints a matrix. |
|---|
| 119 | ***************************************************************************/ |
|---|
| 120 | void BMTH_FIX_Matrix_Dump |
|---|
| 121 | ( BMTH_FIX_Matrix *pMatrix); |
|---|
| 122 | |
|---|
| 123 | |
|---|
| 124 | #ifdef __cplusplus |
|---|
| 125 | } |
|---|
| 126 | #endif |
|---|
| 127 | |
|---|
| 128 | #endif /* #ifndef BMTH_FIX_MATRIX_H__ */ |
|---|
| 129 | /* End of File */ |
|---|