NFFT  3.3.0
print.c
1 /*
2  * Copyright (c) 2002, 2015 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 /* $Id: util.c 3483 2010-04-23 19:02:34Z keiner $ */
20 
21 #include <stdio.h>
22 #include "infft.h"
23 
25 void Y(vpr_double)(R *x, const INT n, const char *text)
26 {
27  INT k;
28 
29  if (x == NULL)
30  {
31  printf("null pointer\n");
32  fflush(stdout);
33  exit(-1);
34  }
35 
36  if (text != NULL)
37  {
38  printf ("\n %s, adr=%p\n", text, (void*)x);
39 
40  for (k = 0; k < n; k++)
41  {
42  if (k%8 == 0)
43  printf("%6td.\t", k);
44 
45  printf("%+.1" __FES__ ",", x[k]);
46 
47  if (k%8 == 7)
48  printf("\n");
49  }
50 
51  if (n%8 != 0)
52  printf("\n");
53  }
54  else
55  for (k = 0; k < n; k++)
56  printf("%+" __FES__ ",\n", x[k]);
57 
58  fflush(stdout);
59 }
60 
62 void Y(vpr_complex)(C *x, const INT n, const char *text)
63 {
64  INT k;
65 
66  if(text != NULL)
67  {
68  printf("\n %s, adr=%p\n", text, (void*)x);
69  for (k = 0; k < n; k++)
70  {
71  if (k%4 == 0)
72  printf("%6td.\t", k);
73 
74  printf("%+.1" __FES__ "%+.1" __FES__ "i,", CREAL(x[k]), CIMAG(x[k]));
75 
76  if (k%4==3)
77  printf("\n");
78  }
79  if (n%4!=0)
80  printf("\n");
81  }
82  else
83  for (k = 0; k < n; k++)
84  printf("%+" __FES__ "%+" __FES__ "i,\n", CREAL(x[k]), CIMAG(x[k]));
85 
86  fflush(stdout);
87 }