summaryrefslogtreecommitdiff
path: root/include/mat33.h
diff options
context:
space:
mode:
authorYilun Lin <yllin@google.com>2018-10-04 10:19:57 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-10-04 12:55:53 -0700
commit315aaca9467f49bc432ef5f2de9c0e3bb56f0251 (patch)
tree3ea739aca1db340e93b9daee7958d5afc5c9f31f /include/mat33.h
parentece03ab4d09b157c5e6f3c4fe0446678c0d8684b (diff)
downloadchrome-ec-315aaca9467f49bc432ef5f2de9c0e3bb56f0251.tar.gz
mag_cal: Support fixed-point calculation.
Modified from floating point version. This includes changes to vec3, vec4, mat33, mat44, and mag_cal. Now fixed-point type (fp_*) functions is a function wrapper for both fixed-point and floating point version operations: * define CONFIG_FPU to use floating version mag_cal * undef CONFIG_FPU to use fixed-point version mag_cal Also, add tests for both float and fp types operations. TEST=define CONFIG_FPU; flash on reef; See ARC++ magnetmeter app moving. TEST=undef CONFIG_FPU; flash on reef; See ARC++ magnetmeter app moving. TEST=make runtests -j TEST=make buildalltests -j BUG=b:113364863 BRANCH=None Change-Id: Ie695945acb666912babb2a603e09c602a0624d44 Signed-off-by: Yilun Lin <yllin@google.com> Reviewed-on: https://chromium-review.googlesource.com/1260704 Commit-Ready: Yilun Lin <yllin@chromium.org> Tested-by: Yilun Lin <yllin@chromium.org> Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Diffstat (limited to 'include/mat33.h')
-rw-r--r--include/mat33.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/include/mat33.h b/include/mat33.h
index 0b8b0123cb..fdd7e954ac 100644
--- a/include/mat33.h
+++ b/include/mat33.h
@@ -7,25 +7,25 @@
#define __CROS_EC_MAT_33_H
-#include "vec3.h"
+#include "math_util.h"
#include "util.h"
+#include "vec3.h"
typedef float mat33_float_t[3][3];
typedef size_t sizev3_t[3];
-void init_zero_matrix(mat33_float_t A);
-void init_diagonal_matrix(mat33_float_t A, float x);
-
-void mat33_float_scalar_mul(mat33_float_t A, float c);
+void mat33_fp_init_zero(mat33_fp_t A);
+void mat33_fp_init_diagonal(mat33_fp_t A, fp_t x);
-void mat33_float_swap_rows(mat33_float_t A, const size_t i, const size_t j);
+void mat33_fp_scalar_mul(mat33_fp_t A, fp_t c);
-void mat33_float_get_eigenbasis(mat33_float_t S, floatv3_t eigenvals,
- mat33_float_t eigenvecs);
+void mat33_fp_swap_rows(mat33_fp_t A, const size_t i, const size_t j);
-size_t mat33_float_maxind(mat33_float_t A, size_t k);
+void mat33_fp_get_eigenbasis(mat33_fp_t S, fpv3_t eigenvals,
+ mat33_fp_t eigenvecs);
-void mat33_float_rotate(mat33_float_t A, float c, float s,
- size_t k, size_t l, size_t i, size_t j);
+size_t mat33_fp_maxind(mat33_fp_t A, size_t k);
+void mat33_fp_rotate(mat33_fp_t A, fp_t c, fp_t s,
+ size_t k, size_t l, size_t i, size_t j);
#endif /* __CROS_EC_MAT_33_H */