LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ LAPACKE_stp_nancheck()

lapack_logical LAPACKE_stp_nancheck ( int  matrix_layout,
char  uplo,
char  diag,
lapack_int  n,
const float *  ap 
)

Definition at line 39 of file lapacke_stp_nancheck.c.

42 {
43  lapack_int i, len;
44  lapack_logical colmaj, upper, unit;
45 
46  if( ap == NULL ) return (lapack_logical) 0;
47 
48  colmaj = ( matrix_layout == LAPACK_COL_MAJOR );
49  upper = LAPACKE_lsame( uplo, 'u' );
50  unit = LAPACKE_lsame( diag, 'u' );
51 
52  if( ( !colmaj && ( matrix_layout != LAPACK_ROW_MAJOR ) ) ||
53  ( !upper && !LAPACKE_lsame( uplo, 'l' ) ) ||
54  ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) {
55  /* Just exit if any of input parameters are wrong */
56  return (lapack_logical) 0;
57  }
58 
59  if( unit ) {
60  /* Unit case, diagonal should be excluded from the check for NaN. */
61 
62  /* Since col_major upper and row_major lower are equal,
63  * and col_major lower and row_major upper are equals too -
64  * using one code for equal cases. XOR( colmaj, upper )
65  */
66  if( ( colmaj || upper ) && !( colmaj && upper ) ) {
67  for( i = 1; i < n; i++ )
68  if( LAPACKE_s_nancheck( i, &ap[ ((size_t)i+1)*i/2 ], 1 ) )
69  return (lapack_logical) 1;
70  } else {
71  for( i = 0; i < n-1; i++ )
72  if( LAPACKE_s_nancheck( n-i-1,
73  &ap[ (size_t)i+1 + i*((size_t)2*n-i+1)/2 ], 1 ) )
74  return (lapack_logical) 1;
75  }
76  return (lapack_logical) 0;
77  } else {
78  /* Non-unit case - just check whole array for NaNs. */
79  len = n*(n+1)/2;
80  return LAPACKE_s_nancheck( len, ap, 1 );
81  }
82 }
#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_s_nancheck(lapack_int n, const float *x, lapack_int incx)
Here is the call graph for this function:
Here is the caller graph for this function: