本文整理汇总了C++中LAPACKE_lsame函数的典型用法代码示例。如果您正苦于以下问题:C++ LAPACKE_lsame函数的具体用法?C++ LAPACKE_lsame怎么用?C++ LAPACKE_lsame使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LAPACKE_lsame函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LAPACKE_dgeesx
lapack_int LAPACKE_dgeesx( int matrix_order, char jobvs, char sort,
LAPACK_D_SELECT2 select, char sense, lapack_int n,
double* a, lapack_int lda, lapack_int* sdim,
double* wr, double* wi, double* vs, lapack_int ldvs,
double* rconde, double* rcondv )
{
lapack_int info = 0;
lapack_int liwork = -1;
lapack_int lwork = -1;
lapack_logical* bwork = NULL;
lapack_int* iwork = NULL;
double* work = NULL;
lapack_int iwork_query;
double work_query;
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_dgeesx", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_dge_nancheck( matrix_order, n, n, a, lda ) ) {
return -7;
}
#endif
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( sort, 's' ) ) {
bwork = (lapack_logical*)
LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
if( bwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
}
/* Query optimal working array(s) size */
info = LAPACKE_dgeesx_work( matrix_order, jobvs, sort, select, sense, n, a,
lda, sdim, wr, wi, vs, ldvs, rconde, rcondv,
&work_query, lwork, &iwork_query, liwork,
bwork );
if( info != 0 ) {
goto exit_level_1;
}
liwork = (lapack_int)iwork_query;
lwork = (lapack_int)work_query;
/* Allocate memory for work arrays */
if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
}
work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_2;
}
/* Call middle-level interface */
info = LAPACKE_dgeesx_work( matrix_order, jobvs, sort, select, sense, n, a,
lda, sdim, wr, wi, vs, ldvs, rconde, rcondv,
work, lwork, iwork, liwork, bwork );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_2:
if( LAPACKE_lsame( sense, 'b' ) || LAPACKE_lsame( sense, 'v' ) ) {
LAPACKE_free( iwork );
}
exit_level_1:
if( LAPACKE_lsame( sort, 's' ) ) {
LAPACKE_free( bwork );
}
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dgeesx", info );
}
return info;
}
示例2: LAPACKE_ssbevx_work
lapack_int LAPACKE_ssbevx_work( int matrix_order, char jobz, char range,
char uplo, lapack_int n, lapack_int kd,
float* ab, lapack_int ldab, float* q,
lapack_int ldq, float vl, float vu,
lapack_int il, lapack_int iu, float abstol,
lapack_int* m, float* w, float* z,
lapack_int ldz, float* work, lapack_int* iwork,
lapack_int* ifail )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_ssbevx( &jobz, &range, &uplo, &n, &kd, ab, &ldab, q, &ldq, &vl,
&vu, &il, &iu, &abstol, m, w, z, &ldz, work, iwork,
ifail, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == 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 ldab_t = MAX(1,kd+1);
lapack_int ldq_t = MAX(1,n);
lapack_int ldz_t = MAX(1,n);
float* ab_t = NULL;
float* q_t = NULL;
float* z_t = NULL;
/* Check leading dimension(s) */
if( ldab < n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_ssbevx_work", info );
return info;
}
if( ldq < n ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_ssbevx_work", info );
return info;
}
if( ldz < ncols_z ) {
info = -19;
LAPACKE_xerbla( "LAPACKE_ssbevx_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
ab_t = (float*)LAPACKE_malloc( sizeof(float) * ldab_t * MAX(1,n) );
if( ab_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
if( LAPACKE_lsame( jobz, 'v' ) ) {
q_t = (float*)LAPACKE_malloc( sizeof(float) * ldq_t * MAX(1,n) );
if( q_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
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_2;
}
}
/* Transpose input matrices */
LAPACKE_ssb_trans( matrix_order, uplo, n, kd, ab, ldab, ab_t, ldab_t );
/* Call LAPACK function and adjust info */
LAPACK_ssbevx( &jobz, &range, &uplo, &n, &kd, ab_t, &ldab_t, q_t,
&ldq_t, &vl, &vu, &il, &iu, &abstol, m, w, z_t, &ldz_t,
work, iwork, ifail, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_ssb_trans( LAPACK_COL_MAJOR, uplo, n, kd, ab_t, ldab_t, ab,
ldab );
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_sge_trans( LAPACK_COL_MAJOR, n, n, q_t, ldq_t, q, ldq );
}
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_2:
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_free( q_t );
}
exit_level_1:
LAPACKE_free( ab_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ssbevx_work", info );
}
} else {
info = -1;
//.........这里部分代码省略.........
示例3: LAPACKE_dgges
lapack_int LAPACKE_dgges( int matrix_layout, char jobvsl, char jobvsr, char sort,
LAPACK_D_SELECT3 selctg, lapack_int n, double* a,
lapack_int lda, double* b, lapack_int ldb,
lapack_int* sdim, double* alphar, double* alphai,
double* beta, double* vsl, lapack_int ldvsl,
double* vsr, lapack_int ldvsr )
{
lapack_int info = 0;
lapack_int lwork = -1;
lapack_logical* bwork = NULL;
double* work = NULL;
double work_query;
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_dgges", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_dge_nancheck( matrix_layout, n, n, a, lda ) ) {
return -7;
}
if( LAPACKE_dge_nancheck( matrix_layout, n, n, b, ldb ) ) {
return -9;
}
#endif
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( sort, 's' ) ) {
bwork = (lapack_logical*)
LAPACKE_malloc( sizeof(lapack_logical) * MAX(1,n) );
if( bwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
}
/* Query optimal working array(s) size */
info = LAPACKE_dgges_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n, a,
lda, b, ldb, sdim, alphar, alphai, beta, vsl,
ldvsl, vsr, ldvsr, &work_query, lwork, bwork );
if( info != 0 ) {
goto exit_level_1;
}
lwork = (lapack_int)work_query;
/* Allocate memory for work arrays */
work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_dgges_work( matrix_layout, jobvsl, jobvsr, sort, selctg, n, a,
lda, b, ldb, sdim, alphar, alphai, beta, vsl,
ldvsl, vsr, ldvsr, work, lwork, bwork );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_1:
if( LAPACKE_lsame( sort, 's' ) ) {
LAPACKE_free( bwork );
}
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dgges", info );
}
return info;
}
示例4: LAPACKE_dgbsvx
lapack_int LAPACKE_dgbsvx( int matrix_order, 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_order != LAPACK_COL_MAJOR && matrix_order != 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_order, n, n, kl, ku, ab, ldab ) ) {
return -8;
}
if( LAPACKE_lsame( fact, 'f' ) ) {
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 -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_order, 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;
}
示例5: LAPACKE_dgbsvxx
lapack_int LAPACKE_dgbsvxx( 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* rpvgrw, 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_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_dgbsvxx", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
if( LAPACKE_get_nancheck() ) {
/* 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( nparams>0 ) {
if( LAPACKE_d_nancheck( nparams, params, 1 ) ) {
return -27;
}
}
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,4*n) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_dgbsvxx_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, 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_dgbsvxx", info );
}
return info;
}
示例6: 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* work, lapack_int ldwork )
{
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, work, &ldwork );
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, work,
&ldwork );
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;
}
示例7: LAPACKE_ssyevr
lapack_int LAPACKE_ssyevr( 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 )
{
lapack_int info = 0;
lapack_int liwork = -1;
lapack_int lwork = -1;
lapack_int* iwork = NULL;
float* work = NULL;
lapack_int iwork_query;
float work_query;
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_ssyevr", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
if( LAPACKE_get_nancheck() ) {
/* Optionally check input matrices for NaNs */
if( LAPACKE_ssy_nancheck( matrix_layout, uplo, n, a, lda ) ) {
return -6;
}
if( LAPACKE_s_nancheck( 1, &abstol, 1 ) ) {
return -12;
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) {
return -8;
}
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) {
return -9;
}
}
}
#endif
/* Query optimal working array(s) size */
info = LAPACKE_ssyevr_work( matrix_layout, jobz, range, uplo, n, a, lda, vl,
vu, il, iu, abstol, m, w, z, ldz, isuppz,
&work_query, lwork, &iwork_query, liwork );
if( info != 0 ) {
goto exit_level_0;
}
liwork = (lapack_int)iwork_query;
lwork = (lapack_int)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;
}
work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_ssyevr_work( matrix_layout, jobz, range, uplo, n, a, lda, vl,
vu, il, iu, abstol, m, w, z, ldz, isuppz, work,
lwork, iwork, liwork );
/* 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_ssyevr", info );
}
return info;
}
示例8: LAPACKE_cheevx
lapack_int LAPACKE_cheevx( int matrix_order, char jobz, char range, char uplo,
lapack_int n, lapack_complex_float* a,
lapack_int lda, 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_int* ifail )
{
lapack_int info = 0;
lapack_int lwork = -1;
lapack_int* iwork = NULL;
float* rwork = NULL;
lapack_complex_float* work = NULL;
lapack_complex_float work_query;
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_cheevx", -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 -6;
}
if( LAPACKE_s_nancheck( 1, &abstol, 1 ) ) {
return -12;
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vl, 1 ) ) {
return -8;
}
}
if( LAPACKE_lsame( range, 'v' ) ) {
if( LAPACKE_s_nancheck( 1, &vu, 1 ) ) {
return -9;
}
}
#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 = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,7*n) );
if( rwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Query optimal working array(s) size */
info = LAPACKE_cheevx_work( matrix_order, jobz, range, uplo, n, a, lda, vl,
vu, il, iu, abstol, m, w, z, ldz, &work_query,
lwork, rwork, iwork, ifail );
if( info != 0 ) {
goto exit_level_2;
}
lwork = LAPACK_C2INT( work_query );
/* Allocate memory for work arrays */
work = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_2;
}
/* Call middle-level interface */
info = LAPACKE_cheevx_work( matrix_order, jobz, range, uplo, n, a, lda, 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_cheevx", info );
}
return info;
}
示例9: LAPACKE_zgesvj_work
lapack_int LAPACKE_zgesvj_work( int matrix_layout, char joba, char jobu,
char jobv, lapack_int m, lapack_int n,
lapack_complex_double* a, lapack_int lda,
double* sva, lapack_int mv,
lapack_complex_double* v, lapack_int ldv,
lapack_complex_double* cwork, lapack_int lwork,
double* rwork, lapack_int lrwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zgesvj( &joba, &jobu, &jobv, &m, &n, a, &lda, sva, &mv, v, &ldv,
cwork, &lwork, rwork, &lrwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int nrows_v = LAPACKE_lsame( jobv, 'v' ) ? MAX(0,n) :
( LAPACKE_lsame( jobv, 'a' ) ? MAX(0,mv) : 0);
lapack_int lda_t = MAX(1,m);
lapack_int ldv_t = MAX(1,nrows_v);
lapack_complex_double* a_t = NULL;
lapack_complex_double* v_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -8;
LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
return info;
}
if( ldv < n ) {
info = -12;
LAPACKE_xerbla( "LAPACKE_zgesvj_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;
}
if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
v_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * ldv_t * MAX(1,n) );
if( v_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
if( LAPACKE_lsame( jobv, 'a' ) ) {
LAPACKE_zge_trans( matrix_layout, nrows_v, n, v, ldv, v_t, ldv_t );
}
/* Call LAPACK function and adjust info */
LAPACK_zgesvj( &joba, &jobu, &jobv, &m, &n, a_t, &lda_t, sva, &mv, v_t,
&ldv_t, cwork, &lwork, rwork, &lrwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_v, n, v_t, ldv_t, v,
ldv );
}
/* Release memory and exit */
if( LAPACKE_lsame( jobv, 'a' ) || LAPACKE_lsame( jobv, 'v' ) ) {
LAPACKE_free( v_t );
}
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_zgesvj_work", info );
}
return info;
}
示例10: LAPACKE_zsysvxx_work
lapack_int LAPACKE_zsysvxx_work( int matrix_order, char fact, char uplo,
lapack_int n, lapack_int nrhs,
lapack_complex_double* a, lapack_int lda,
lapack_complex_double* af, lapack_int ldaf,
lapack_int* ipiv, char* equed, double* s,
lapack_complex_double* b, lapack_int ldb,
lapack_complex_double* x, lapack_int ldx,
double* rcond, double* rpvgrw, double* berr,
lapack_int n_err_bnds, double* err_bnds_norm,
double* err_bnds_comp, lapack_int nparams,
double* params, lapack_complex_double* work,
double* rwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zsysvxx( &fact, &uplo, &n, &nrhs, a, &lda, af, &ldaf, ipiv,
equed, s, b, &ldb, x, &ldx, rcond, rpvgrw, 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_double* a_t = NULL;
lapack_complex_double* af_t = NULL;
lapack_complex_double* b_t = NULL;
lapack_complex_double* x_t = NULL;
double* err_bnds_norm_t = NULL;
double* err_bnds_comp_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_zsysvxx_work", info );
return info;
}
if( ldaf < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_zsysvxx_work", info );
return info;
}
if( ldb < nrhs ) {
info = -14;
LAPACKE_xerbla( "LAPACKE_zsysvxx_work", info );
return info;
}
if( ldx < nrhs ) {
info = -16;
LAPACKE_xerbla( "LAPACKE_zsysvxx_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;
}
af_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * ldaf_t * MAX(1,n) );
if( af_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
b_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldb_t * MAX(1,nrhs) );
if( b_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
x_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldx_t * MAX(1,nrhs) );
if( x_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
err_bnds_norm_t = (double*)
LAPACKE_malloc( sizeof(double) * 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 = (double*)
LAPACKE_malloc( sizeof(double) * 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_zsy_trans( matrix_order, uplo, n, a, lda, a_t, lda_t );
if( LAPACKE_lsame( fact, 'f' ) ) {
LAPACKE_zsy_trans( matrix_order, uplo, n, af, ldaf, af_t, ldaf_t );
}
LAPACKE_zge_trans( matrix_order, n, nrhs, b, ldb, b_t, ldb_t );
//.........这里部分代码省略.........
示例11: LAPACKE_chgeqz_work
lapack_int LAPACKE_chgeqz_work( int matrix_layout, char job, char compq,
char compz, lapack_int n, lapack_int ilo,
lapack_int ihi, lapack_complex_float* h,
lapack_int ldh, lapack_complex_float* t,
lapack_int ldt, lapack_complex_float* alpha,
lapack_complex_float* beta,
lapack_complex_float* q, lapack_int ldq,
lapack_complex_float* z, lapack_int ldz,
lapack_complex_float* work, lapack_int lwork,
float* rwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_chgeqz( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt,
alpha, beta, q, &ldq, z, &ldz, work, &lwork, rwork,
&info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int ldh_t = MAX(1,n);
lapack_int ldq_t = MAX(1,n);
lapack_int ldt_t = MAX(1,n);
lapack_int ldz_t = MAX(1,n);
lapack_complex_float* h_t = NULL;
lapack_complex_float* t_t = NULL;
lapack_complex_float* q_t = NULL;
lapack_complex_float* z_t = NULL;
/* Check leading dimension(s) */
if( ldh < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_chgeqz_work", info );
return info;
}
if( ldq < n ) {
info = -15;
LAPACKE_xerbla( "LAPACKE_chgeqz_work", info );
return info;
}
if( ldt < n ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_chgeqz_work", info );
return info;
}
if( ldz < n ) {
info = -17;
LAPACKE_xerbla( "LAPACKE_chgeqz_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_chgeqz( &job, &compq, &compz, &n, &ilo, &ihi, h, &ldh_t, t,
&ldt_t, alpha, beta, q, &ldq_t, z, &ldz_t, work,
&lwork, rwork, &info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
h_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * ldh_t * MAX(1,n) );
if( h_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
t_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
if( t_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
if( LAPACKE_lsame( compq, 'i' ) || LAPACKE_lsame( compq, '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( compz, 'i' ) || LAPACKE_lsame( compz, '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_cge_trans( matrix_layout, n, n, h, ldh, h_t, ldh_t );
LAPACKE_cge_trans( matrix_layout, n, n, t, ldt, t_t, ldt_t );
if( LAPACKE_lsame( compq, 'v' ) ) {
LAPACKE_cge_trans( matrix_layout, n, n, q, ldq, q_t, ldq_t );
}
if( LAPACKE_lsame( compz, 'v' ) ) {
LAPACKE_cge_trans( matrix_layout, n, n, z, ldz, z_t, ldz_t );
}
/* Call LAPACK function and adjust info */
LAPACK_chgeqz( &job, &compq, &compz, &n, &ilo, &ihi, h_t, &ldh_t, t_t,
&ldt_t, alpha, beta, q_t, &ldq_t, z_t, &ldz_t, work,
//.........这里部分代码省略.........
示例12: LAPACKE_zgeev_work
lapack_int LAPACKE_zgeev_work( int matrix_order, char jobvl, char jobvr,
lapack_int n, lapack_complex_double* a,
lapack_int lda, lapack_complex_double* w,
lapack_complex_double* vl, lapack_int ldvl,
lapack_complex_double* vr, lapack_int ldvr,
lapack_complex_double* work, lapack_int lwork,
double* rwork )
{
lapack_int info = 0;
if( matrix_order == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zgeev( &jobvl, &jobvr, &n, a, &lda, w, vl, &ldvl, vr, &ldvr,
work, &lwork, rwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int ldvl_t = MAX(1,n);
lapack_int ldvr_t = MAX(1,n);
lapack_complex_double* a_t = NULL;
lapack_complex_double* vl_t = NULL;
lapack_complex_double* vr_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -6;
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
return info;
}
if( ldvl < n ) {
info = -9;
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
return info;
}
if( ldvr < n ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_zgeev( &jobvl, &jobvr, &n, a, &lda_t, w, vl, &ldvl_t, vr,
&ldvr_t, work, &lwork, rwork, &info );
return (info < 0) ? (info - 1) : 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;
}
if( LAPACKE_lsame( jobvl, 'v' ) ) {
vl_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldvl_t * MAX(1,n) );
if( vl_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
if( LAPACKE_lsame( jobvr, 'v' ) ) {
vr_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldvr_t * MAX(1,n) );
if( vr_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 );
/* Call LAPACK function and adjust info */
LAPACK_zgeev( &jobvl, &jobvr, &n, a_t, &lda_t, w, vl_t, &ldvl_t, vr_t,
&ldvr_t, work, &lwork, rwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, a_t, lda_t, a, lda );
if( LAPACKE_lsame( jobvl, 'v' ) ) {
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, vl_t, ldvl_t, vl, ldvl );
}
if( LAPACKE_lsame( jobvr, 'v' ) ) {
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, vr_t, ldvr_t, vr, ldvr );
}
/* Release memory and exit */
if( LAPACKE_lsame( jobvr, 'v' ) ) {
LAPACKE_free( vr_t );
}
exit_level_2:
if( LAPACKE_lsame( jobvl, 'v' ) ) {
LAPACKE_free( vl_t );
}
exit_level_1:
LAPACKE_free( a_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zgeev_work", info );
}
//.........这里部分代码省略.........
示例13: LAPACKE_strsen
lapack_int LAPACKE_strsen( int matrix_order, char job, char compq,
const lapack_logical* select, lapack_int n, float* t,
lapack_int ldt, float* q, lapack_int ldq, float* wr,
float* wi, lapack_int* m, float* s, float* sep )
{
lapack_int info = 0;
lapack_int liwork = -1;
lapack_int lwork = -1;
lapack_int* iwork = NULL;
float* work = NULL;
lapack_int iwork_query;
float work_query;
if( matrix_order != LAPACK_COL_MAJOR && matrix_order != LAPACK_ROW_MAJOR ) {
LAPACKE_xerbla( "LAPACKE_strsen", -1 );
return -1;
}
#ifndef LAPACK_DISABLE_NAN_CHECK
/* Optionally check input matrices for NaNs */
if( LAPACKE_lsame( compq, 'v' ) ) {
if( LAPACKE_sge_nancheck( matrix_order, n, n, q, ldq ) ) {
return -8;
}
}
if( LAPACKE_sge_nancheck( matrix_order, n, n, t, ldt ) ) {
return -6;
}
#endif
/* Query optimal working array(s) size */
info = LAPACKE_strsen_work( matrix_order, job, compq, select, n, t, ldt, q,
ldq, wr, wi, m, s, sep, &work_query, lwork,
&iwork_query, liwork );
if( info != 0 ) {
goto exit_level_0;
}
liwork = (lapack_int)iwork_query;
lwork = (lapack_int)work_query;
/* Allocate memory for work arrays */
if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
}
work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_strsen_work( matrix_order, job, compq, select, n, t, ldt, q,
ldq, wr, wi, m, s, sep, work, lwork, iwork,
liwork );
/* Release memory and exit */
LAPACKE_free( work );
exit_level_1:
if( LAPACKE_lsame( job, 'b' ) || LAPACKE_lsame( job, 'v' ) ) {
LAPACKE_free( iwork );
}
exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_strsen", info );
}
return info;
}
示例14: LAPACKE_zhbevd_2stage_work
lapack_int LAPACKE_zhbevd_2stage_work( 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_complex_double* work,
lapack_int lwork, double* rwork,
lapack_int lrwork, lapack_int* iwork,
lapack_int liwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_zhbevd_2stage( &jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work,
&lwork, rwork, &lrwork, iwork, &liwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int ldab_t = MAX(1,kd+1);
lapack_int ldz_t = MAX(1,n);
lapack_complex_double* ab_t = NULL;
lapack_complex_double* z_t = NULL;
/* Check leading dimension(s) */
if( ldab < n ) {
info = -7;
LAPACKE_xerbla( "LAPACKE_zhbevd_2stage_work", info );
return info;
}
if( ldz < n ) {
info = -10;
LAPACKE_xerbla( "LAPACKE_zhbevd_2stage_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( liwork == -1 || lrwork == -1 || lwork == -1 ) {
LAPACK_zhbevd_2stage( &jobz, &uplo, &n, &kd, ab, &ldab_t, w, z, &ldz_t,
work, &lwork, rwork, &lrwork, iwork, &liwork,
&info );
return (info < 0) ? (info - 1) : info;
}
/* Allocate memory for temporary array(s) */
ab_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * ldab_t * MAX(1,n) );
if( ab_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
if( LAPACKE_lsame( jobz, 'v' ) ) {
z_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) *
ldz_t * MAX(1,n) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_1;
}
}
/* Transpose input matrices */
LAPACKE_zhb_trans( matrix_layout, uplo, n, kd, ab, ldab, ab_t, ldab_t );
/* Call LAPACK function and adjust info */
LAPACK_zhbevd_2stage( &jobz, &uplo, &n, &kd, ab_t, &ldab_t, w, z_t, &ldz_t,
work, &lwork, rwork, &lrwork, iwork, &liwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
LAPACKE_zhb_trans( LAPACK_COL_MAJOR, uplo, n, kd, ab_t, ldab_t, ab,
ldab );
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_zge_trans( LAPACK_COL_MAJOR, n, n, z_t, ldz_t, z, ldz );
}
/* Release memory and exit */
if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_free( z_t );
}
exit_level_1:
LAPACKE_free( ab_t );
exit_level_0:
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_zhbevd_2stage_work", info );
}
} else {
info = -1;
LAPACKE_xerbla( "LAPACKE_zhbevd_2stage_work", info );
}
return info;
}
示例15: LAPACKE_sggsvd3_work
lapack_int LAPACKE_sggsvd3_work( int matrix_layout, char jobu, char jobv,
char jobq, lapack_int m, lapack_int n,
lapack_int p, lapack_int* k, lapack_int* l,
float* a, lapack_int lda, float* b,
lapack_int ldb, float* alpha, float* beta,
float* u, lapack_int ldu, float* v,
lapack_int ldv, float* q, lapack_int ldq,
float* work, lapack_int lwork,
lapack_int* iwork )
{
lapack_int info = 0;
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_sggsvd3( &jobu, &jobv, &jobq, &m, &n, &p, k, l, a, &lda,
b, &ldb, alpha, beta, u, &ldu, v, &ldv, q, &ldq,
work, &lwork, iwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,m);
lapack_int ldb_t = MAX(1,p);
lapack_int ldq_t = MAX(1,n);
lapack_int ldu_t = MAX(1,m);
lapack_int ldv_t = MAX(1,p);
float* a_t = NULL;
float* b_t = NULL;
float* u_t = NULL;
float* v_t = NULL;
float* q_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
info = -11;
LAPACKE_xerbla( "LAPACKE_sggsvd3_work", info );
return info;
}
if( ldb < n ) {
info = -13;
LAPACKE_xerbla( "LAPACKE_sggsvd3_work", info );
return info;
}
if( ldq < n ) {
info = -21;
LAPACKE_xerbla( "LAPACKE_sggsvd3_work", info );
return info;
}
if( ldu < m ) {
info = -17;
LAPACKE_xerbla( "LAPACKE_sggsvd3_work", info );
return info;
}
if( ldv < p ) {
info = -19;
LAPACKE_xerbla( "LAPACKE_sggsvd3_work", info );
return info;
}
/* Query optimal working array(s) size if requested */
if( lwork == -1 ) {
LAPACK_sggsvd3( &jobu, &jobv, &jobq, &m, &n, &p, k, l, a, &lda_t,
b, &ldb_t, alpha, beta, u, &ldu_t, v, &ldv_t,
q, &ldq_t, work, &lwork, iwork, &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( jobu, 'u' ) ) {
u_t = (float*)LAPACKE_malloc( sizeof(float) * ldu_t * MAX(1,m) );
if( u_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_2;
}
}
if( LAPACKE_lsame( jobv, 'v' ) ) {
v_t = (float*)LAPACKE_malloc( sizeof(float) * ldv_t * MAX(1,p) );
if( v_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_3;
}
}
if( LAPACKE_lsame( jobq, 'q' ) ) {
q_t = (float*)LAPACKE_malloc( sizeof(float) * ldq_t * MAX(1,n) );
if( q_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_4;
}
}
/* Transpose input matrices */
LAPACKE_sge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
LAPACKE_sge_trans( matrix_layout, p, n, b, ldb, b_t, ldb_t );
/* Call LAPACK function and adjust info */
//.........这里部分代码省略.........