Support for linear algebra comes in the following components:
My intent in designing the algorithms used here has been to make them reasonably straightforward and robust. These algorithms have no pretensions to being especially fast, except the Slatec pieces listed below, though some contain (probably naive) attempts at optimisation (to suppress these, -DDefinitive). Eventually, I would like to implement a compile-time switch to enable the code to use calls to the Basic Linear Algebra Subprograms (BLAS) or some other library of highly-optimised code with similar functionality, when available: the current implementation should be regarded as a fall-back option in the absence of such a library.
As an exception to the above, I have translated some of the public-domain code provided as the Slatec library. In time, I may realise my goal of doing things with BLAS by the simple expedient of translating all the Slatec implementations. My translation of the ForTran (itself, in some cases, obtained by translating Algol) may have added a few bugs and is likely to have reduced the efficiency. As derivative works of the Slatec library, these are public domain.
Most functions in this module take a `spare' first argument. The purpose of this is to save on calls to the allocation (*_new) and release (*_kill) functions: however, your code should always assume that any value other than null passed as a `spare' pointer will be released and the return from the function will be some totally different, freshly allocated pointer. At the same time, any value other than null which is passed as a `spare' pointer must actually be valid for the function return: this just means that it must be a heap pointer with the correct type and dimension(s).
It should be noted, in conjunction with this, that the other (pointer) arguments to such functions are always read-only. This does not prevent you from passing a pointer both as a data argument and as the `spare': however, I have not yet done the necessary tampering with my algorithms to ensure that this will work. In general, the purely first-rank operations and the simplest (add, subtract, scale) second rank operations are safe. Transposition definitely isn't safe, nor is any contraction involving second rank entities.