LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_ztf_nancheck()

lapack_logical LAPACKE_ztf_nancheck ( int  matrix_layout,
char  transr,
char  uplo,
char  diag,
lapack_int  n,
const lapack_complex_double a 
)

Definition at line 36 of file lapacke_ztf_nancheck.c.

40 {
41  lapack_int len;
42  lapack_logical rowmaj, ntr, lower, unit;
43  lapack_int n1, n2, k;
44 
45  if( a == NULL ) return (lapack_logical) 0;
46 
47  rowmaj = (matrix_layout == LAPACK_ROW_MAJOR);
48  ntr = LAPACKE_lsame( transr, 'n' );
49  lower = LAPACKE_lsame( uplo, 'l' );
50  unit = LAPACKE_lsame( diag, 'u' );
51 
52  if( ( !rowmaj && ( matrix_layout != LAPACK_COL_MAJOR ) ) ||
53  ( !ntr && !LAPACKE_lsame( transr, 't' )
54  && !LAPACKE_lsame( transr, 'c' ) ) ||
55  ( !lower && !LAPACKE_lsame( uplo, 'u' ) ) ||
56  ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) {
57  /* Just exit if any of input parameters are wrong */
58  return (lapack_logical) 0;
59  }
60 
61  if( unit ) {
62  /* Unit case, diagonal should be excluded from the check for NaN.
63  * Decoding RFP and checking both triangulars and rectangular
64  * for NaNs.
65  */
66  if( lower ) {
67  n2 = n / 2;
68  n1 = n - n2;
69  } else {
70  n1 = n / 2;
71  n2 = n - n1;
72  }
73  if( n % 2 == 1 ) {
74  /* N is odd */
75  if( ( rowmaj || ntr ) && !( rowmaj && ntr ) ) {
76  /* N is odd and ( TRANSR = 'N' .XOR. ROWMAJOR) */
77  if( lower ) {
78  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
79  n1, &a[0], n )
81  &a[n1], n )
83  n2, &a[n], n );
84  } else {
85  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
86  n1, &a[n2], n )
88  &a[0], n )
90  n2, &a[n1], n );
91  }
92  } else {
93  /* N is odd and
94  * ( ( TRANSR = 'C' || TRANSR = 'T' ) .XOR. COLMAJOR )
95  */
96  if( lower ) {
97  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
98  n1, &a[0], n1 )
100  &a[1], n1 )
102  n2, &a[1], n1 );
103  } else {
104  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
105  n1, &a[(size_t)n2*n2], n2 )
107  &a[0], n2 )
109  n2, &a[(size_t)n1*n2], n2 );
110  }
111  }
112  } else {
113  /* N is even */
114  k = n / 2;
115  if( ( rowmaj || ntr ) && !( rowmaj && ntr ) ) {
116  /* N is even and ( TRANSR = 'N' .XOR. ROWMAJOR) */
117  if( lower ) {
118  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
119  k, &a[1], n+1 )
121  &a[k+1], n+1 )
123  k, &a[0], n+1 );
124  } else {
125  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
126  k, &a[k+1], n+1 )
128  &a[0], n+1 )
130  k, &a[k], n+1 );
131  }
132  } else {
133  /* N is even and
134  ( ( TRANSR = 'C' || TRANSR = 'T' ) .XOR. COLMAJOR ) */
135  if( lower ) {
136  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
137  k, &a[k], k )
139  &a[(size_t)k*(k+1)], k )
141  k, &a[0], k );
142  } else {
143  return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
144  k, &a[(size_t)k*(k+1)], k )
146  &a[0], k )
148  k, &a[(size_t)k*k], k );
149  }
150  }
151  }
152  } else {
153  /* Non-unit case - just check whole array for NaNs. */
154  len = n*(n+1)/2;
155  return LAPACKE_zge_nancheck( LAPACK_COL_MAJOR, len, 1, a, len );
156  }
157 }
#define lapack_int
Definition: lapack.h:83
#define lapack_logical
Definition: lapack.h:87
#define LAPACK_COL_MAJOR
Definition: lapacke.h:53
#define LAPACK_ROW_MAJOR
Definition: lapacke.h:52
lapack_logical LAPACKE_lsame(char ca, char cb)
Definition: lapacke_lsame.c:35
lapack_logical LAPACKE_zge_nancheck(int matrix_layout, lapack_int m, lapack_int n, const lapack_complex_double *a, lapack_int lda)
lapack_logical LAPACKE_ztr_nancheck(int matrix_layout, char uplo, char diag, lapack_int n, const lapack_complex_double *a, lapack_int lda)
Here is the call graph for this function:
Here is the caller graph for this function: