c言語実現は1つのマトリクスの特徴値と特徴ベクトルを求める
1030 ワード
前言
マトリクスの特徴値を求めて、主にQR分解を使って、私のあるブログの中で、私はすでに詳しく計算の過程を提供して、みんなは興味を持って見て、数日の研究を経て、ついに全体のeigアルゴリズムを完成しました.次は私のコード全体を添付して、分からないことがあったら私に聞いて、一緒に勉強を討論することを歓迎します!
これは前回の修正版で、前回書いたプログラムはC++コンパイル環境でコンパイルされたので、cに入れてコンパイルするとエラーが発生します.
最後に、間違ったところがあったら教えてほしいです.ありがとうございます.
#include
#include
#include
#include
// ,
typedef struct
{
int row;
int column;
double *data;//
}Matrix;
/************************************************************************
:
: matrix、 row、 column
: :true; :false
************************************************************************/
bool InitMatrix(Matrix *matrix, int row, int column)
{
int matrix_size = row*column*sizeof(double);
if (matrix_size <= 0)
return false;
matrix->data = (double*)malloc(matrix_size);//
if (matrix->data)
{
matrix->row = row;
matrix->column = column;
return