#ifndef __MATUTIL_H__
#define __MATUTIL_H__

#include <stdlib.h>
#include "nr.h"
#include "nrutil.h"


void print_vector_float(int size, float* v);

void print_vector_int(int size, int* v);


float **new_matrix(int m, int n);

float **new_diagonal(int n, float *v);

void print_matrix(int m, int n, float **mat);

void copy_matrix(int m, int n, float **src, float **dst);

void simple_free_matrix(int m, int n, float **mat);

float **matmul(int m, int n, int p, float **a, float **b);

float **mattranspose(int m, int n, float **mat);

float **matinv(int m, float **mat);

float matdet(int m, float **mat);

/**
 * a struct for get solution of ax = b
 */
typedef struct JMatrixData {
    int m, n;
    float **a;
    float **b;
} JMatrixData;

JMatrixData* new_jmatdata(int m, int n);

void free_jmatdata(JMatrixData* data);

void copy_jmatdata(JMatrixData *src, JMatrixData *dst);

#endif