17 #define MAT(m, x, y) (m->data[(x * m->col) + y])
18 #define VEC(v, x) (v->data[x])
111 double dot_product(
const double* left,
const double* right,
int length);
246 void eigen(
int N,
double a[],
int it_max,
double v[],
double d[],
int* it_num,
int* rot_num);
272 double frobenius_norm(
int n,
int k,
double a[],
double x[],
double lambda[]);
represents a matrix between matrix and vector they are able to be casted into one another ...
Definition: linalg.h:40
double data[]
the elements of the vector
Definition: linalg.h:33
void vec_print(const vector *vec)
prints the vector this function will not modify the vector and print to stdout
Definition: linalg.c:121
double dot_product(const double *left, const double *right, int length)
Performs dot product on two double* this function will malloc for the user a double arrays must be of...
Definition: linalg.c:57
vector * vecscalar_divide(const vector *vec, const double scalar)
Performs scalar division of a vector this function will malloc for the user a vector*.
Definition: linalg.c:74
matrix * matmat_multiply(const matrix *left, const matrix *right)
Performs standard matrix multiplication this function will malloc for the user a matrix*.
Definition: linalg.c:129
matrix * matrix_create(size_t row, size_t col)
Creates a matrix this function will malloc the exact space for the required dimensions.
Definition: linalg.c:22
struct _matrix matrix
represents a matrix between matrix and vector they are able to be casted into one another ...
size_t row
the number of rows in the matrix
Definition: linalg.h:42
matrix * covmat(matrix *mat)
computes the variance covariance matrix
Definition: linalg.c:397
struct _vector vector
represents a vector padding is to make sure that matrix and vector both have the same byte size and a...
matrix * vec_to_mat(vector *vec, int orientation)
Converts vector into matrix this function will "cast" the vector into a matrix by using the fact that...
Definition: linalg.c:33
void vec_append(vector **vec_a, vector *vec_b)
Appends vector b to vector a this function will realloc for the user vector a and free vector b...
Definition: linalg.c:192
void eigen(int N, double a[], int it_max, double v[], double d[], int *it_num, int *rot_num)
Performs Jacobi eigenvalue iteration this function will required the user to pass in non-null it_num ...
Definition: linalg.c:212
matrix * mat_transpose(const matrix *mat)
Performs matrix transpose this function will malloc for the user a matrix*.
Definition: linalg.c:181
void matrix_reshape(matrix *mat, size_t row, size_t col)
Reshapes the matrix this function will reshape the matrix in constant time.
Definition: linalg.c:51
vector * compute_average(matrix *images, int num_images)
computes the average matrix of all the *vector images
Definition: linalg.c:407
vector * mat_to_vec(matrix *mat)
Converts matrix into vector this function will "cast" the matrix into a vector by using the fact that...
Definition: linalg.c:43
vector * vecscalar_multiply(const vector *vec, const double scalar)
Performs scalar multiplication of a vector this function will malloc for the user a vector*...
Definition: linalg.c:66
void diag_vector(int n, double a[], double v[])
gets the diagonal entries
Definition: linalg.c:363
matrix * matmat_subtraction(const matrix *left, const matrix *right)
Performs standard matrix subtration this function will malloc for the user a matrix*.
Definition: linalg.c:154
vector * vector_create(size_t size)
Creates a vector this function will malloc the exact space for the required dimensions.
Definition: linalg.c:11
void mat_identity(int n, double a[])
modifies a matrix to be the identity matrix of size n
Definition: linalg.c:347
size_t col
the number of columns in the matrix
Definition: linalg.h:44
matrix * matscalar_multiply(const matrix *mat, const double scalar)
Performs scalar multiplication of a matrix this function will malloc for the user a matrix*...
Definition: linalg.c:165
matrix * matscalar_divide(const matrix *mat, const double scalar)
Performs scalar division of a matrix this function will malloc for the user a matrix*.
Definition: linalg.c:176
vector * matvec_multiply(const matrix *mat, const vector *vec)
Performs matrix vector multiplication this function will malloc for the user a vector* if the matrix ...
Definition: linalg.c:95
size_t padding
unused value but important as padding
Definition: linalg.h:31
void mat_print(const matrix *mat)
prints the matrix this function will not modify the matrix and print to stdout
Definition: linalg.c:107
vector * vecmat_multiply(const vector *vec, const matrix *mat)
Performs vector matrix multiplication this function will malloc for the user a vector* if the vector ...
Definition: linalg.c:80
matrix * matmat_addition(const matrix *left, const matrix *right)
Performs standard matrix addition this function will malloc for the user a matrix*.
Definition: linalg.c:143
double frobenius_norm(int n, int k, double a[], double x[], double lambda[])
computes the Frobenius norm in a right eigensystem
Definition: linalg.c:371
double data[]
row wise expansion of the elements in the matrix
Definition: linalg.h:46
size_t size
the number of elements in the vector
Definition: linalg.h:29
represents a vector padding is to make sure that matrix and vector both have the same byte size and a...
Definition: linalg.h:27