Debian Codegraph @

minimath/README

raw
1 This is a copy of libminimath 0.8 from
2
3 https://github.com/dkogan/libminimath
4
5
6
7
8 This is a very simple C library to implement basic linear algebra routines for
9 small matrices. Libraries such as BLAS are highly optimized for large matrices,
10 but their overhead often makes them suboptimal for very small matrices. By
11 contrast, this library has very simple, predefined functions for the various
12 routines it supports. These functions are NOT at all optimized at the source
13 level, but they are simple, and the C compiler can generally do a very good job
14 optimizing these. All the routines are in a header, so the compiler is free to
15 aggressively inline the code, as it sees fit. Supported are various ways to
16 compute norms of vectors, multiply matrices and solve linear systems.
17
18 The suffix of every function determines where its output goes. The ..._vout
19 functions store their output in a new vector, generally given as the last
20 argument. The ..._vaccum functions are the same except the output is added to
21 the data already in that vector instead of overwriting. With neither of these
22 suffixes, the functions store their output into the vector pointed to by the
23 first argument. Many functions have ...._scaled flavors that can apply a scale
24 factor to the given operation. The scale factor is in the last argument.
25
26 Matrices are stored row-first. Dimensions are given col-first. Vectors are
27 treated as row vectors. So for instance, a '3x2' matrix M stored in double[]
28 {1.0, 2.0, 3.0, 4.0, 5.0, 6.0} implies
29
30 [ 1.0 2.0 ]
31 M = [ 3.0 4.0 ]
32 [ 5.0 6.0 ]
33
34 a 3-vector v = [ 11.0 12.0 13.0 ] can be multiplied by M to compute v*M using the
35
36 mul_vec3_gen32_... family of functions.
37
38 Example:
39
40 #include <minimath.h>
41 #include <stdio.h>
42 int main(void)
43 {
44 double M[] = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0};
45 double v[] = {11.0, 12.0, 13.0};
46
47 mul_vec3_gen32(v, M);
48 printf("%f %f\n", v[0], v[1]);
49 return 0;
50 }
51
52
53
54 C99-compliant compiler required.
55
56 THIS LIBRARY IS UNDER DEVELOPMENT AND THE APIs MAY CHANGE AT ANY TIME