00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "lapacke_utils.h"
00034
00035
00036
00037 lapack_logical LAPACKE_ztf_nancheck( int matrix_order, char transr,
00038 char uplo, char diag,
00039 lapack_int n,
00040 const lapack_complex_double *a )
00041 {
00042 lapack_int len;
00043 lapack_logical rowmaj, ntr, lower, unit;
00044 lapack_int n1, n2, k;
00045
00046 if( a == NULL ) return (lapack_logical) 0;
00047
00048 rowmaj = (matrix_order == LAPACK_ROW_MAJOR);
00049 ntr = LAPACKE_lsame( transr, 'n' );
00050 lower = LAPACKE_lsame( uplo, 'l' );
00051 unit = LAPACKE_lsame( diag, 'u' );
00052
00053 if( ( !rowmaj && ( matrix_order != LAPACK_COL_MAJOR ) ) ||
00054 ( !ntr && !LAPACKE_lsame( transr, 't' )
00055 && !LAPACKE_lsame( transr, 'c' ) ) ||
00056 ( !lower && !LAPACKE_lsame( uplo, 'u' ) ) ||
00057 ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) {
00058
00059 return (lapack_logical) 0;
00060 }
00061
00062 if( unit ) {
00063
00064
00065
00066
00067 if( lower ) {
00068 n2 = n / 2;
00069 n1 = n - n2;
00070 } else {
00071 n1 = n / 2;
00072 n2 = n - n1;
00073 }
00074 if( n % 2 == 1 ) {
00075
00076 if( ( rowmaj || ntr ) && !( rowmaj && ntr ) ) {
00077
00078 if( lower ) {
00079 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00080 n1, &a[0], n )
00081 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, n2, n1,
00082 &a[n1], n )
00083 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00084 n2, &a[n], n );
00085 } else {
00086 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00087 n1, &a[n2], n )
00088 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, n1, n2,
00089 &a[0], n )
00090 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00091 n2, &a[n1], n );
00092 }
00093 } else {
00094
00095
00096
00097 if( lower ) {
00098 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00099 n1, &a[0], n1 )
00100 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, n1, n2,
00101 &a[1], n1 )
00102 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00103 n2, &a[1], n1 );
00104 } else {
00105 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00106 n1, &a[(size_t)n2*n2], n2 )
00107 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, n2, n1,
00108 &a[0], n2 )
00109 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00110 n2, &a[(size_t)n1*n2], n2 );
00111 }
00112 }
00113 } else {
00114
00115 k = n / 2;
00116 if( ( rowmaj || ntr ) && !( rowmaj && ntr ) ) {
00117
00118 if( lower ) {
00119 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00120 k, &a[1], n+1 )
00121 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, k, k,
00122 &a[k+1], n+1 )
00123 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00124 k, &a[0], n+1 );
00125 } else {
00126 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00127 k, &a[k+1], n+1 )
00128 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, k, k,
00129 &a[0], n+1 )
00130 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00131 k, &a[k], n+1 );
00132 }
00133 } else {
00134
00135
00136 if( lower ) {
00137 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00138 k, &a[k], k )
00139 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, k, k,
00140 &a[(size_t)k*(k+1)], k )
00141 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00142 k, &a[0], k );
00143 } else {
00144 return LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00145 k, &a[(size_t)k*(k+1)], k )
00146 || LAPACKE_zge_nancheck( LAPACK_ROW_MAJOR, k, k,
00147 &a[0], k )
00148 || LAPACKE_ztr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00149 k, &a[(size_t)k*k], k );
00150 }
00151 }
00152 }
00153 } else {
00154
00155 len = n*(n+1)/2;
00156 return LAPACKE_zge_nancheck( LAPACK_COL_MAJOR, len, 1, a, len );
00157 }
00158 }