lapack_int LAPACKE_dtptrs_work( int matrix_order, char uplo, char trans, char diag, lapack_int n, lapack_int nrhs, const double* ap, double* b, lapack_int ldb ) { lapack_int info = 0; if( matrix_order == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_dtptrs( &uplo, &trans, &diag, &n, &nrhs, ap, b, &ldb, &info ); if( info < 0 ) { info = info - 1; } } else if( matrix_order == LAPACK_ROW_MAJOR ) { lapack_int ldb_t = MAX(1,n); double* b_t = NULL; double* ap_t = NULL; /* Check leading dimension(s) */ if( ldb < nrhs ) { info = -9; LAPACKE_xerbla( "LAPACKE_dtptrs_work", info ); return info; } /* Allocate memory for temporary array(s) */ b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) ); if( b_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } ap_t = (double*) LAPACKE_malloc( sizeof(double) * ( MAX(1,n) * MAX(2,n+1) ) / 2 ); if( ap_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_1; } /* Transpose input matrices */ LAPACKE_dge_trans( matrix_order, n, nrhs, b, ldb, b_t, ldb_t ); LAPACKE_dtp_trans( matrix_order, uplo, diag, n, ap, ap_t ); /* Call LAPACK function and adjust info */ LAPACK_dtptrs( &uplo, &trans, &diag, &n, &nrhs, ap_t, b_t, &ldb_t, &info ); if( info < 0 ) { info = info - 1; } /* Transpose output matrices */ LAPACKE_dge_trans( LAPACK_COL_MAJOR, n, nrhs, b_t, ldb_t, b, ldb ); /* Release memory and exit */ LAPACKE_free( ap_t ); exit_level_1: LAPACKE_free( b_t ); exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dtptrs_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_dtptrs_work", info ); } return info; }
lapack_int LAPACKE_dtptri_work( int matrix_order, char uplo, char diag, lapack_int n, double* ap ) { lapack_int info = 0; if( matrix_order == LAPACK_COL_MAJOR ) { /* Call LAPACK function and adjust info */ LAPACK_dtptri( &uplo, &diag, &n, ap, &info ); if( info < 0 ) { info = info - 1; } } else if( matrix_order == LAPACK_ROW_MAJOR ) { double* ap_t = NULL; /* Allocate memory for temporary array(s) */ ap_t = (double*) LAPACKE_malloc( sizeof(double) * ( MAX(1,n) * MAX(2,n+1) ) / 2 ); if( ap_t == NULL ) { info = LAPACK_TRANSPOSE_MEMORY_ERROR; goto exit_level_0; } /* Transpose input matrices */ LAPACKE_dtp_trans( matrix_order, uplo, diag, n, ap, ap_t ); /* Call LAPACK function and adjust info */ LAPACK_dtptri( &uplo, &diag, &n, ap_t, &info ); if( info < 0 ) { info = info - 1; } /* Transpose output matrices */ LAPACKE_dtp_trans( LAPACK_COL_MAJOR, uplo, diag, n, ap_t, ap ); /* Release memory and exit */ LAPACKE_free( ap_t ); exit_level_0: if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) { LAPACKE_xerbla( "LAPACKE_dtptri_work", info ); } } else { info = -1; LAPACKE_xerbla( "LAPACKE_dtptri_work", info ); } return info; }
void LAPACKE_dsp_trans( int matrix_order, char uplo, lapack_int n, const double *in, double *out ) { LAPACKE_dtp_trans( matrix_order, uplo, 'n', n, in, out ); }