summaryrefslogtreecommitdiff
path: root/LAPACKE
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2016-02-23 05:45:11 +0000
committerjulie <julielangou@users.noreply.github.com>2016-02-23 05:45:11 +0000
commit4d41972a4105e3029856c82aa80b6f699effb20b (patch)
treedd2e43c0a17817185c6fc343e49c85825db68a63 /LAPACKE
parente5f4edc2414d38ebb0cb8e67dc2f852f1429f7fc (diff)
downloadlapack-4d41972a4105e3029856c82aa80b6f699effb20b.tar.gz
lapack-4d41972a4105e3029856c82aa80b6f699effb20b.tar.bz2
lapack-4d41972a4105e3029856c82aa80b6f699effb20b.zip
APPLYING INTEL PATCHES sent to Julie on Feb 19th 2016 by Dima from INTEL (dmitry.g.baksheev@intel.com)
[PATCH 33/42] Fix lapacke_?bdsvdx - vl,vu are real; ns must be passed by ref - vl and vu are real kind - ns is [out] and must be passed by reference - lwork must be at least 1 - e is n-1 array - ldz should be compared to ncols_z for r-major case
Diffstat (limited to 'LAPACKE')
-rw-r--r--LAPACKE/include/lapacke.h32
-rw-r--r--LAPACKE/src/lapacke_dbdsvdx.c12
-rw-r--r--LAPACKE/src/lapacke_dbdsvdx_work.c24
-rw-r--r--LAPACKE/src/lapacke_sbdsvdx.c12
-rw-r--r--LAPACKE/src/lapacke_sbdsvdx_work.c24
5 files changed, 54 insertions, 50 deletions
diff --git a/LAPACKE/include/lapacke.h b/LAPACKE/include/lapacke.h
index 835188e1..31b8ed21 100644
--- a/LAPACKE/include/lapacke.h
+++ b/LAPACKE/include/lapacke.h
@@ -180,14 +180,14 @@ lapack_int LAPACKE_zbdsqr( int matrix_layout, char uplo, lapack_int n,
lapack_int ldc );
lapack_int LAPACKE_sbdsvdx( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, float* d, float* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ float vl, float vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
float* s, float* z, lapack_int ldz,
lapack_int* superb );
lapack_int LAPACKE_dbdsvdx( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, double* d, double* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ double vl, double vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
double* s, double* z, lapack_int ldz,
lapack_int* superb );
lapack_int LAPACKE_sdisna( char job, lapack_int m, lapack_int n, const float* d,
@@ -4738,17 +4738,17 @@ lapack_int LAPACKE_dbdsdc_work( int matrix_layout, char uplo, char compq,
lapack_int* iwork );
lapack_int LAPACKE_sbdsvdx_work( int matrix_layout, char uplo, char jobz, char range,
- lapack_int n, float* d, float* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
- float* s, float* z, lapack_int ldz,
- float* work, lapack_int* iwork );
+ lapack_int n, float* d, float* e,
+ float vl, float vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
+ float* s, float* z, lapack_int ldz,
+ float* work, lapack_int* iwork );
lapack_int LAPACKE_dbdsvdx_work( int matrix_layout, char uplo, char jobz, char range,
- lapack_int n, double* d, double* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
- double* s, double* z, lapack_int ldz,
- double* work, lapack_int* iwork );
+ lapack_int n, double* d, double* e,
+ double vl, double vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
+ double* s, double* z, lapack_int ldz,
+ double* work, lapack_int* iwork );
lapack_int LAPACKE_sbdsqr_work( int matrix_layout, char uplo, lapack_int n,
lapack_int ncvt, lapack_int nru, lapack_int ncc,
@@ -14784,13 +14784,13 @@ void LAPACK_dbdsdc( char* uplo, char* compq, lapack_int* n, double* d,
lapack_int* iwork, lapack_int *info );
void LAPACK_sbdsvdx( char* uplo, char* jobz, char* range,
lapack_int* n, float* d, float* e,
- lapack_int* vl, lapack_int* vu,
+ float* vl, float* vu,
lapack_int* il, lapack_int* iu, lapack_int* ns,
float* s, float* z, lapack_int* ldz,
float* work, lapack_int *iwork, lapack_int *info );
void LAPACK_dbdsvdx( char* uplo, char* jobz, char* range,
lapack_int* n, double* d, double* e,
- lapack_int* vl, lapack_int* vu,
+ double* vl, double* vu,
lapack_int* il, lapack_int* iu, lapack_int* ns,
double* s, double* z, lapack_int* ldz,
double* work, lapack_int *iwork, lapack_int *info );
diff --git a/LAPACKE/src/lapacke_dbdsvdx.c b/LAPACKE/src/lapacke_dbdsvdx.c
index d116f0db..735634ff 100644
--- a/LAPACKE/src/lapacke_dbdsvdx.c
+++ b/LAPACKE/src/lapacke_dbdsvdx.c
@@ -35,13 +35,13 @@
lapack_int LAPACKE_dbdsvdx( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, double* d, double* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ double vl, double vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
double* s, double* z, lapack_int ldz,
lapack_int* superb )
{
lapack_int info = 0;
- lapack_int lwork = 14*n;
+ lapack_int lwork = MAX(14*n,1);
double* work = NULL;
lapack_int* iwork = NULL;
lapack_int i;
@@ -54,7 +54,7 @@ lapack_int LAPACKE_dbdsvdx( int matrix_layout, char uplo, char jobz, char range,
if( LAPACKE_d_nancheck( n, d, 1 ) ) {
return -6;
}
- if( LAPACKE_d_nancheck( n, e, 1 ) ) {
+ if( LAPACKE_d_nancheck( n - 1, e, 1 ) ) {
return -7;
}
#endif
@@ -64,14 +64,14 @@ lapack_int LAPACKE_dbdsvdx( int matrix_layout, char uplo, char jobz, char range,
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
- iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*n) );
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(12*n,1) );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_dbdsvdx_work( matrix_layout, uplo, jobz, range,
- n, d, e, vl, vu, il, iu, ns, s, z,
+ n, d, e, vl, vu, il, iu, ns, s, z,
ldz, work, iwork);
/* Backup significant data from working array(s) */
for( i=0; i<12*n-1; i++ ) {
diff --git a/LAPACKE/src/lapacke_dbdsvdx_work.c b/LAPACKE/src/lapacke_dbdsvdx_work.c
index 255d8f71..2f5fbed9 100644
--- a/LAPACKE/src/lapacke_dbdsvdx_work.c
+++ b/LAPACKE/src/lapacke_dbdsvdx_work.c
@@ -35,8 +35,8 @@
lapack_int LAPACKE_dbdsvdx_work( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, double* d, double* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ double vl, double vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
double* s, double* z, lapack_int ldz,
double* work, lapack_int* iwork )
{
@@ -44,25 +44,27 @@ lapack_int LAPACKE_dbdsvdx_work( int matrix_layout, char uplo, char jobz, char r
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_dbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
- &il, &iu, &ns, s, z, &ldz,
+ &il, &iu, ns, s, z, &ldz,
work, iwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
- lapack_int nrows_z = ( LAPACKE_lsame( jobz, 'v' ) ) ? MAX(2, 2*n) : 1;
+ lapack_int nrows_z = ( LAPACKE_lsame( jobz, 'v' ) ) ? 2*n : 0;
+ lapack_int ncols_z = ( LAPACKE_lsame( jobz, 'v' ) ) ?
+ ( LAPACKE_lsame( range, 'i' ) ? MAX(0,iu - il + 1) : n + 1 ) : 0;
lapack_int ldz_t = MAX(1,nrows_z);
double* z_t = NULL;
/* Check leading dimension(s) */
- if( ldz < nrows_z ) {
+ if( ldz < ncols_z ) {
info = -3;
LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
z_t = (double*)
- LAPACKE_malloc( sizeof(double) * ldz_t * 2*n );
+ LAPACKE_malloc( sizeof(double) * ldz_t * MAX(2*n,1) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
@@ -70,17 +72,17 @@ lapack_int LAPACKE_dbdsvdx_work( int matrix_layout, char uplo, char jobz, char r
}
/* Call LAPACK function and adjust info */
LAPACK_dbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
- &il, &iu, &ns, s, z_t, &ldz_t, work,
+ &il, &iu, ns, s, z_t, &ldz_t, work,
iwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
- LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_z, nrows_z, z_t, ldz_t, z, ldz);
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
+ LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_z, ncols_z, z_t, ldz_t, z, ldz);
}
/* Release memory and exit */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_free( z_t );
}
exit_level_0:
diff --git a/LAPACKE/src/lapacke_sbdsvdx.c b/LAPACKE/src/lapacke_sbdsvdx.c
index 2d773ba9..53afba25 100644
--- a/LAPACKE/src/lapacke_sbdsvdx.c
+++ b/LAPACKE/src/lapacke_sbdsvdx.c
@@ -35,13 +35,13 @@
lapack_int LAPACKE_sbdsvdx( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, float* d, float* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ float vl, float vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
float* s, float* z, lapack_int ldz,
lapack_int* superb )
{
lapack_int info = 0;
- lapack_int lwork = 14*n;
+ lapack_int lwork = MAX(14*n,1);
float* work = NULL;
lapack_int* iwork = NULL;
lapack_int i;
@@ -54,7 +54,7 @@ lapack_int LAPACKE_sbdsvdx( int matrix_layout, char uplo, char jobz, char range,
if( LAPACKE_s_nancheck( n, d, 1 ) ) {
return -6;
}
- if( LAPACKE_s_nancheck( n, e, 1 ) ) {
+ if( LAPACKE_s_nancheck( n - 1, e, 1 ) ) {
return -7;
}
#endif
@@ -64,14 +64,14 @@ lapack_int LAPACKE_sbdsvdx( int matrix_layout, char uplo, char jobz, char range,
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
- iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*n) );
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * MAX(12*n,1) );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_1;
}
/* Call middle-level interface */
info = LAPACKE_sbdsvdx_work( matrix_layout, uplo, jobz, range,
- n, d, e, vl, vu, il, iu, ns, s, z,
+ n, d, e, vl, vu, il, iu, ns, s, z,
ldz, work, iwork);
/* Backup significant data from working array(s) */
for( i=0; i<12*n-1; i++ ) {
diff --git a/LAPACKE/src/lapacke_sbdsvdx_work.c b/LAPACKE/src/lapacke_sbdsvdx_work.c
index 4f281ef5..8e8ea668 100644
--- a/LAPACKE/src/lapacke_sbdsvdx_work.c
+++ b/LAPACKE/src/lapacke_sbdsvdx_work.c
@@ -35,8 +35,8 @@
lapack_int LAPACKE_sbdsvdx_work( int matrix_layout, char uplo, char jobz, char range,
lapack_int n, float* d, float* e,
- lapack_int vl, lapack_int vu,
- lapack_int il, lapack_int iu, lapack_int ns,
+ float vl, float vu,
+ lapack_int il, lapack_int iu, lapack_int* ns,
float* s, float* z, lapack_int ldz,
float* work, lapack_int* iwork )
{
@@ -44,25 +44,27 @@ lapack_int LAPACKE_sbdsvdx_work( int matrix_layout, char uplo, char jobz, char r
if( matrix_layout == LAPACK_COL_MAJOR ) {
/* Call LAPACK function and adjust info */
LAPACK_sbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
- &il, &iu, &ns, s, z, &ldz,
+ &il, &iu, ns, s, z, &ldz,
work, iwork, &info );
if( info < 0 ) {
info = info - 1;
}
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
- lapack_int nrows_z = ( LAPACKE_lsame( jobz, 'v' ) ) ? MAX(2, 2*n) : 1;
+ lapack_int nrows_z = ( LAPACKE_lsame( jobz, 'v' ) ) ? 2*n : 0;
+ lapack_int ncols_z = ( LAPACKE_lsame( jobz, 'v' ) ) ?
+ ( LAPACKE_lsame( range, 'i' ) ? MAX(0,iu - il + 1) : n + 1 ) : 0;
lapack_int ldz_t = MAX(1,nrows_z);
float* z_t = NULL;
/* Check leading dimension(s) */
- if( ldz < nrows_z ) {
+ if( ldz < ncols_z ) {
info = -3;
LAPACKE_xerbla( "LAPACKE_sbdsvdx_work", info );
return info;
}
/* Allocate memory for temporary array(s) */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
z_t = (float*)
- LAPACKE_malloc( sizeof(float) * ldz_t * 2*n );
+ LAPACKE_malloc( sizeof(float) * ldz_t * MAX(2*n,1) );
if( z_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
@@ -70,17 +72,17 @@ lapack_int LAPACKE_sbdsvdx_work( int matrix_layout, char uplo, char jobz, char r
}
/* Call LAPACK function and adjust info */
LAPACK_sbdsvdx( &uplo, &jobz, &range, &n, d, e, &vl, &vu,
- &il, &iu, &ns, s, z_t, &ldz_t, work,
+ &il, &iu, ns, s, z_t, &ldz_t, work,
iwork, &info );
if( info < 0 ) {
info = info - 1;
}
/* Transpose output matrices */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
- LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_z, nrows_z, z_t, ldz_t, z, ldz);
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
+ LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_z, ncols_z, z_t, ldz_t, z, ldz);
}
/* Release memory and exit */
- if( LAPACKE_lsame( jobz, 'n' ) ) {
+ if( LAPACKE_lsame( jobz, 'v' ) ) {
LAPACKE_free( z_t );
}
exit_level_0: