MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
cprint.cpp File Reference
#include "common_magma.h"
Include dependency graph for cprint.cpp:

Go to the source code of this file.

Macros

#define PRECISION_c
 
#define A(i, j)   (A + i + j*lda)
 

Functions

void magma_cprint (magma_int_t m, magma_int_t n, const magmaFloatComplex *A, magma_int_t lda)
 
void magma_cprint_gpu (magma_int_t m, magma_int_t n, const magmaFloatComplex *dA, magma_int_t ldda)
 

Macro Definition Documentation

#define A (   i,
 
)    (A + i + j*lda)

Definition at line 16 of file cprint.cpp.

#define PRECISION_c

Definition at line 14 of file cprint.cpp.

Function Documentation

void magma_cprint ( magma_int_t  m,
magma_int_t  n,
const magmaFloatComplex *  A,
magma_int_t  lda 
)

Definition at line 21 of file cprint.cpp.

References A, MAGMA_C_EQUAL, MAGMA_C_IMAG, MAGMA_C_REAL, MAGMA_C_ZERO, and magma_is_devptr().

22 {
23  if ( magma_is_devptr( A ) == 1 ) {
24  fprintf( stderr, "ERROR: cprint called with device pointer.\n" );
25  exit(1);
26  }
27 
28  magmaFloatComplex c_zero = MAGMA_C_ZERO;
29 
30  if ( m == 1 ) {
31  printf( "[ " );
32  }
33  else {
34  printf( "[\n" );
35  }
36  for( int i = 0; i < m; ++i ) {
37  for( int j = 0; j < n; ++j ) {
38  if ( MAGMA_C_EQUAL( *A(i,j), c_zero )) {
39  printf( " 0. " );
40  }
41  else {
42 #if defined(PRECISION_z) || defined(PRECISION_c)
43  printf( " %8.4f+%8.4fi", MAGMA_C_REAL( *A(i,j) ), MAGMA_C_IMAG( *A(i,j) ));
44 #else
45  printf( " %8.4f", MAGMA_C_REAL( *A(i,j) ));
46 #endif
47  }
48  }
49  if ( m > 1 ) {
50  printf( "\n" );
51  }
52  else {
53  printf( " " );
54  }
55  }
56  printf( "];\n" );
57 }
#define MAGMA_C_EQUAL(u, v)
Definition: magma.h:139
#define MAGMA_C_IMAG(a)
Definition: magma.h:147
#define A(i, j)
Definition: cprint.cpp:16
#define MAGMA_C_REAL(a)
Definition: magma.h:146
magma_int_t magma_is_devptr(const void *A)
Definition: auxiliary.cpp:47
#define MAGMA_C_ZERO
Definition: magma.h:153

Here is the call graph for this function:

Here is the caller graph for this function:

void magma_cprint_gpu ( magma_int_t  m,
magma_int_t  n,
const magmaFloatComplex *  dA,
magma_int_t  ldda 
)

Definition at line 64 of file cprint.cpp.

References A, magma_cgetmatrix, magma_cmalloc_cpu(), magma_cprint(), magma_free_cpu(), and magma_is_devptr().

65 {
66  if ( magma_is_devptr( dA ) == 0 ) {
67  fprintf( stderr, "ERROR: cprint_gpu called with host pointer.\n" );
68  exit(1);
69  }
70 
71  magma_int_t lda = m;
72  magmaFloatComplex* A;
73  magma_cmalloc_cpu( &A, lda*n );
74  magma_cgetmatrix( m, n, dA, ldda, A, lda );
75  magma_cprint( m, n, A, lda );
76  magma_free_cpu( A );
77 }
int magma_int_t
Definition: magmablas.h:12
#define magma_cgetmatrix(m, n, dA_src, ldda, hB_dst, ldb)
Definition: magmablas_c.h:705
#define A(i, j)
Definition: cprint.cpp:16
static magma_err_t magma_cmalloc_cpu(magmaFloatComplex **ptrPtr, size_t n)
Definition: magma.h:85
void magma_cprint(magma_int_t m, magma_int_t n, const magmaFloatComplex *A, magma_int_t lda)
Definition: cprint.cpp:21
magma_err_t magma_free_cpu(void *ptr)
magma_int_t magma_is_devptr(const void *A)
Definition: auxiliary.cpp:47
#define dA(dev, i, j)

Here is the call graph for this function:

Here is the caller graph for this function: