#include <memory.h>
#include <math.h>
#include <float.h>

#ifndef _MAT4
#define _MAT4

class Mat4
{
public:

	Mat4();
	Mat4(	float a11, float a21, float a31, float a41,	//columnwise
			float a12, float a22, float a32, float a42,
			float a13, float a23, float a33, float a43,
			float a14, float a24, float a34, float a44);
	~Mat4();

	void MatVecMultiplication(float *src, float *dst);
	void SolveLinSys(float *x, float *b);		//A*x=b

	float m[16]; //columnwise
private:
};

int mtLeastSquareD(int to_transpose,int to_decompose,int m,int n,double *a,double *p,double *b,double *sol);
double mtCholeskyD(int n,double *a,double *p);
void mtLoadSymetricD(int m,int n,double *a,double *asym);
void mtLoadSecondD(int m,int n,double *a,double *b,double *right);
void mtLineLoadD(int line_second,double *a_line,int column,double second,double *a,double *b);
int mtSolve(float *AOrig,int Nequat,int Nvar,float *bOrig, float *x);
float mtScalarP(int N,const float *x,int pas_x,const float *y,int pas_y);
double mtScalarD(int N,const double *x,int pas_x,const double *y,int pas_y);
void mt3DVecProdP(const float *x,const float *y,float *result);
void mtBaseVecFunc(int dim,  float *v1, char func, float *v2, float *r);
void mtScalarVector(int dim,float alf,float *v1,float bet, float *v2, float *r);
bool mtEqual(float a, float b);

#endif