smgen.c 648 B

1234567891011121314151617181920
  1. /* smgen.c CCMATH mathematics library source code.
  2. *
  3. * Copyright (C) 2000 Daniel A. Atkinson All rights reserved.
  4. * This code may be redistributed under the terms of the GNU library
  5. * public license (LGPL). ( See the lgpl.license file for details.)
  6. * ------------------------------------------------------------------------
  7. */
  8. void smgen(double *a, double *eval, double *evec, int n)
  9. {
  10. double *p, *q, *ps, *r, *s, *t, *v = evec + n * n;
  11. for (ps = a, p = evec; p < v; p += n) {
  12. for (q = evec; q < v; q += n, ++ps) {
  13. *ps = 0.;
  14. for (r = eval, s = p, t = q; r < eval + n;)
  15. *ps += *r++ * *s++ * *t++;
  16. }
  17. }
  18. }