56 TYPE temp[3][3] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
61 TYPE temp[3][3] = { { 0.1, 0.1, 0.3 }, { 0.2, 0.1, 0.2 }, { 0.3, 0.0, 0.1 } };
67 TYPE temp[3][3] = { { -1, 2, 0 }, { 1.3, 0.4, 3.4 }, { 0.3, 2.4, 3.4 } };
94 for(
size_t riga = 0; riga < 3; riga++)
96 for(
size_t col = 0; col < 3; col++)
98 printf(
"%f ", Q[riga][col]);
99 if(col == 2) printf(
"\n");
112 for(
size_t i = 0;
i < 3;
i++)
114 scalar01 += Q[0][
i] * Q[1][
i];
115 scalar12 += Q[1][
i] * Q[2][
i];
116 scalar02 += Q[0][
i] * Q[2][
i];
126 printf(
"scalar12: %f\n", num);
Experimental 3x3 polar decomposition helpers used for color transform analysis.
void matrix_multiply(const double *A, const double *B, double *RES, int rows_A, int cols_A, int cols_B)
Multiply two dense row-major matrices.
void polar_decomposition(double A[3][3], double Q[3][3], double H[3][3])
Compute the polar decomposition of a 3x3 matrix.
void stampa_3x3(double Q[3][3])
Print a 3x3 matrix in row-major order.
void check_orthonormal(double Q[3][3])
Print the pairwise row dot products of a 3x3 matrix.
void copy(double *dest, double *source, size_t num_el)
Copy a flat buffer used to initialize test matrices.
void print_float(double num)
Print one scalar diagnostic produced by the orthogonality check.