NFFT  3.3.2
print.c
00001 /*
00002  * Copyright (c) 2002, 2016 Jens Keiner, Stefan Kunis, Daniel Potts
00003  *
00004  * This program is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU General Public License as published by the Free Software
00006  * Foundation; either version 2 of the License, or (at your option) any later
00007  * version.
00008  *
00009  * This program is distributed in the hope that it will be useful, but WITHOUT
00010  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012  * details.
00013  *
00014  * You should have received a copy of the GNU General Public License along with
00015  * this program; if not, write to the Free Software Foundation, Inc., 51
00016  * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  */
00018 
00019 #include <stdio.h>
00020 #include "infft.h"
00021 
00023 void Y(vpr_double)(R *x, const INT n, const char *text)
00024 {
00025   INT k;
00026 
00027   if (x == NULL)
00028   {
00029     printf("null pointer\n");
00030     fflush(stdout);
00031     exit(-1);
00032   }
00033 
00034   if (text != NULL)
00035   {
00036     printf ("\n %s, adr=%p\n", text, (void*)x);
00037 
00038     for (k = 0; k < n; k++)
00039     {
00040       if (k%8 == 0)
00041         printf("%6td.\t", k);
00042 
00043       printf("%+.1" __FES__ ",", x[k]);
00044 
00045       if (k%8 == 7)
00046         printf("\n");
00047     }
00048 
00049     if (n%8 != 0)
00050       printf("\n");
00051   }
00052   else
00053     for (k = 0; k < n; k++)
00054       printf("%+" __FES__ ",\n", x[k]);
00055 
00056   fflush(stdout);
00057 }
00058 
00060 void Y(vpr_complex)(C *x, const INT n, const char *text)
00061 {
00062   INT k;
00063 
00064   if(text != NULL)
00065   {
00066     printf("\n %s, adr=%p\n", text, (void*)x);
00067     for (k = 0; k < n; k++)
00068     {
00069       if (k%4 == 0)
00070         printf("%6td.\t", k);
00071 
00072       printf("%+.1" __FES__ "%+.1" __FES__ "i,", CREAL(x[k]), CIMAG(x[k]));
00073 
00074       if (k%4==3)
00075         printf("\n");
00076     }
00077     if (n%4!=0)
00078       printf("\n");
00079   }
00080   else
00081     for (k = 0; k < n; k++)
00082       printf("%+" __FES__ "%+" __FES__ "i,\n", CREAL(x[k]), CIMAG(x[k]));
00083 
00084   fflush(stdout);
00085 }