/*--------------------------------------------------------------------------------
正規方程式と逆行列を用いて行う最小二乗法
least square method using normal equation and inverse matrix
least_sq.h
--------------------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define ROW_NUM 3 // 行数, number of rows
#define COL_NUM 2 // 列数, number of number of columns
#define DELTA 1e-3 // 入力する行列の要素の値, value of the element of the matrix
/*-----------------------------------------*/
#define TINY 1.0e-20
/*------------------------------------------------------------------------*/
extern int least_sq_with_normal_eq( double y[ROW_NUM], double X[ROW_NUM][COL_NUM], double A[COL_NUM] );
extern int inv_matrix( double a[COL_NUM][COL_NUM] );
extern int LU_decomp(double a[COL_NUM][COL_NUM], int indx[COL_NUM] );
extern void LU_solve(double a[COL_NUM][COL_NUM], int indx[COL_NUM], double b[COL_NUM] );
/*------------------------------------------------------------------------*/