cmmul.c 742 B

1234567891011121314151617181920212223242526272829
  1. /* cmmul.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 cmmul(Cpx * c, Cpx * a, Cpx * b, int n)
  10. {
  11. Cpx s, *p, *q;
  12. int i, j, k;
  13. trncm(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.re = s.im = 0.; k < n; ++k) {
  17. s.re += p->re * q->re - p->im * q->im;
  18. s.im += p->im * q->re + p->re * q->im;
  19. ++p;
  20. ++q;
  21. }
  22. *c++ = s;
  23. }
  24. }
  25. trncm(b, n);
  26. }