lapack_int LAPACKE_dgbrfs( int matrix_layout, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* ferr, double* berr ) { lapack_int info = 0; lapack_int* iwork = NULL; double* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgbrfs", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, ku, ab, ldab ) ) { return -7; } if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, kl+ku, afb, ldafb ) ) { return -9; } if( LAPACKE_dge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) { return -12; } if( LAPACKE_dge_nancheck( matrix_layout, n, nrhs, x, ldx ) ) { return -14; } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,3*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_dgbrfs_work( matrix_layout, trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgbrfs", info ); } return info; }
lapack_int LAPACKE_dgbcon( int matrix_layout, char norm, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, const lapack_int* ipiv, double anorm, double* rcond ) { lapack_int info = 0; lapack_int* iwork = NULL; double* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgbcon", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, kl+ku, ab, ldab ) ) { return -6; } if( LAPACKE_d_nancheck( 1, &anorm, 1 ) ) { return -9; } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,3*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_dgbcon_work( matrix_layout, norm, n, kl, ku, ab, ldab, ipiv, anorm, rcond, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgbcon", info ); } return info; }
lapack_int LAPACKE_dgbequ( int matrix_layout, lapack_int m, lapack_int n, lapack_int kl, lapack_int ku, const double* ab, lapack_int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgbequ", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK if( LAPACKE_get_nancheck() ) { /* Optionally check input matrices for NaNs */ if( LAPACKE_dgb_nancheck( matrix_layout, m, n, kl, ku, ab, ldab ) ) { return -6; } } #endif return LAPACKE_dgbequ_work( matrix_layout, m, n, kl, ku, ab, ldab, r, c, rowcnd, colcnd, amax ); }
lapack_logical LAPACKE_dtb_nancheck( int matrix_order, char uplo, char diag, lapack_int n, lapack_int kd, const double* ab, lapack_int ldab ) { lapack_logical colmaj, upper, unit; if( ab == NULL ) return (lapack_logical) 0; colmaj = ( matrix_order == LAPACK_COL_MAJOR ); upper = LAPACKE_lsame( uplo, 'u' ); unit = LAPACKE_lsame( diag, 'u' ); if( ( !colmaj && ( matrix_order != LAPACK_ROW_MAJOR ) ) || ( !upper && !LAPACKE_lsame( uplo, 'l' ) ) || ( !unit && !LAPACKE_lsame( diag, 'n' ) ) ) { /* Just exit if any of input parameters are wrong */ return (lapack_logical) 0; } if( unit ) { /* Unit case, diagonal should be excluded from the check for NaN. */ if( colmaj ) { if( upper ) { return LAPACKE_dgb_nancheck( matrix_order, n-1, n-1, 0, kd-1, &ab[ldab], ldab ); } else { return LAPACKE_dgb_nancheck( matrix_order, n-1, n-1, kd-1, 0, &ab[1], ldab ); } } else { if( upper ) { return LAPACKE_dgb_nancheck( matrix_order, n-1, n-1, 0, kd-1, &ab[1], ldab ); } else { return LAPACKE_dgb_nancheck( matrix_order, n-1, n-1, kd-1, 0, &ab[ldab], ldab ); } } } else { /* Non-unit case */ if( upper ) { return LAPACKE_dgb_nancheck( matrix_order, n, n, 0, kd, ab, ldab ); } else { return LAPACKE_dgb_nancheck( matrix_order, n, n, kd, 0, ab, ldab ); } } }
lapack_int LAPACKE_dgbsvx( int matrix_layout, char fact, char trans, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, double* ab, lapack_int ldab, double* afb, lapack_int ldafb, lapack_int* ipiv, char* equed, double* r, double* c, double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* ferr, double* berr, double* rpivot ) { lapack_int info = 0; lapack_int* iwork = NULL; double* work = NULL; if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgbsvx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, ku, ab, ldab ) ) { return -8; } if( LAPACKE_lsame( fact, 'f' ) ) { if( LAPACKE_dgb_nancheck( matrix_layout, n, n, kl, kl+ku, afb, ldafb ) ) { return -10; } } if( LAPACKE_dge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) { return -16; } if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) || LAPACKE_lsame( *equed, 'c' ) ) ) { if( LAPACKE_d_nancheck( n, c, 1 ) ) { return -15; } } if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) || LAPACKE_lsame( *equed, 'r' ) ) ) { if( LAPACKE_d_nancheck( n, r, 1 ) ) { return -14; } } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,3*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_dgbsvx_work( matrix_layout, fact, trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, equed, r, c, b, ldb, x, ldx, rcond, ferr, berr, work, iwork ); /* Backup significant data from working array(s) */ *rpivot = work[0]; /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgbsvx", info ); } return info; }
lapack_int LAPACKE_dgbrfsx( int matrix_order, char trans, char equed, lapack_int n, lapack_int kl, lapack_int ku, lapack_int nrhs, const double* ab, lapack_int ldab, const double* afb, lapack_int ldafb, const lapack_int* ipiv, const double* r, const double* c, const double* b, lapack_int ldb, double* x, lapack_int ldx, double* rcond, double* berr, lapack_int n_err_bnds, double* err_bnds_norm, double* err_bnds_comp, lapack_int nparams, double* params ) { lapack_int info = 0; lapack_int* iwork = NULL; double* work = NULL; if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dgbrfsx", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ if( LAPACKE_dgb_nancheck( matrix_order, n, n, kl, ku, ab, ldab ) ) { return -8; } if( LAPACKE_dgb_nancheck( matrix_order, n, n, kl, kl+ku, afb, ldafb ) ) { return -10; } if( LAPACKE_dge_nancheck( matrix_order, n, nrhs, b, ldb ) ) { return -15; } if( LAPACKE_lsame( equed, 'b' ) || LAPACKE_lsame( equed, 'c' ) ) { if( LAPACKE_d_nancheck( n, c, 1 ) ) { return -14; } } if( nparams>0 ) { if( LAPACKE_d_nancheck( nparams, params, 1 ) ) { return -25; } } if( LAPACKE_lsame( equed, 'b' ) || LAPACKE_lsame( equed, 'r' ) ) { if( LAPACKE_d_nancheck( n, r, 1 ) ) { return -13; } } if( LAPACKE_dge_nancheck( matrix_order, n, nrhs, x, ldx ) ) { return -17; } #endif /* Allocate memory for working array(s) */ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(1,n) ); if( iwork == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_0; } work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,4*n) ); if( work == NULL ) { info = LAPACK_WORK_MEMORY_ERROR; goto exit_level_1; } /* Call middle-level interface */ info = LAPACKE_dgbrfsx_work( matrix_order, trans, equed, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, r, c, b, ldb, x, ldx, rcond, berr, n_err_bnds, err_bnds_norm, err_bnds_comp, nparams, params, work, iwork ); /* Release memory and exit */ LAPACKE_free( work ); exit_level_1: LAPACKE_free( iwork ); exit_level_0: if( info == LAPACK_WORK_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dgbrfsx", info ); } return info; }
lapack_int LAPACKE_dlascl( int matrix_layout, char type, lapack_int kl, lapack_int ku, double cfrom, double cto, lapack_int m, lapack_int n, double* a, lapack_int lda ) { if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) { LAPACKE_xerbla( "LAPACKE_dlascl", -1 ); return -1; } #ifndef LAPACK_DISABLE_NAN_CHECK /* Optionally check input matrices for NaNs */ switch (type) { case 'G': if( LAPACKE_dge_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_dgb_nancheck( matrix_layout, m, n, m-1, 0, a, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_dgb_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_dgb_nancheck( matrix_layout, m, n, 0, n-1, a-n+1, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_dgb_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_dgb_nancheck( matrix_layout, m, n, 1, n-1, a-n+1, lda+1 ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_dgb_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_dsb_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_dsb_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_dgb_nancheck( matrix_layout, m, n, kl, ku, a+kl, lda ) ) { return -9; } if( matrix_layout == LAPACK_ROW_MAJOR && LAPACKE_dgb_nancheck( matrix_layout, m, n, kl, ku, a+lda*kl, lda ) ) { return -9; } break; } #endif return LAPACKE_dlascl_work( matrix_layout, type, kl, ku, cfrom, cto, m, n, a, lda ); }