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_dtf_nancheck( int matrix_order, char transr,
00038 char uplo, char diag,
00039 lapack_int n,
00040 const 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_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00080 n1, &a[0], n )
00081 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, n2, n1,
00082 &a[n1], n )
00083 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00084 n2, &a[n], n );
00085 } else {
00086 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00087 n1, &a[n2], n )
00088 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, n1, n2,
00089 &a[0], n )
00090 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00091 n2, &a[n1], n );
00092 }
00093 } else {
00094
00095
00096 if( lower ) {
00097 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00098 n1, &a[0], n1 )
00099 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, n1, n2,
00100 &a[1], n1 )
00101 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00102 n2, &a[1], n1 );
00103 } else {
00104 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00105 n1, &a[(size_t)n2*n2], n2 )
00106 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, n2, n1,
00107 &a[0], n2 )
00108 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00109 n2, &a[(size_t)n1*n2], n2 );
00110 }
00111 }
00112 } else {
00113
00114 k = n / 2;
00115 if( ( rowmaj || ntr ) && !( rowmaj && ntr ) ) {
00116
00117 if( lower ) {
00118 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00119 k, &a[1], n+1 )
00120 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, k, k,
00121 &a[k+1], n+1 )
00122 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00123 k, &a[0], n+1 );
00124 } else {
00125 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00126 k, &a[k+1], n+1 )
00127 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, k, k,
00128 &a[0], n+1 )
00129 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00130 k, &a[k], n+1 );
00131 }
00132 } else {
00133
00134
00135 if( lower ) {
00136 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00137 k, &a[k], k )
00138 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, k, k,
00139 &a[(size_t)k*(k+1)], k )
00140 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00141 k, &a[0], k );
00142 } else {
00143 return LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'u', 'u',
00144 k, &a[(size_t)k*(k+1)], k )
00145 || LAPACKE_dge_nancheck( LAPACK_ROW_MAJOR, k, k,
00146 &a[0], k )
00147 || LAPACKE_dtr_nancheck( LAPACK_ROW_MAJOR, 'l', 'u',
00148 k, &a[(size_t)k*k], k );
00149 }
00150 }
00151 }
00152 } else {
00153
00154 len = n*(n+1)/2;
00155 return LAPACKE_dge_nancheck( LAPACK_COL_MAJOR, len, 1, a, len );
00156 }
00157 }