# Solver - C library for undetermined equation systems - Stack

Not at O(NN). The best book I have read on the subject is Henk A. Van der Vorst's. Iterative Krylov Methods for Large Linear Systems. Happily, the book's price is reasonable.
Answer: because b and x share / the same storage, because Lapack will write x over b.) / Solve the linear system Ax b. Const int nrhs 1; const int LDA N; int ipiv N; const int LDB N; int info; dgesv N, nrhs, A, LDA, ipiv, x, LDB, info / Uncomment the next line if you wish to see.
Actually, lapack and blas are prudent to store matrices this way, for Kernighan and Ritchie, who invented C, never seemed very interested in linear algebra. C is a fine language, but C's default matrix storage convention was probably a mistake from the first.
Disclosure: I know Brown personally and could be partial for this reason; but, still, his and Kapp's technique is a fine one which van der Vorst does omit.) For reasons I do not fully understand, most of the recent techniques (though not Kapp's and Brown's) seem to prefer to work in real numbers, treating complex numbers as a special case.
At O(NNN general techniques are known. At O(NN there are no general techniques, only lots of special-purpose techniques that work on restricted kinds of systems. You can often find a suitable restriction, if you work at it long enough, but it is never as simple as dumping your matrix into some general-purpose solver.
There may be a precanned software package that does precisely what you want, but my experience suggests that the odds are against you in this. There are just too many hundreds of distinct kinds of matrix problems that arise in practice for precanned software to crack.
The mathematical discussion comes first. Sample code follows. The nature of linear-algebra problems seems to be that they are either practically treatable by general linear-algebra techniques or they are not. General linear-algebra techniques such as the L-U factorization and the singular-value decomposition have been thoroughly developed since the 1960s, and have a firm theoretical foundation.