Added rot_decode to decode rotation matrices and matrix_trace,

supporting function, and regression tests for both.
This commit is contained in:
Adrian Mariano
2020-10-20 16:26:11 -04:00
parent dcc7e9faaa
commit c80c7c558a
4 changed files with 88 additions and 0 deletions

View File

@@ -904,6 +904,16 @@ function norm_fro(A) =
norm(flatten(A));
// Function: matrix_trace()
// Usage:
// matrix_trace(M)
// Description:
// Computes the trace of a square matrix, the sum of the entries on the diagonal.
function matrix_trace(M) =
assert(is_matrix(M,square=true), "Input to trace must be a square matrix")
[for(i=[0:1:len(M)-1])1] * [for(i=[0:1:len(M)-1]) M[i][i]];
// Section: Comparisons and Logic
// Function: all_zero()