mmul.c 652 B

12345678910111213141516171819202122232425
  1. /* mmul.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. #include "ccmath.h"
  9. void mmul(double *c, double *a, double *b, int n)
  10. {
  11. double *p, *q, s;
  12. int i, j, k;
  13. trnm(b, n);
  14. for (i = 0; i < n; ++i, a += n) {
  15. for (j = 0, q = b; j < n; ++j) {
  16. for (k = 0, p = a, s = 0.; k < n; ++k)
  17. s += *p++ * *q++;
  18. *c++ = s;
  19. }
  20. }
  21. trnm(b, n);
  22. }