trnm.c 593 B

1234567891011121314151617181920212223
  1. /* trnm.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 trnm(double *a, int n)
  9. {
  10. double s, *p, *q;
  11. int i, j, e;
  12. for (i = 0, e = n - 1; i < n - 1; ++i, --e, a += n + 1) {
  13. for (p = a + 1, q = a + n, j = 0; j < e; ++j) {
  14. s = *p;
  15. *p++ = *q;
  16. *q = s;
  17. q += n;
  18. }
  19. }
  20. }