summaryrefslogtreecommitdiff
path: root/include/common/matrix.h
blob: fe4a12a6e4072fbba608a472d0f2c1bd10ee9167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef UPEM_MORPHING_MATRIX
#define UPEM_MORPHING_MATRIX

/**
 * File: matrix.h
 * Matrices representation and useful operations.
 *
 * See also:
 *   The film
 */

#include "geom.h"

/**
 * Struct: IntSquareMatrix
 * Represents a square integer matrix.
 *
 * Fields:
 *   **elements - NULL-terminated array of element pointers
 *   dim        - dimension
 */
typedef struct {
  IntVector **elements;
  IntVector dim;
} IntSquareMatrix;

/**
 * Function: matrix_int_det
 * Computes and returns the determinant of a square integer matrix.
 *
 * Parameters:
 *   *matrix - pointer to input matrix
 *
 * Returns:
 *   The integer determinant
 */
IntVector matrix_int_det(IntSquareMatrix *matrix);

/**
 * Function: matrix_reshape
 * Reshapes a flat vector into a bi-dimensional row pointer array.
 *
 * Parameters:
 *   **bi_dim - pointer to the result row array
 *   *flat    - flat vector
 *   width    - number of elements per row
 *   height   - number of rows
 */
void matrix_reshape(IntVector **bi_dim, IntVector *flat, int width, int height);

#endif