/*--------------------------------------------------------------------------------
QR分解を用いた最小二乗法
least square method using QR decomposition
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-15 // 入力する行列の要素の値, value of the element of the matrix
#define EPSILON 1e-16 // 正則性判定定数, constant for determining the regularity of matrices
/*------------------------------------------------------------------------*/
extern int least_sq_with_QR_decomp( double y[ROW_NUM], double X[ROW_NUM][COL_NUM], double A[COL_NUM] );
extern int householder_QR_decomp( double X[ROW_NUM][COL_NUM], double d[ROW_NUM] );
extern void householder_QR_solve( double y[ROW_NUM], double X[ROW_NUM][COL_NUM], double R[ROW_NUM], double A[COL_NUM] );
/*------------------------------------------------------------------------*/