计算扩展矩阵解,利用列出行列的主元及利用双精度浮点数提高计算精度:
//Three order Mat
typedef struct STRTHREEORDERMAT
{
//parameter and y (result)
double m_param[3][4];
//x (unknown)
double m_unk[3];
}thrmat_t, *thrmat_tt;
//Three order Mat
typedef struct STRFOURORDERMAT
{
//parameter and y (result)
double m_param[4][5];
//x (unknown)
double m_unk[4];
}format_t, *format_tt;
//Six order Mat
typedef struct STRSIXORDERMAT
{
//parameter and y (result)
double m_param[6][7];
//x (unknown)
double m_unk[6];
}sixmat_t, *sixmat_tt;
//EliMination with maximal col and row privoting
static char gelimsolve(double **prow, short *pcol, double *unk, short row)
{
double *temprow = NULL;
short tempcol = 0;
double calctemp = 0;
short it0 = 0, it1 = 0, it2 = 0;
short maxrow = 0, maxcol = 0;
//elimination calc
for (it0 = 0; it0 < row; ++it0)
{
//calc max col and row
calctemp = FABS(*(*(prow + it0) + it0));
maxrow = maxcol = it0;
for (it1 = it0; it1 < row; ++it1)
{
for