lapack_int LAPACKE_zhbgst( int matrix_layout, char vect, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, const lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* x, lapack_int ldx ) { lapack_int info = 0; double* rwork = NULL; lapack_complex_double* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zhbgst", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zhb_nancheck( matrix_layout, uplo, n, ka, ab, ldab ) ) { return -7; } if( LAPACKE_zhb_nancheck( matrix_layout, uplo, n, kb, bb, ldbb ) ) { return -9; } #endif /* Allocate memory for working array(s) */ rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_zhbgst_work( matrix_layout, vect, uplo, n, ka, kb, ab, ldab, bb, ldbb, x, ldx, work, rwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( rwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhbgst", info ); } return info; }
lapack_int LAPACKE_zhbtrd( int matrix_layout, char vect, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* d, double* e, lapack_complex_double* q, lapack_int ldq ) { lapack_int info = 0; lapack_complex_double* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zhbtrd", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zhb_nancheck( matrix_layout, uplo, n, kd, ab, ldab ) ) { return -6; } if( LAPACKE_lsame( vect, 'u' ) || LAPACKE_lsame( vect, 'v' ) ) { if( LAPACKE_zge_nancheck( matrix_layout, n, n, q, ldq ) ) { return -10; } } #endif /* Allocate memory for working array(s) */ work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } /* Call middle-level interface */ info = LAPACKE_zhbtrd_work( matrix_layout, vect, uplo, n, kd, ab, ldab, d, e, q, ldq, work ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhbtrd", info ); } return info; }
lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl, lapack_int ku, double cfrom, double cto, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zlascl", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ switch (type) { case 'G': if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) { return -9; } break; case 'L': // TYPE = 'L' - lower triangle of general matrix if( matrix_layout == LAPACK_COL_MAJOR && LAPACKE_zgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, 0, m-1, a-m+1, lda+1 ) ) { return -9; } break; case 'U': // TYPE = 'U' - upper triangle of general matrix if( matrix_layout == LAPACK_COL_MAJOR && LAPACKE_zgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 0, a, lda+1 ) ) { return -9; } break; case 'H': // TYPE = 'H' - part of upper Hessenberg matrix in general matrix if( matrix_layout == LAPACK_COL_MAJOR && LAPACKE_zgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_zgb_nancheck( LAPACK_COL_MAJOR, n, m, n-1, 1, a-1, lda+1 ) ) { return -9; } case 'B': // TYPE = 'B' - lower part of symmetric band matrix (assume m==n) if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { return -9; } break; case 'Q': // TYPE = 'Q' - upper part of symmetric band matrix (assume m==n) if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) { return -9; } break; case 'Z': // TYPE = 'Z' - band matrix laid out for ?GBTRF if( matrix_layout == LAPACK_COL_MAJOR && LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_zgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) { return -9; } break; } } #endif return LAPACKE_zlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m, n, a, lda ); }
lapack_int LAPACKE_zhbgvx( int matrix_order, char jobz, char range, char uplo, lapack_int n, lapack_int ka, lapack_int kb, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* bb, lapack_int ldbb, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ) { lapack_int info = 0; lapack_int* iwork = NULL; double* rwork = NULL; lapack_complex_double* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zhbgvx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zhb_nancheck( matrix_order, uplo, n, ka, ab, ldab ) ) { return -8; } if( LAPACKE_d_nancheck( 1, &abstol, 1 ) ) { return -18; } if( LAPACKE_zhb_nancheck( matrix_order, uplo, n, kb, bb, ldbb ) ) { return -10; } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_d_nancheck( 1, &vl, 1 ) ) { return -14; } } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_d_nancheck( 1, &vu, 1 ) ) { return -15; } } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,5*n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,7*n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_2; } /* Call middle-level interface */ info = LAPACKE_zhbgvx_work( matrix_order, jobz, range, uplo, n, ka, kb, ab, ldab, bb, ldbb, q, ldq, vl, vu, il, iu, abstol, m, w, z, ldz, work, rwork, iwork, ifail ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_2: LAPACKE_free( rwork ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhbgvx", info ); } return info; }
lapack_int LAPACKE_zhbevd_2stage( int matrix_layout, char jobz, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, double* w, lapack_complex_double* z, lapack_int ldz ) { lapack_int info = 0; lapack_int liwork = -1; lapack_int lrwork = -1; lapack_int lwork = -1; lapack_int* iwork = NULL; double* rwork = NULL; lapack_complex_double* work = NULL; lapack_int iwork_query; double rwork_query; lapack_complex_double work_query; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zhbevd_2stage", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_zhb_nancheck( matrix_layout, uplo, n, kd, ab, ldab ) ) { return -6; } #endif /* Query optimal working array(s) size */ info = LAPACKE_zhbevd_2stage_work( matrix_layout, jobz, uplo, n, kd, ab, ldab, w, z, ldz, &work_query, lwork, &rwork_query, lrwork, &iwork_query, liwork ); if( info != 0 ) { goto exit_level_0; } liwork = (lapack_int)iwork_query; lrwork = (lapack_int)rwork_query; lwork = LAPACK_Z2INT( work_query ); /* Allocate memory for work arrays */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } rwork = (double*)LAPACKE_malloc( sizeof(double) * lrwork ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_2; } /* Call middle-level interface */ info = LAPACKE_zhbevd_2stage_work( matrix_layout, jobz, uplo, n, kd, ab, ldab, w, z, ldz, work, lwork, rwork, lrwork, iwork, liwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_2: LAPACKE_free( rwork ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhbevd_2stage", info ); } return info; }
lapack_int LAPACKE_zhbevx_2stage( int matrix_layout, char jobz, char range, char uplo, lapack_int n, lapack_int kd, lapack_complex_double* ab, lapack_int ldab, lapack_complex_double* q, lapack_int ldq, double vl, double vu, lapack_int il, lapack_int iu, double abstol, lapack_int* m, double* w, lapack_complex_double* z, lapack_int ldz, lapack_int* ifail ) { lapack_int info = 0; lapack_int lwork = -1; lapack_int* iwork = NULL; double* rwork = NULL; lapack_complex_double* work = NULL; lapack_complex_double work_query; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zhbevx_2stage", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_zhb_nancheck( matrix_layout, uplo, n, kd, ab, ldab ) ) { return -7; } if( LAPACKE_d_nancheck( 1, &abstol, 1 ) ) { return -15; } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_d_nancheck( 1, &vl, 1 ) ) { return -11; } } if( LAPACKE_lsame( range, 'v' ) ) { if( LAPACKE_d_nancheck( 1, &vu, 1 ) ) { return -12; } } } #endif /* Query optimal working array(s) size */ info = LAPACKE_zhbevx_2stage_work( matrix_layout, jobz, range, uplo, n, kd, ab, ldab, q, ldq, vl, vu, il, iu, abstol, m, w, z, ldz, &work_query, lwork, rwork, iwork, ifail ); if( info != 0 ) { goto exit_level_0; } lwork = LAPACK_Z2INT( work_query ); /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,5*n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } rwork = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,7*n) ); if( rwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } work = (lapack_complex_double*) LAPACKE_malloc( sizeof(lapack_complex_double) * lwork ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_2; } /* Call middle-level interface */ info = LAPACKE_zhbevx_2stage_work( matrix_layout, jobz, range, uplo, n, kd, ab, ldab, q, ldq, vl, vu, il, iu, abstol, m, w, z, ldz, work, lwork, rwork, iwork, ifail ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_2: LAPACKE_free( rwork ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_zhbevx_2stage", info ); } return info; }
lapack_int LAPACKE_zlascl( int matrix_layout, char type, lapack_int kl, lapack_int ku, double cfrom, double cto, lapack_int m, lapack_int n, lapack_complex_double* a, lapack_int lda ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_zlascl", -1 ); return -1; } #ifndef LAPACK_zISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ switch (type) { case 'G': if( LAPACKE_zge_nancheck( matrix_layout, lda, n, a, lda ) ) { return -9; } break; case 'L': // TYPE = 'L' - lower triangular matrix. if( LAPACKE_ztr_nancheck( matrix_layout, 'L', 'N', n, a, lda ) ) { return -9; } break; case 'U': // TYPE = 'U' - upper triangular matrix if( LAPACKE_ztr_nancheck( matrix_layout, 'U', 'N', n, a, lda ) ) { return -9; } break; case 'H': // TYPE = 'H' - upper Hessenberg matrix if( LAPACKE_zhs_nancheck( matrix_layout, n, a, lda ) ) { return -9; } break; case 'B': // TYPE = 'B' - A is a symmetric band matrix with lower bandwidth KL // and upper bandwidth KU and with the only the lower // half stored. if( LAPACKE_zhb_nancheck( matrix_layout, 'L', n, kl, a, lda ) ) { return -9; } break; case 'Q': // TYPE = 'Q' - A is a symmetric band matrix with lower bandwidth KL // and upper bandwidth KU and with the only the upper // half stored. if( LAPACKE_zhb_nancheck( matrix_layout, 'U', n, ku, a, lda ) ) { return -9; } break; case 'Z': // TYPE = 'Z' - A is a band matrix with lower bandwidth KL and upper // bandwidth KU. See DGBTRF for storage details. if( LAPACKE_zgb_nancheck( matrix_layout, n, n, kl, kl+ku, a, lda ) ) { return -6; } break; } #endif return LAPACKE_zlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m, n, a, lda ); }