NFFT  3.4.1
print.c
1 /*
2  * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts
3  *
4  * This program is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU General Public License as published by the Free Software
6  * Foundation; either version 2 of the License, or (at your option) any later
7  * version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 51
16  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18 
19 #include <stdio.h>
20 #include "infft.h"
21 
23 void Y(vpr_double)(R *x, const INT n, const char *text)
24 {
25  INT k;
26 
27  if (x == NULL)
28  {
29  printf("null pointer\n");
30  fflush(stdout);
31  exit(-1);
32  }
33 
34  if (text != NULL)
35  {
36  printf ("\n %s, adr=%p\n", text, (void*)x);
37 
38  for (k = 0; k < n; k++)
39  {
40  if (k%8 == 0)
41  printf("%6td.\t", k);
42 
43  printf("%+.1" __FES__ ",", x[k]);
44 
45  if (k%8 == 7)
46  printf("\n");
47  }
48 
49  if (n%8 != 0)
50  printf("\n");
51  }
52  else
53  for (k = 0; k < n; k++)
54  printf("%+" __FES__ ",\n", x[k]);
55 
56  fflush(stdout);
57 }
58 
60 void Y(vpr_complex)(C *x, const INT n, const char *text)
61 {
62  INT k;
63 
64  if(text != NULL)
65  {
66  printf("\n %s, adr=%p\n", text, (void*)x);
67  for (k = 0; k < n; k++)
68  {
69  if (k%4 == 0)
70  printf("%6td.\t", k);
71 
72  printf("%+.1" __FES__ "%+.1" __FES__ "i,", CREAL(x[k]), CIMAG(x[k]));
73 
74  if (k%4==3)
75  printf("\n");
76  }
77  if (n%4!=0)
78  printf("\n");
79  }
80  else
81  for (k = 0; k < n; k++)
82  printf("%+" __FES__ "%+" __FES__ "i,\n", CREAL(x[k]), CIMAG(x[k]));
83 
84  fflush(stdout);
85 }