문제

I need to solve a system of n-linear equations with n-unknown variables in C++ using the gaussian method of elimnation. Any hints how to achieve that? I'll be probably using rand(); for the amount of n, since isn't available, because C++11 I can't use.

도움이 되었습니까?

해결책

to solve a linear system

AX=B

you need to invert a matrix A, which results in A^(-1) and multiply A^(-1) * B to obtain X. This is the example code to invert non-singular matrix using Gauss - Jordan elimination algorithm (complexity is O(n^3)):

matrix inversion using Gauss-Jordan elimination

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top