Functions | |
FLA_Error | FLA_Swap_rows (FLA_Obj A, dim_t k1, dim_t k2, FLA_Obj ipiv) |
void FLA_F2C() | fla_swap_rows_f (F_INT *A, F_INT *k1, F_INT *k2, F_INT *ipiv, F_INT *IERROR) |
References claswp(), dlaswp(), FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_ldim(), FLA_Obj_length(), FLA_Obj_width(), FLA_Swap_rows_check(), slaswp(), and zlaswp().
Referenced by FLA_Apply_pivots(), and fla_swap_rows_f().
00036 { 00037 FLA_Datatype datatype; 00038 int n_A, ldim_A; 00039 int m_ipiv, n_ipiv, ldim_ipiv; 00040 int inc_ipiv; 00041 int* buff_ipiv; 00042 int i; 00043 int k1_1, k2_1; 00044 int* pivots_lapack; 00045 00046 if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING ) 00047 FLA_Swap_rows_check( A, k1, k2, ipiv ); 00048 00049 if ( FLA_Obj_has_zero_dim( A ) ) return FLA_SUCCESS; 00050 00051 datatype = FLA_Obj_datatype( A ); 00052 00053 n_A = FLA_Obj_width( A ); 00054 ldim_A = FLA_Obj_ldim( A ); 00055 00056 m_ipiv = FLA_Obj_length( ipiv ); 00057 n_ipiv = FLA_Obj_width( ipiv ); 00058 ldim_ipiv = FLA_Obj_ldim( ipiv ); 00059 00060 buff_ipiv = FLA_INT_PTR( ipiv ); 00061 00062 if ( m_ipiv == 1 ) inc_ipiv = ldim_ipiv; 00063 else if ( n_ipiv == 1 ) inc_ipiv = 1; 00064 00065 // Convert zero-based FLAME indices to one-based for LAPACK. 00066 k1_1 = k1 + 1; 00067 k2_1 = k2 + 1; 00068 00069 // Translate FLAME pivot indices to LAPACK-compatible indices. It is 00070 // important to note that this conversion, unlike the one done by 00071 // FLA_Shift_pivots_to(), is NOT in-place, but rather done separately 00072 // in a temporary buffer. 00073 #ifdef FLA_ENABLE_WINDOWS_BUILD 00074 pivots_lapack = ( int * ) _alloca( m_ipiv * sizeof( int ) ); 00075 #else 00076 pivots_lapack = ( int * ) alloca( m_ipiv * sizeof( int ) ); 00077 #endif 00078 00079 for ( i = 0; i < m_ipiv; i++ ) 00080 { 00081 pivots_lapack[ i ] = buff_ipiv[ i ] + i + 1; 00082 } 00083 00084 switch ( datatype ){ 00085 00086 case FLA_FLOAT: 00087 { 00088 float* buff_A = ( float * ) FLA_FLOAT_PTR( A ); 00089 00090 FLA_C2F( slaswp )( &n_A, 00091 buff_A, &ldim_A, 00092 &k1_1, 00093 &k2_1, 00094 pivots_lapack, 00095 &inc_ipiv ); 00096 break; 00097 } 00098 00099 case FLA_DOUBLE: 00100 { 00101 double* buff_A = ( double * ) FLA_DOUBLE_PTR( A ); 00102 00103 FLA_C2F( dlaswp )( &n_A, 00104 buff_A, &ldim_A, 00105 &k1_1, 00106 &k2_1, 00107 pivots_lapack, 00108 &inc_ipiv ); 00109 break; 00110 } 00111 00112 case FLA_COMPLEX: 00113 { 00114 scomplex* buff_A = ( scomplex * ) FLA_COMPLEX_PTR( A ); 00115 00116 FLA_C2F( claswp )( &n_A, 00117 buff_A, &ldim_A, 00118 &k1_1, 00119 &k2_1, 00120 pivots_lapack, 00121 &inc_ipiv ); 00122 break; 00123 } 00124 00125 case FLA_DOUBLE_COMPLEX: 00126 { 00127 dcomplex* buff_A = ( dcomplex * ) FLA_DOUBLE_COMPLEX_PTR( A ); 00128 00129 FLA_C2F( zlaswp )( &n_A, 00130 buff_A, &ldim_A, 00131 &k1_1, 00132 &k2_1, 00133 pivots_lapack, 00134 &inc_ipiv ); 00135 break; 00136 } 00137 00138 } 00139 00140 return FLA_SUCCESS; 00141 }
void FLA_F2C() fla_swap_rows_f | ( | F_INT * | A, | |
F_INT * | k1, | |||
F_INT * | k2, | |||
F_INT * | ipiv, | |||
F_INT * | IERROR | |||
) |
References FLA_Swap_rows().
00145 { 00146 *IERROR = FLA_Swap_rows( *( ( FLA_Obj * ) A ), 00147 *( ( int * ) k1 ), 00148 *( ( int * ) k2 ), 00149 *( ( FLA_Obj * ) ipiv) ); 00150 }