本文整理汇总了C++中LAPACKE_malloc函数的典型用法代码示例。如果您正苦于以下问题:C++ LAPACKE_malloc函数的具体用法?C++ LAPACKE_malloc怎么用?C++ LAPACKE_malloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LAPACKE_malloc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LAPACKE_sgges_work
lapack_int LAPACKE_sgges_work( int matrix_order, char jobvsl, char jobvsr,
char sort, LAPACK_S_SELECT3 selctg, lapack_int n,
float* a, lapack_int lda, float* b,
lapack_int ldb, lapack_int* sdim, float* alphar,
float* alphai, float* beta, float* vsl,
lapack_int ldvsl, float* vsr, lapack_int ldvsr,
float* work, lapack_int lwork,
lapack_logical* bwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_sgges( &jobvsl, &jobvsr, &sort, selctg, &n, a, &lda, b, &ldb,
sdim, alphar, alphai, beta, vsl, &ldvsl, vsr, &ldvsr,
work, &lwork, bwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldb_t = MAX(1,n);
lapack_int ldvsl_t = MAX(1,n);
lapack_int ldvsr_t = MAX(1,n);
float* a_t = NULL;
float* b_t = NULL;
float* vsl_t = NULL;
float* vsr_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_sgges_work", info );
return info;
}
if( ldb < n ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_sgges_work", info );
return info;
}
if( ldvsl < n ) {
info = -16;
LAPACKE_xerbla( "LAPACKE_sgges_work", info );
return info;
}
if( ldvsr < n ) {
info = -18;
LAPACKE_xerbla( "LAPACKE_sgges_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_sgges( &jobvsl, &jobvsr, &sort, selctg, &n, a, &lda_t, b,
&ldb_t, sdim, alphar, alphai, beta, vsl, &ldvsl_t,
vsr, &ldvsr_t, work, &lwork, bwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
b_t = (float*)LAPACKE_malloc( sizeof(float) * ldb_t * MAX(1,n) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
if( LAPACKE_lsame( jobvsl, 'v' ) ) {
vsl_t = (float*)
LAPACKE_malloc( sizeof(float) * ldvsl_t * MAX(1,n) );
if( vsl_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
}
if( LAPACKE_lsame( jobvsr, 'v' ) ) {
vsr_t = (float*)
LAPACKE_malloc( sizeof(float) * ldvsr_t * MAX(1,n) );
if( vsr_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
}
/* Transpose input matrices */
LAPACKE_sge_trans( matrix_order, n, n, a, lda, a_t, lda_t );
LAPACKE_sge_trans( matrix_order, n, n, b, ldb, b_t, ldb_t );
/* Call LAPACK function and adjust info */
LAPACK_sgges( &jobvsl, &jobvsr, &sort, selctg, &n, a_t, &lda_t, b_t,
&ldb_t, sdim, alphar, alphai, beta, vsl_t, &ldvsl_t,
vsr_t, &ldvsr_t, work, &lwork, bwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
if( LAPACKE_lsame( jobvsl, 'v' ) ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, vsl_t, ldvsl_t, vsl,
ldvsl );
}
if( LAPACKE_lsame( jobvsr, 'v' ) ) {
//.........这里部分代码省略.........
示例2: LAPACKE_zgtsvx
lapack_int LAPACKE_zgtsvx( int matrix_layout, char fact, char trans,
lapack_int n, lapack_int nrhs,
const lapack_complex_double* dl,
const lapack_complex_double* d,
const lapack_complex_double* du,
lapack_complex_double* dlf,
lapack_complex_double* df,
lapack_complex_double* duf,
lapack_complex_double* du2, lapack_int* ipiv,
const lapack_complex_double* b, lapack_int ldb,
lapack_complex_double* x, lapack_int ldx,
double* rcond, double* ferr, double* berr )
{
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_zgtsvx", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_zge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
return -14;
}
if( LAPACKE_z_nancheck( n, d, 1 ) ) {
return -7;
}
if( LAPACKE_lsame( fact, 'f' ) ) {
if( LAPACKE_z_nancheck( n, df, 1 ) ) {
return -10;
}
}
if( LAPACKE_z_nancheck( n-1, dl, 1 ) ) {
return -6;
}
if( LAPACKE_lsame( fact, 'f' ) ) {
if( LAPACKE_z_nancheck( n-1, dlf, 1 ) ) {
return -9;
}
}
if( LAPACKE_z_nancheck( n-1, du, 1 ) ) {
return -8;
}
if( LAPACKE_lsame( fact, 'f' ) ) {
if( LAPACKE_z_nancheck( n-2, du2, 1 ) ) {
return -12;
}
}
if( LAPACKE_lsame( fact, 'f' ) ) {
if( LAPACKE_z_nancheck( n-1, duf, 1 ) ) {
return -11;
}
}
#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,2*n) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_zgtsvx_work( matrix_layout, fact, trans, n, nrhs, dl, d, du,
dlf, df, duf, du2, ipiv, b, ldb, x, ldx, rcond,
ferr, berr, 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_zgtsvx", info );
}
return info;
}
示例3: LAPACKE_ztpqrt2_work
lapack_int LAPACKE_ztpqrt2_work( int matrix_order, lapack_int m, lapack_int n,
lapack_complex_double* a, lapack_int lda,
lapack_complex_double* b, lapack_int ldb,
lapack_complex_double* t, lapack_int ldt )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_ztpqrt2( &m, &n, a, &lda, b, &ldb, t, &ldt, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldb_t = MAX(1,m);
lapack_int ldt_t = MAX(1,n);
lapack_complex_double* a_t = NULL;
lapack_complex_double* b_t = NULL;
lapack_complex_double* t_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -5;
LAPACKE_xerbla( "LAPACKE_ztpqrt2_work", info );
return info;
}
if( ldb < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_ztpqrt2_work", info );
return info;
}
if( ldt < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_ztpqrt2_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
b_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * ldb_t * MAX(1,n) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
t_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * ldt_t * MAX(1,n) );
if( t_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
/* Transpose input matrices */
LAPACKE_zge_trans( matrix_order, n, n, a, lda, a_t, lda_t );
LAPACKE_zge_trans( matrix_order, m, n, b, ldb, b_t, ldb_t );
/* Call LAPACK function and adjust info */
LAPACK_ztpqrt2( &m, &n, a_t, &lda_t, b_t, &ldb_t, t_t, &ldt_t, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, t_t, ldt_t, t, ldt );
/* Release memory and exit */
LAPACKE_free( t_t );
exit_level_2:
LAPACKE_free( b_t );
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ztpqrt2_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_ztpqrt2_work", info );
}
return info;
}
示例4: LAPACKE_zhbevx_2stage
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;
}
示例5: LAPACKE_shseqr_work
lapack_int LAPACKE_shseqr_work( int matrix_order, char job, char compz,
lapack_int n, lapack_int ilo, lapack_int ihi,
float* h, lapack_int ldh, float* wr, float* wi,
float* z, lapack_int ldz, float* work,
lapack_int lwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_shseqr( &job, &compz, &n, &ilo, &ihi, h, &ldh, wr, wi, z, &ldz,
work, &lwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int ldh_t = MAX(1,n);
lapack_int ldz_t = MAX(1,n);
float* h_t = NULL;
float* z_t = NULL;
/* Check leading dimension(s) */
if( ldh < n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_shseqr_work", info );
return info;
}
if( ldz < n ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_shseqr_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_shseqr( &job, &compz, &n, &ilo, &ihi, h, &ldh_t, wr, wi, z,
&ldz_t, work, &lwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
h_t = (float*)LAPACKE_malloc( sizeof(float) * ldh_t * MAX(1,n) );
if( h_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
z_t = (float*)LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,n) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
LAPACKE_sge_trans( matrix_order, n, n, h, ldh, h_t, ldh_t );
if( LAPACKE_lsame( compz, 'v' ) ) {
LAPACKE_sge_trans( matrix_order, n, n, z, ldz, z_t, ldz_t );
}
/* Call LAPACK function and adjust info */
LAPACK_shseqr( &job, &compz, &n, &ilo, &ihi, h_t, &ldh_t, wr, wi, z_t,
&ldz_t, work, &lwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, h_t, ldh_t, h, ldh );
if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
}
/* Release memory and exit */
if( LAPACKE_lsame( compz, 'i' ) || LAPACKE_lsame( compz, 'v' ) ) {
LAPACKE_free( z_t );
}
exit_level_1:
LAPACKE_free( h_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_shseqr_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_shseqr_work", info );
}
return info;
}
示例6: LAPACKE_cgees_work
lapack_int LAPACKE_cgees_work( int matrix_layout, char jobvs, char sort,
LAPACK_C_SELECT1 select, lapack_int n,
lapack_complex_float* a, lapack_int lda,
lapack_int* sdim, lapack_complex_float* w,
lapack_complex_float* vs, lapack_int ldvs,
lapack_complex_float* work, lapack_int lwork,
float* rwork, lapack_logical* bwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_cgees( &jobvs, &sort, select, &n, a, &lda, sdim, w, vs, &ldvs,
work, &lwork, rwork, bwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldvs_t = MAX(1,n);
lapack_complex_float* a_t = NULL;
lapack_complex_float* vs_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_cgees_work", info );
return info;
}
if( ldvs < n ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_cgees_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_cgees( &jobvs, &sort, select, &n, a, &lda_t, sdim, w, vs,
&ldvs_t, work, &lwork, rwork, bwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
if( LAPACKE_lsame( jobvs, 'v' ) ) {
vs_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldvs_t * MAX(1,n) );
if( vs_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
LAPACKE_cge_trans( matrix_layout, n, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
LAPACK_cgees( &jobvs, &sort, select, &n, a_t, &lda_t, sdim, w, vs_t,
&ldvs_t, work, &lwork, rwork, bwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
if( LAPACKE_lsame( jobvs, 'v' ) ) {
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, vs_t, ldvs_t, vs, ldvs );
}
/* Release memory and exit */
if( LAPACKE_lsame( jobvs, 'v' ) ) {
LAPACKE_free( vs_t );
}
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_cgees_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_cgees_work", info );
}
return info;
}
示例7: LAPACKE_ssyevr_work
lapack_int LAPACKE_ssyevr_work( int matrix_layout, char jobz, char range,
char uplo, lapack_int n, float* a,
lapack_int lda, float vl, float vu,
lapack_int il, lapack_int iu, float abstol,
lapack_int* m, float* w, float* z,
lapack_int ldz, lapack_int* isuppz, float* work,
lapack_int lwork, lapack_int* iwork,
lapack_int liwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_ssyevr( &jobz, &range, &uplo, &n, a, &lda, &vl, &vu, &il, &iu,
&abstol, m, w, z, &ldz, isuppz, work, &lwork, iwork,
&liwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int ncols_z = ( LAPACKE_lsame( range, 'a' ) ||
LAPACKE_lsame( range, 'v' ) ) ? n :
( LAPACKE_lsame( range, 'i' ) ? (iu-il+1) : 1);
lapack_int lda_t = MAX(1,n);
lapack_int ldz_t = MAX(1,n);
float* a_t = NULL;
float* z_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_ssyevr_work", info );
return info;
}
if( ldz < ncols_z ) {
info = -16;
LAPACKE_xerbla( "LAPACKE_ssyevr_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( liwork == -1 || lwork == -1 ) {
LAPACK_ssyevr( &jobz, &range, &uplo, &n, a, &lda_t, &vl, &vu, &il,
&iu, &abstol, m, w, z, &ldz_t, isuppz, work, &lwork,
iwork, &liwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
if( LAPACKE_lsame( jobz, 'v' ) ) {
z_t = (float*)
LAPACKE_malloc( sizeof(float) * ldz_t * MAX(1,ncols_z) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
LAPACKE_ssy_trans( matrix_layout, uplo, n, a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
LAPACK_ssyevr( &jobz, &range, &uplo, &n, a_t, &lda_t, &vl, &vu, &il,
&iu, &abstol, m, w, z_t, &ldz_t, isuppz, work, &lwork,
iwork, &liwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_ssy_trans( LAPACK_COL_MAJOR, uplo, n, a_t, lda_t, a, lda );
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, ncols_z, z_t, ldz_t, z,
ldz );
}
/* Release memory and exit */
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_free( z_t );
}
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ssyevr_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_ssyevr_work", info );
}
return info;
}
示例8: LAPACKE_cgerfsx_work
lapack_int LAPACKE_cgerfsx_work( int matrix_order, char trans, char equed,
lapack_int n, lapack_int nrhs,
const lapack_complex_float* a, lapack_int lda,
const lapack_complex_float* af,
lapack_int ldaf, const lapack_int* ipiv,
const float* r, const float* c,
const lapack_complex_float* b, lapack_int ldb,
lapack_complex_float* x, lapack_int ldx,
float* rcond, float* berr,
lapack_int n_err_bnds, float* err_bnds_norm,
float* err_bnds_comp, lapack_int nparams,
float* params, lapack_complex_float* work,
float* rwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_cgerfsx( &trans, &equed, &n, &nrhs, a, &lda, af, &ldaf, ipiv, r,
c, b, &ldb, x, &ldx, rcond, berr, &n_err_bnds,
err_bnds_norm, err_bnds_comp, &nparams, params, work,
rwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldaf_t = MAX(1,n);
lapack_int ldb_t = MAX(1,n);
lapack_int ldx_t = MAX(1,n);
lapack_complex_float* a_t = NULL;
lapack_complex_float* af_t = NULL;
lapack_complex_float* b_t = NULL;
lapack_complex_float* x_t = NULL;
float* err_bnds_norm_t = NULL;
float* err_bnds_comp_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_cgerfsx_work", info );
return info;
}
if( ldaf < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_cgerfsx_work", info );
return info;
}
if( ldb < nrhs ) {
info = -14;
LAPACKE_xerbla( "LAPACKE_cgerfsx_work", info );
return info;
}
if( ldx < nrhs ) {
info = -16;
LAPACKE_xerbla( "LAPACKE_cgerfsx_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
af_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * ldaf_t * MAX(1,n) );
if( af_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
b_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldb_t * MAX(1,nrhs) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
x_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldx_t * MAX(1,nrhs) );
if( x_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
err_bnds_norm_t = (float*)
LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
if( err_bnds_norm_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_4;
}
err_bnds_comp_t = (float*)
LAPACKE_malloc( sizeof(float) * nrhs * MAX(1,n_err_bnds) );
if( err_bnds_comp_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_5;
}
/* Transpose input matrices */
LAPACKE_cge_trans( matrix_order, n, n, a, lda, a_t, lda_t );
LAPACKE_cge_trans( matrix_order, n, n, af, ldaf, af_t, ldaf_t );
LAPACKE_cge_trans( matrix_order, n, nrhs, b, ldb, b_t, ldb_t );
LAPACKE_cge_trans( matrix_order, n, nrhs, x, ldx, x_t, ldx_t );
//.........这里部分代码省略.........
示例9: LAPACKE_cggbal_work
lapack_int LAPACKE_cggbal_work( int matrix_order, char job, lapack_int n,
lapack_complex_float* a, lapack_int lda,
lapack_complex_float* b, lapack_int ldb,
lapack_int* ilo, lapack_int* ihi, float* lscale,
float* rscale, float* work )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_cggbal( &job, &n, a, &lda, b, &ldb, ilo, ihi, lscale, rscale,
work, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldb_t = MAX(1,n);
lapack_complex_float* a_t = NULL;
lapack_complex_float* b_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -5;
LAPACKE_xerbla( "LAPACKE_cggbal_work", info );
return info;
}
if( ldb < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_cggbal_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
a_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
}
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
b_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldb_t * MAX(1,n) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_cge_trans( matrix_order, n, n, a, lda, a_t, lda_t );
}
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_cge_trans( matrix_order, n, n, b, ldb, b_t, ldb_t );
}
/* Call LAPACK function and adjust info */
LAPACK_cggbal( &job, &n, a_t, &lda_t, b_t, &ldb_t, ilo, ihi, lscale,
rscale, work, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
}
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, b_t, ldb_t, b, ldb );
}
/* Release memory and exit */
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_free( b_t );
}
exit_level_1:
if( LAPACKE_lsame( job, 'p' ) || LAPACKE_lsame( job, 's' ) ||
LAPACKE_lsame( job, 'b' ) ) {
LAPACKE_free( a_t );
}
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_cggbal_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_cggbal_work", info );
}
return info;
}
示例10: LAPACKE_dtprfb_work
lapack_int LAPACKE_dtprfb_work( int matrix_order, char side, char trans,
char direct, char storev, lapack_int m,
lapack_int n, lapack_int k, lapack_int l,
const double* v, lapack_int ldv,
const double* t, lapack_int ldt, double* a,
lapack_int lda, double* b, lapack_int ldb,
const double* mywork, lapack_int myldwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_dtprfb( &side, &trans, &direct, &storev, &m, &n, &k, &l, v, &ldv,
t, &ldt, a, &lda, b, &ldb, mywork, &myldwork );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int r = LAPACKE_lsame( side, 'r' ) ? k : k;
lapack_int lda_t = MAX(1,k);
lapack_int ldb_t = MAX(1,m);
lapack_int ldt_t = MAX(1,ldt);
lapack_int ldv_t = MAX(1,ldv);
double* v_t = NULL;
double* t_t = NULL;
double* a_t = NULL;
double* b_t = NULL;
/* Check leading dimension(s) */
if( lda < m ) {
info = -15;
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
return info;
}
if( ldb < n ) {
info = -17;
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
return info;
}
if( ldt < k ) {
info = -13;
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
return info;
}
if( ldv < k ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
v_t = (double*)LAPACKE_malloc( sizeof(double) * ldv_t * MAX(1,k) );
if( v_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,k) );
if( t_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,m) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,n) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
/* Transpose input matrices */
LAPACKE_dge_trans( matrix_order, ldv, k, v, ldv, v_t, ldv_t );
LAPACKE_dge_trans( matrix_order, ldt, k, t, ldt, t_t, ldt_t );
LAPACKE_dge_trans( matrix_order, k, m, a, lda, a_t, lda_t );
LAPACKE_dge_trans( matrix_order, m, n, b, ldb, b_t, ldb_t );
/* Call LAPACK function and adjust info */
LAPACK_dtprfb( &side, &trans, &direct, &storev, &m, &n, &k, &l, v_t,
&ldv_t, t_t, &ldt_t, a_t, &lda_t, b_t, &ldb_t, mywork,
&myldwork );
info = 0; /* LAPACK call is ok! */
/* Transpose output matrices */
LAPACKE_dge_trans( LAPACK_COL_MAJOR, k, m, a_t, lda_t, a, lda );
LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, b_t, ldb_t, b, ldb );
/* Release memory and exit */
LAPACKE_free( b_t );
exit_level_3:
LAPACKE_free( a_t );
exit_level_2:
LAPACKE_free( t_t );
exit_level_1:
LAPACKE_free( v_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_dtprfb_work", info );
}
return info;
}
示例11: LAPACKE_zunbdb_work
lapack_int LAPACKE_zunbdb_work( int matrix_layout, char trans, char signs,
lapack_int m, lapack_int p, lapack_int q,
lapack_complex_double* x11, lapack_int ldx11,
lapack_complex_double* x12, lapack_int ldx12,
lapack_complex_double* x21, lapack_int ldx21,
lapack_complex_double* x22, lapack_int ldx22,
double* theta, double* phi,
lapack_complex_double* taup1,
lapack_complex_double* taup2,
lapack_complex_double* tauq1,
lapack_complex_double* tauq2,
lapack_complex_double* work, lapack_int lwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zunbdb( &trans, &signs, &m, &p, &q, x11, &ldx11, x12, &ldx12,
x21, &ldx21, x22, &ldx22, theta, phi, taup1, taup2,
tauq1, tauq2, work, &lwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int nrows_x11 = ( LAPACKE_lsame( trans, 'n' ) ? p : q);
lapack_int nrows_x12 = ( LAPACKE_lsame( trans, 'n' ) ? p : m-q);
lapack_int nrows_x21 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : q);
lapack_int nrows_x22 = ( LAPACKE_lsame( trans, 'n' ) ? m-p : m-q);
lapack_int ldx11_t = MAX(1,nrows_x11);
lapack_int ldx12_t = MAX(1,nrows_x12);
lapack_int ldx21_t = MAX(1,nrows_x21);
lapack_int ldx22_t = MAX(1,nrows_x22);
lapack_complex_double* x11_t = NULL;
lapack_complex_double* x12_t = NULL;
lapack_complex_double* x21_t = NULL;
lapack_complex_double* x22_t = NULL;
/* Check leading dimension(s) */
if( ldx11 < q ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_zunbdb_work", info );
return info;
}
if( ldx12 < m-q ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_zunbdb_work", info );
return info;
}
if( ldx21 < q ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_zunbdb_work", info );
return info;
}
if( ldx22 < m-q ) {
info = -14;
LAPACKE_xerbla( "LAPACKE_zunbdb_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_zunbdb( &trans, &signs, &m, &p, &q, x11, &ldx11_t, x12,
&ldx12_t, x21, &ldx21_t, x22, &ldx22_t, theta, phi,
taup1, taup2, tauq1, tauq2, work, &lwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
x11_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldx11_t * MAX(1,q) );
if( x11_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
x12_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldx12_t * MAX(1,m-q) );
if( x12_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
x21_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldx21_t * MAX(1,q) );
if( x21_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
x22_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldx22_t * MAX(1,m-q) );
if( x22_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
/* Transpose input matrices */
LAPACKE_zge_trans( matrix_layout, nrows_x11, q, x11, ldx11, x11_t,
ldx11_t );
LAPACKE_zge_trans( matrix_layout, nrows_x12, m-q, x12, ldx12, x12_t,
ldx12_t );
LAPACKE_zge_trans( matrix_layout, nrows_x21, q, x21, ldx21, x21_t,
ldx21_t );
LAPACKE_zge_trans( matrix_layout, nrows_x22, m-q, x22, ldx22, x22_t,
//.........这里部分代码省略.........
示例12: LAPACKE_dtrrfs_work
lapack_int LAPACKE_dtrrfs_work( int matrix_layout, char uplo, char trans,
char diag, lapack_int n, lapack_int nrhs,
const double* a, lapack_int lda,
const double* b, lapack_int ldb,
const double* x, lapack_int ldx, double* ferr,
double* berr, double* work, lapack_int* iwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_dtrrfs( &uplo, &trans, &diag, &n, &nrhs, a, &lda, b, &ldb, x,
&ldx, ferr, berr, work, iwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldb_t = MAX(1,n);
lapack_int ldx_t = MAX(1,n);
double* a_t = NULL;
double* b_t = NULL;
double* x_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_dtrrfs_work", info );
return info;
}
if( ldb < nrhs ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_dtrrfs_work", info );
return info;
}
if( ldx < nrhs ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_dtrrfs_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
b_t = (double*)LAPACKE_malloc( sizeof(double) * ldb_t * MAX(1,nrhs) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
x_t = (double*)LAPACKE_malloc( sizeof(double) * ldx_t * MAX(1,nrhs) );
if( x_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
/* Transpose input matrices */
LAPACKE_dtr_trans( matrix_layout, uplo, diag, n, a, lda, a_t, lda_t );
LAPACKE_dge_trans( matrix_layout, n, nrhs, b, ldb, b_t, ldb_t );
LAPACKE_dge_trans( matrix_layout, n, nrhs, x, ldx, x_t, ldx_t );
/* Call LAPACK function and adjust info */
LAPACK_dtrrfs( &uplo, &trans, &diag, &n, &nrhs, a_t, &lda_t, b_t,
&ldb_t, x_t, &ldx_t, ferr, berr, work, iwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Release memory and exit */
LAPACKE_free( x_t );
exit_level_2:
LAPACKE_free( b_t );
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dtrrfs_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_dtrrfs_work", info );
}
return info;
}
示例13: LAPACKE_csprfs_work
lapack_int LAPACKE_csprfs_work( int matrix_order, char uplo, lapack_int n,
lapack_int nrhs, const lapack_complex_float* ap,
const lapack_complex_float* afp,
const lapack_int* ipiv,
const lapack_complex_float* b, lapack_int ldb,
lapack_complex_float* x, lapack_int ldx,
float* ferr, float* berr,
lapack_complex_float* work, float* rwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_csprfs( &uplo, &n, &nrhs, ap, afp, ipiv, b, &ldb, x, &ldx, ferr,
berr, work, rwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int ldb_t = MAX(1,n);
lapack_int ldx_t = MAX(1,n);
lapack_complex_float* b_t = NULL;
lapack_complex_float* x_t = NULL;
lapack_complex_float* ap_t = NULL;
lapack_complex_float* afp_t = NULL;
/* Check leading dimension(s) */
if( ldb < nrhs ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_csprfs_work", info );
return info;
}
if( ldx < nrhs ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_csprfs_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
b_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldb_t * MAX(1,nrhs) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
x_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldx_t * MAX(1,nrhs) );
if( x_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
ap_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
( MAX(1,n) * MAX(2,n+1) ) / 2 );
if( ap_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
afp_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
( MAX(1,n) * MAX(2,n+1) ) / 2 );
if( afp_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
/* Transpose input matrices */
LAPACKE_cge_trans( matrix_order, n, nrhs, b, ldb, b_t, ldb_t );
LAPACKE_cge_trans( matrix_order, n, nrhs, x, ldx, x_t, ldx_t );
LAPACKE_csp_trans( matrix_order, uplo, n, ap, ap_t );
LAPACKE_csp_trans( matrix_order, uplo, n, afp, afp_t );
/* Call LAPACK function and adjust info */
LAPACK_csprfs( &uplo, &n, &nrhs, ap_t, afp_t, ipiv, b_t, &ldb_t, x_t,
&ldx_t, ferr, berr, work, rwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, nrhs, x_t, ldx_t, x, ldx );
/* Release memory and exit */
LAPACKE_free( afp_t );
exit_level_3:
LAPACKE_free( ap_t );
exit_level_2:
LAPACKE_free( x_t );
exit_level_1:
LAPACKE_free( b_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_csprfs_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_csprfs_work", info );
}
return info;
}
示例14: LAPACKE_chbgvx_work
lapack_int LAPACKE_chbgvx_work( int matrix_order, char jobz, char range,
char uplo, lapack_int n, lapack_int ka,
lapack_int kb, lapack_complex_float* ab,
lapack_int ldab, lapack_complex_float* bb,
lapack_int ldbb, lapack_complex_float* q,
lapack_int ldq, float vl, float vu,
lapack_int il, lapack_int iu, float abstol,
lapack_int* m, float* w,
lapack_complex_float* z, lapack_int ldz,
lapack_complex_float* work, float* rwork,
lapack_int* iwork, lapack_int* ifail )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_chbgvx( &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, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int ldab_t = MAX(1,ka+1);
lapack_int ldbb_t = MAX(1,kb+1);
lapack_int ldq_t = MAX(1,n);
lapack_int ldz_t = MAX(1,n);
lapack_complex_float* ab_t = NULL;
lapack_complex_float* bb_t = NULL;
lapack_complex_float* q_t = NULL;
lapack_complex_float* z_t = NULL;
/* Check leading dimension(s) */
if( ldab < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_chbgvx_work", info );
return info;
}
if( ldbb < n ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_chbgvx_work", info );
return info;
}
if( ldq < n ) {
info = -13;
LAPACKE_xerbla( "LAPACKE_chbgvx_work", info );
return info;
}
if( ldz < n ) {
info = -22;
LAPACKE_xerbla( "LAPACKE_chbgvx_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
ab_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * ldab_t * MAX(1,n) );
if( ab_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
bb_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * ldbb_t * MAX(1,n) );
if( bb_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
if( LAPACKE_lsame( jobz, 'v' ) ) {
q_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldq_t * MAX(1,n) );
if( q_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
}
if( LAPACKE_lsame( jobz, 'v' ) ) {
z_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) *
ldz_t * MAX(1,n) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
}
/* Transpose input matrices */
LAPACKE_chb_trans( matrix_order, uplo, n, ka, ab, ldab, ab_t, ldab_t );
LAPACKE_chb_trans( matrix_order, uplo, n, kb, bb, ldbb, bb_t, ldbb_t );
/* Call LAPACK function and adjust info */
LAPACK_chbgvx( &jobz, &range, &uplo, &n, &ka, &kb, ab_t, &ldab_t, bb_t,
&ldbb_t, q_t, &ldq_t, &vl, &vu, &il, &iu, &abstol, m, w,
z_t, &ldz_t, work, rwork, iwork, ifail, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_chb_trans( LAPACK_COL_MAJOR, uplo, n, ka, ab_t, ldab_t, ab,
ldab );
LAPACKE_chb_trans( LAPACK_COL_MAJOR, uplo, n, kb, bb_t, ldbb_t, bb,
ldbb );
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_cge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
}
//.........这里部分代码省略.........
示例15: LAPACKE_cgbsvxx
lapack_int LAPACKE_cgbsvxx( int matrix_layout, char fact, char trans,
lapack_int n, lapack_int kl, lapack_int ku,
lapack_int nrhs, lapack_complex_float* ab,
lapack_int ldab, lapack_complex_float* afb,
lapack_int ldafb, lapack_int* ipiv, char* equed,
float* r, float* c, lapack_complex_float* b,
lapack_int ldb, lapack_complex_float* x,
lapack_int ldx, float* rcond, float* rpvgrw,
float* berr, lapack_int n_err_bnds,
float* err_bnds_norm, float* err_bnds_comp,
lapack_int nparams, float* params )
{
lapack_int info = 0;
float* rwork = NULL;
lapack_complex_float* work = NULL;
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_cgbsvxx", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_cgb_nancheck( matrix_layout, n, n, kl, ku, ab, ldab ) ) {
return -8;
}
if( LAPACKE_lsame( fact, 'f' ) ) {
if( LAPACKE_cgb_nancheck( matrix_layout, n, n, kl, kl+ku, afb,
ldafb ) ) {
return -10;
}
}
if( LAPACKE_cge_nancheck( matrix_layout, n, nrhs, b, ldb ) ) {
return -16;
}
if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
LAPACKE_lsame( *equed, 'c' ) ) ) {
if( LAPACKE_s_nancheck( n, c, 1 ) ) {
return -15;
}
}
if( nparams>0 ) {
if( LAPACKE_s_nancheck( nparams, params, 1 ) ) {
return -27;
}
}
if( LAPACKE_lsame( fact, 'f' ) && ( LAPACKE_lsame( *equed, 'b' ) ||
LAPACKE_lsame( *equed, 'r' ) ) ) {
if( LAPACKE_s_nancheck( n, r, 1 ) ) {
return -14;
}
}
#endif
/* Allocate memory for working array(s) */
rwork = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,3*n) );
if( rwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
work = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,2*n) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_cgbsvxx_work( matrix_layout, fact, trans, n, kl, ku, nrhs, ab,
ldab, afb, ldafb, ipiv, equed, r, c, b, ldb, x,
ldx, rcond, rpvgrw, berr, n_err_bnds,
err_bnds_norm, err_bnds_comp, nparams, params,
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_cgbsvxx", info );
}
return info;
}