当前位置: 动力学知识库 > 问答 > 编程问答 >

c++ - Naive Gaussian elimination

问题描述:

While performing the naive gaussian elimination in C++, i can get a upper triangular matrix, but it doesn't work when the system of equation is more than 5*5 . any idea why this might be happening? i am using double as data type for the coefficients.

double factor =0;

for(int k=0;k<(count-1);k++){

for(int i=(k+1);i<count;i++){

factor = (doubleCoefficient[i][k])/(doubleCoefficient[k][k]);

for(int j=0;j<count;j++){

doubleCoefficient[i][j] -= (doubleCoefficient[k][j]*factor);

}

}

}

分享给朋友:
您可能感兴趣的文章:
随机阅读: