#ifndef rdo_linear_algebra_H #define rdo_linear_algebra_H /* Some linear algebra operations. */ #define rdo_linear_algebra_H_COPYRIGHT "Copyright © 2008 Danillo Pereira and J. Stolfi, UNICAMP" /* Last edited on 2009-02-10 15:34:08 by stolfi */ #include #define TINY_SUM 1e-200 /* A tiny value used to initialize the sum of a set of values, instead of zero, in order to avoid division by zero when normalizing those values. Thus, if all un-normalized values are zero, the normalized ones will also be zero (rather than {NAN]s). On the other hand, if any value is significative (greater than {1e16*TINY_SUM}), this trick will not have any effect on the result. !!! Check whether the trick is really needed !!! */ void rdo_linalg_set_some_elements(double v[], int n, int sel[], double w[], int m); /* Sets all elements {v[0..n-1]} to zero, then sets {v[sel[j]]=w[j]}, for each {j} in {0..m-1}. */ #endif