Tenncor
matops.hpp
Go to the documentation of this file.
1 
10 #include <cassert>
11 #include <cstring>
12 
13 #include "teq/shape.hpp"
14 
15 #ifndef TEQ_MATOPS_HPP
16 #define TEQ_MATOPS_HPP
17 
18 namespace teq
19 {
20 
22 const RankT mat_dim = rank_cap + 1;
23 
25 const size_t mat_size = sizeof(double) * mat_dim * mat_dim;
26 
28 using MatrixT = double[mat_dim][mat_dim];
29 
31 std::string to_string (const MatrixT& mat);
32 
34 double determinant (const MatrixT& mat);
35 
37 void inverse (MatrixT out, const MatrixT& in);
38 
40 void matmul (MatrixT out, const MatrixT& lhs, const MatrixT& rhs);
41 
42 }
43 
44 #endif
const RankT rank_cap
Number of dimsensions in a shape/coordinate.
Definition: shape.hpp:47
double determinant(const MatrixT &mat)
Return the determinant of matrix.
std::string to_string(const MatrixT &mat)
Return the string representation of input matrix.
uint8_t RankT
Type used for shape rank.
Definition: shape.hpp:23
const size_t mat_size
Number of bytes in a homogeneous matrix.
Definition: matops.hpp:25
const RankT mat_dim
Number of rows and columns for the homogeneous matrix.
Definition: matops.hpp:22
void inverse(MatrixT out, const MatrixT &in)
Inverse in matrix and dump to out matrix.
Definition: coord.hpp:16
double[mat_dim][mat_dim] MatrixT
Coordinate transformation matrix (using homogeneous)
Definition: matops.hpp:28
void matmul(MatrixT out, const MatrixT &lhs, const MatrixT &rhs)
Apply matrix multiplication for lhs and rhs to out matrix.