void CORE_chegst(int itype, PLASMA_enum uplo, int N, PLASMA_Complex32_t *A, int LDA, PLASMA_Complex32_t *B, int LDB, int *INFO) { *INFO = LAPACKE_chegst_work( LAPACK_COL_MAJOR, itype, lapack_const(uplo), N, A, LDA, B, LDB ); }
lapack_int LAPACKE_chegst( int matrix_order, lapack_int itype, char uplo, lapack_int n, lapack_complex_float* a, lapack_int lda, const lapack_complex_float* b, lapack_int ldb ) { if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_chegst", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_che_nancheck( matrix_order, uplo, n, a, lda ) ) { return -5; } if( LAPACKE_cge_nancheck( matrix_order, n, n, b, ldb ) ) { return -7; } #endif return LAPACKE_chegst_work( matrix_order, itype, uplo, n, a, lda, b, ldb ); }
void CORE_chegst_quark(Quark *quark) { int itype; PLASMA_enum uplo; int n; PLASMA_Complex32_t *A; int lda; PLASMA_Complex32_t *B; int ldb; PLASMA_sequence *sequence; PLASMA_request *request; int iinfo; int info; quark_unpack_args_10(quark, itype, uplo, n, A, lda, B, ldb, sequence, request, iinfo); info = LAPACKE_chegst_work( LAPACK_COL_MAJOR, itype, lapack_const(uplo), n, A, lda, B, ldb); if (sequence->status == PLASMA_SUCCESS && info != 0) plasma_sequence_flush(quark, sequence, request, iinfo+info); }
int main(void) { /* Local scalars */ lapack_int itype, itype_i; char uplo, uplo_i; lapack_int n, n_i; lapack_int lda, lda_i; lapack_int lda_r; lapack_int ldb, ldb_i; lapack_int ldb_r; lapack_int info, info_i; lapack_int i; int failed; /* Local arrays */ lapack_complex_float *a = NULL, *a_i = NULL; lapack_complex_float *b = NULL, *b_i = NULL; lapack_complex_float *a_save = NULL; lapack_complex_float *a_r = NULL; lapack_complex_float *b_r = NULL; /* Iniitialize the scalar parameters */ init_scalars_chegst( &itype, &uplo, &n, &lda, &ldb ); lda_r = n+2; ldb_r = n+2; itype_i = itype; uplo_i = uplo; n_i = n; lda_i = lda; ldb_i = ldb; /* Allocate memory for the LAPACK routine arrays */ a = (lapack_complex_float *) LAPACKE_malloc( lda*n * sizeof(lapack_complex_float) ); b = (lapack_complex_float *) LAPACKE_malloc( ldb*n * sizeof(lapack_complex_float) ); /* Allocate memory for the C interface function arrays */ a_i = (lapack_complex_float *) LAPACKE_malloc( lda*n * sizeof(lapack_complex_float) ); b_i = (lapack_complex_float *) LAPACKE_malloc( ldb*n * sizeof(lapack_complex_float) ); /* Allocate memory for the backup arrays */ a_save = (lapack_complex_float *) LAPACKE_malloc( lda*n * sizeof(lapack_complex_float) ); /* Allocate memory for the row-major arrays */ a_r = (lapack_complex_float *) LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_float) ); b_r = (lapack_complex_float *) LAPACKE_malloc( n*(n+2) * sizeof(lapack_complex_float) ); /* Initialize input arrays */ init_a( lda*n, a ); init_b( ldb*n, b ); /* Backup the ouptut arrays */ for( i = 0; i < lda*n; i++ ) { a_save[i] = a[i]; } /* Call the LAPACK routine */ chegst_( &itype, &uplo, &n, a, &lda, b, &ldb, &info ); /* Initialize input data, call the column-major middle-level * interface to LAPACK routine and check the results */ for( i = 0; i < lda*n; i++ ) { a_i[i] = a_save[i]; } for( i = 0; i < ldb*n; i++ ) { b_i[i] = b[i]; } info_i = LAPACKE_chegst_work( LAPACK_COL_MAJOR, itype_i, uplo_i, n_i, a_i, lda_i, b_i, ldb_i ); failed = compare_chegst( a, a_i, info, info_i, lda, n ); if( failed == 0 ) { printf( "PASSED: column-major middle-level interface to chegst\n" ); } else { printf( "FAILED: column-major middle-level interface to chegst\n" ); } /* Initialize input data, call the column-major high-level * interface to LAPACK routine and check the results */ for( i = 0; i < lda*n; i++ ) { a_i[i] = a_save[i]; } for( i = 0; i < ldb*n; i++ ) { b_i[i] = b[i]; } info_i = LAPACKE_chegst( LAPACK_COL_MAJOR, itype_i, uplo_i, n_i, a_i, lda_i, b_i, ldb_i ); failed = compare_chegst( a, a_i, info, info_i, lda, n ); if( failed == 0 ) { printf( "PASSED: column-major high-level interface to chegst\n" ); } else { printf( "FAILED: column-major high-level interface to chegst\n" ); } /* Initialize input data, call the row-major middle-level * interface to LAPACK routine and check the results */ for( i = 0; i < lda*n; i++ ) { a_i[i] = a_save[i]; } for( i = 0; i < ldb*n; i++ ) { b_i[i] = b[i]; } LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 ); LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, b_i, ldb, b_r, n+2 ); info_i = LAPACKE_chegst_work( LAPACK_ROW_MAJOR, itype_i, uplo_i, n_i, a_r, lda_r, b_r, ldb_r ); LAPACKE_cge_trans( LAPACK_ROW_MAJOR, n, n, a_r, n+2, a_i, lda ); failed = compare_chegst( a, a_i, info, info_i, lda, n ); if( failed == 0 ) { printf( "PASSED: row-major middle-level interface to chegst\n" ); } else { printf( "FAILED: row-major middle-level interface to chegst\n" ); } /* Initialize input data, call the row-major high-level * interface to LAPACK routine and check the results */ for( i = 0; i < lda*n; i++ ) { a_i[i] = a_save[i]; } for( i = 0; i < ldb*n; i++ ) { b_i[i] = b[i]; } /* Init row_major arrays */ LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_i, lda, a_r, n+2 ); LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, b_i, ldb, b_r, n+2 ); info_i = LAPACKE_chegst( LAPACK_ROW_MAJOR, itype_i, uplo_i, n_i, a_r, lda_r, b_r, ldb_r ); LAPACKE_cge_trans( LAPACK_ROW_MAJOR, n, n, a_r, n+2, a_i, lda ); failed = compare_chegst( a, a_i, info, info_i, lda, n ); if( failed == 0 ) { printf( "PASSED: row-major high-level interface to chegst\n" ); } else { printf( "FAILED: row-major high-level interface to chegst\n" ); } /* Release memory */ if( a != NULL ) { LAPACKE_free( a ); } if( a_i != NULL ) { LAPACKE_free( a_i ); } if( a_r != NULL ) { LAPACKE_free( a_r ); } if( a_save != NULL ) { LAPACKE_free( a_save ); } if( b != NULL ) { LAPACKE_free( b ); } if( b_i != NULL ) { LAPACKE_free( b_i ); } if( b_r != NULL ) { LAPACKE_free( b_r ); } return 0; }