matprt.c 769 B

12345678910111213141516171819202122232425262728293031323334
  1. /* matprt.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 <stdio.h>
  9. void matprt(double *a, int n, int m, char *fmt)
  10. {
  11. int i, j;
  12. double *p;
  13. for (i = 0, p = a; i < n; ++i) {
  14. for (j = 0; j < m; ++j)
  15. printf(fmt, *p++);
  16. printf("\n");
  17. }
  18. }
  19. void fmatprt(FILE * fp, double *a, int n, int m, char *fmt)
  20. {
  21. int i, j;
  22. double *p;
  23. for (i = 0, p = a; i < n; ++i) {
  24. for (j = 0; j < m; ++j)
  25. fprintf(fp, fmt, *p++);
  26. fprintf(fp, "\n");
  27. }
  28. }