56 template <
size_t ROWS,
size_t COLS = 1>
59 double _array[ROWS*COLS];
61 Mat(
const double * src) {
68 void load(
const double *src) {
69 aa_fcpy( _array, src, ROWS*COLS );
71 void store(
double *dst)
const {
72 aa_fcpy( dst, _array, ROWS*COLS );
74 double &operator()(
size_t i )
const {
return _array[i]; }
75 double &operator()(
size_t i ) {
return _array[i]; }
76 double &operator[](
size_t i ) {
return _array[i]; }
77 const double &operator[](
size_t i )
const {
return _array[i]; }
78 double &operator()(
size_t i,
size_t j )
const {
81 double &operator()(
size_t i,
size_t j ) {
84 size_t size()
const {
return ROWS*COLS; }
93 double norm()
const {
return aa_la_norm( ROWS*COLS, _array ); }
95 return aa_la_dot( ROWS*COLS, _array, other );
98 return aa_la_ssd( ROWS*COLS, _array, other );
101 return aa_la_dist( ROWS*COLS, _array, other );
106 template <
size_t ROWS >
116 aa_fcpy( &this->_array[0], &other[0], ROWS );
122 template <
size_t ROWS,
size_t COLS>
129 template <
size_t ROWS,
size_t COLS>
134 template <
size_t ROWS,
size_t COLS>
137 return 1.0/alpha * b;
139 template <
size_t ROWS,
size_t COLS>
147 template <
size_t ROWS,
size_t COLS>
155 template <
size_t ROWS,
size_t COLS>
168 Tf(
const double src[12] ) {
load(src); }
169 Tf(
double R11,
double R12,
double R13,
double v1,
170 double R21,
double R22,
double R23,
double v2,
171 double R31,
double R32,
double R33,
double v3 ) {
185 Tf(
const Tf &other) {
load(other._array); }
188 double &operator[](
size_t i ) {
return _array[i]; }
189 const double &operator[](
size_t i )
const {
return _array[i]; }
192 void load(
const double src[12]) {
195 void load_rotmat(
const double src[9]) {
198 void load_vec(
const double src[3]) {
201 void store(
double dst[12])
const {
204 void store_rotmat(
double dst[9])
const {
207 void store_vec(
double dst[3])
const {
220 static inline Mat<3> operator*(
const Tf tf,
228 static inline Tf operator*(
const Tf tf1,
237 #endif //AMINO_MAT_HPP
AA_API double aa_la_norm(size_t n, const double *x)
Euclidean norm of x.
static void aa_fcpy(double *dst, const double *src, size_t n) AA_DEPRECATED
copy n double floats from src to dst
#define AA_MATREF(A, lda, row, col)
Reference an element in a column-major matrix.
AA_API void aa_la_vsub(size_t n, const double *x, const double *y, double *r)
Elementwise subtraction.
void load(const double src[12])
load store ops
AA_API double aa_la_ssd(size_t n, const double *x, const double *y)
Sum of Squared Differences.
AA_API void aa_la_vadd(size_t n, const double *x, const double *y, double *r)
Elementwise addition.
AA_API double aa_la_dist(size_t n, const double *x, const double *y)
Euclidean Distance.
AA_API int aa_veq(size_t n, const double *a, const double *b, double tol)
Fuzzy equals.
AA_API void aa_la_transpose2(size_t m, size_t n, const double *A, double *At)
transpose m*n matrix A into n*m matrix At
AA_API void aa_tf_12(const double T[AA_RESTRICT 12], const double p0[AA_RESTRICT 3], double p1[AA_RESTRICT 3])
apply a euclidean transform
#define AA_TF_IDENT
Identity transform.
AA_API double aa_la_dot(size_t n, const double *x, const double *y)
Dot product.
AA_API void aa_tf_12chain(const double T1[AA_RESTRICT 12], const double T2[AA_RESTRICT 12], double T[AA_RESTRICT 12])
chain two transforms
AA_API void aa_la_sdiv(size_t n, double alpha, const double *x, double *r)
vector-scalar division.
AA_API void aa_la_smul(size_t n, double alpha, const double *x, double *r)
vector-scalar multiplication.
#define AA_EPSILON
a small number
AA_API void aa_tf_12inv(const double T[AA_RESTRICT 12], double Ti[AA_RESTRICT 12])
invert transform