summaryrefslogtreecommitdiff
path: root/LAPACKE
diff options
context:
space:
mode:
authorjulie <julielangou@users.noreply.github.com>2015-11-14 06:30:55 +0000
committerjulie <julielangou@users.noreply.github.com>2015-11-14 06:30:55 +0000
commitfb66eae95d64642222b22700ecb2477b6e1f6482 (patch)
tree8e5a49043e155e729b404eed32940bd18edbd893 /LAPACKE
parentca514d8b0fc68121f8ce8b0125162da194cba0af (diff)
downloadlapack-fb66eae95d64642222b22700ecb2477b6e1f6482.tar.gz
lapack-fb66eae95d64642222b22700ecb2477b6e1f6482.tar.bz2
lapack-fb66eae95d64642222b22700ecb2477b6e1f6482.zip
Adding *esvdx and *bdsvdx to LAPACKE
*** NEED REVIEW ***
Diffstat (limited to 'LAPACKE')
-rw-r--r--LAPACKE/include/lapacke.h128
-rw-r--r--LAPACKE/src/CMakeLists.txt12
-rw-r--r--LAPACKE/src/Makefile12
-rw-r--r--LAPACKE/src/lapacke_cgesvdx.c106
-rw-r--r--LAPACKE/src/lapacke_cgesvdx_work.c151
-rw-r--r--LAPACKE/src/lapacke_dbdsvdx.c89
-rw-r--r--LAPACKE/src/lapacke_dbdsvdx_work.c95
-rw-r--r--LAPACKE/src/lapacke_dgesvdx.c96
-rw-r--r--LAPACKE/src/lapacke_dgesvdx_work.c149
-rw-r--r--LAPACKE/src/lapacke_sbdsvdx.c89
-rw-r--r--LAPACKE/src/lapacke_sbdsvdx_work.c95
-rw-r--r--LAPACKE/src/lapacke_sgesvdx.c96
-rw-r--r--LAPACKE/src/lapacke_sgesvdx_work.c149
-rw-r--r--LAPACKE/src/lapacke_zgesvdx.c106
-rw-r--r--LAPACKE/src/lapacke_zgesvdx_work.c151
15 files changed, 1523 insertions, 1 deletions
diff --git a/LAPACKE/include/lapacke.h b/LAPACKE/include/lapacke.h
index bdd40838..fe52a6f1 100644
--- a/LAPACKE/include/lapacke.h
+++ b/LAPACKE/include/lapacke.h
@@ -178,7 +178,18 @@ lapack_int LAPACKE_zbdsqr( int matrix_layout, char uplo, lapack_int n,
lapack_int ldvt, lapack_complex_double* u,
lapack_int ldu, lapack_complex_double* c,
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* 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* s, double* z, lapack_int ldz,
+ lapack_int* superb );
lapack_int LAPACKE_sdisna( char job, lapack_int m, lapack_int n, const float* d,
float* sep );
lapack_int LAPACKE_ddisna( char job, lapack_int m, lapack_int n,
@@ -986,6 +997,35 @@ lapack_int LAPACKE_zgesvd( int matrix_layout, char jobu, char jobvt,
lapack_int ldu, lapack_complex_double* vt,
lapack_int ldvt, double* superb );
+lapack_int LAPACKE_sgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, float* u, lapack_int ldu,
+ float* vt, lapack_int ldvt,
+ lapack_int* superb );
+lapack_int LAPACKE_dgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, double* u, lapack_int ldu,
+ double* vt, lapack_int ldvt,
+ lapack_int* superb );
+lapack_int LAPACKE_cgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, lapack_complex_float* u, lapack_int ldu,
+ lapack_complex_float* vt, lapack_int ldvt,
+ lapack_int* superb );
+lapack_int LAPACKE_zgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, lapack_complex_double* u, lapack_int ldu,
+ lapack_complex_double* vt, lapack_int ldvt,
+ lapack_int* superb );
+
lapack_int LAPACKE_sgesvj( int matrix_layout, char joba, char jobu, char jobv,
lapack_int m, lapack_int n, float* a, lapack_int lda,
float* sva, lapack_int mv, float* v, lapack_int ldv,
@@ -4677,6 +4717,19 @@ lapack_int LAPACKE_dbdsdc_work( int matrix_layout, char uplo, char compq,
double* q, lapack_int* iq, double* work,
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 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 LAPACKE_sbdsqr_work( int matrix_layout, char uplo, lapack_int n,
lapack_int ncvt, lapack_int nru, lapack_int ncc,
float* d, float* e, float* vt, lapack_int ldvt,
@@ -5685,6 +5738,37 @@ lapack_int LAPACKE_zgesvd_work( int matrix_layout, char jobu, char jobvt,
lapack_int ldvt, lapack_complex_double* work,
lapack_int lwork, double* rwork );
+lapack_int LAPACKE_sgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, float* u, lapack_int ldu,
+ float* vt, lapack_int ldvt,
+ float* work, lapack_int lwork, lapack_int* iwork );
+lapack_int LAPACKE_dgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, double* u, lapack_int ldu,
+ double* vt, lapack_int ldvt,
+ double* work, lapack_int lwork, lapack_int* iwork );
+lapack_int LAPACKE_cgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, lapack_complex_float* u, lapack_int ldu,
+ lapack_complex_float* vt, lapack_int ldvt,
+ lapack_complex_float* work, lapack_int lwork,
+ float* rwork, lapack_int* iwork );
+lapack_int LAPACKE_zgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, lapack_complex_double* u, lapack_int ldu,
+ lapack_complex_double* vt, lapack_int ldvt,
+ lapack_complex_double* work, lapack_int lwork,
+ double* rwork, lapack_int* iwork );
+
lapack_int LAPACKE_sgesvj_work( int matrix_layout, char joba, char jobu,
char jobv, lapack_int m, lapack_int n, float* a,
lapack_int lda, float* sva, lapack_int mv,
@@ -11810,6 +11894,8 @@ void LAPACKE_ilaver( const lapack_int* vers_major,
#define LAPACK_zbdsqr LAPACK_GLOBAL(zbdsqr,ZBDSQR)
#define LAPACK_sbdsdc LAPACK_GLOBAL(sbdsdc,SBDSDC)
#define LAPACK_dbdsdc LAPACK_GLOBAL(dbdsdc,DBDSDC)
+#define LAPACK_sbdsvdx LAPACK_GLOBAL(sbdsvdx,SBDSVDX)
+#define LAPACK_dbdsvdx LAPACK_GLOBAL(dbdsvdx,DBDSVDX)
#define LAPACK_ssytrd LAPACK_GLOBAL(ssytrd,SSYTRD)
#define LAPACK_dsytrd LAPACK_GLOBAL(dsytrd,DSYTRD)
#define LAPACK_sorgtr LAPACK_GLOBAL(sorgtr,SORGTR)
@@ -12076,6 +12162,10 @@ void LAPACKE_ilaver( const lapack_int* vers_major,
#define LAPACK_dgesvd LAPACK_GLOBAL(dgesvd,DGESVD)
#define LAPACK_cgesvd LAPACK_GLOBAL(cgesvd,CGESVD)
#define LAPACK_zgesvd LAPACK_GLOBAL(zgesvd,ZGESVD)
+#define LAPACK_sgesvdx LAPACK_GLOBAL(sgesvdx,SGESVDX)
+#define LAPACK_dgesvdx LAPACK_GLOBAL(dgesvdx,DGESVDX)
+#define LAPACK_cgesvdx LAPACK_GLOBAL(cgesvdx,CGESVDX)
+#define LAPACK_zgesvdx LAPACK_GLOBAL(zgesvdx,ZGESVDX)
#define LAPACK_sgesdd LAPACK_GLOBAL(sgesdd,SGESDD)
#define LAPACK_dgesdd LAPACK_GLOBAL(dgesdd,DGESDD)
#define LAPACK_cgesdd LAPACK_GLOBAL(cgesdd,CGESDD)
@@ -14628,6 +14718,18 @@ void LAPACK_dbdsdc( char* uplo, char* compq, lapack_int* n, double* d,
double* e, double* u, lapack_int* ldu, double* vt,
lapack_int* ldvt, double* q, lapack_int* iq, double* work,
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,
+ 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,
+ lapack_int* il, lapack_int* iu, lapack_int* ns,
+ double* s, double* z, lapack_int* ldz,
+ double* work, lapack_int *iwork, lapack_int *info );
void LAPACK_ssytrd( char* uplo, lapack_int* n, float* a, lapack_int* lda,
float* d, float* e, float* tau, float* work,
lapack_int* lwork, lapack_int *info );
@@ -15948,6 +16050,30 @@ void LAPACK_zgesvd( char* jobu, char* jobvt, lapack_int* m, lapack_int* n,
lapack_complex_double* vt, lapack_int* ldvt,
lapack_complex_double* work, lapack_int* lwork,
double* rwork, lapack_int *info );
+void LAPACK_sgesvdx( char* jobu, char* jobvt, char* range, lapack_int* m, lapack_int* n,
+ float* a, lapack_int* lda, lapack_int* vl, lapack_int* vu,
+ lapack_int* il, lapack_int* iu, lapack_int* ns, float* s, float* u,
+ lapack_int* ldu, float* vt, lapack_int* ldvt, float* work,
+ lapack_int* lwork, lapack_int *iwork, lapack_int *info );
+void LAPACK_dgesvdx( char* jobu, char* jobvt, char* range, lapack_int* m, lapack_int* n,
+ double* a, lapack_int* lda, lapack_int* vl, lapack_int* vu,
+ lapack_int* il, lapack_int* iu, lapack_int* ns, double* s, double* u,
+ lapack_int* ldu, double* vt, lapack_int* ldvt, double* work,
+ lapack_int* lwork, lapack_int *iwork, lapack_int *info );
+void LAPACK_cgesvdx( char* jobu, char* jobvt, char* range, lapack_int* m, lapack_int* n,
+ lapack_complex_float* a, lapack_int* lda, lapack_int* vl, lapack_int* vu,
+ lapack_int* il, lapack_int* iu, lapack_int* ns, float* s,
+ lapack_complex_float* u, lapack_int* ldu,
+ lapack_complex_float* vt, lapack_int* ldvt,
+ lapack_complex_float* work, lapack_int* lwork, float* rwork,
+ lapack_int *iwork, lapack_int *info );
+void LAPACK_zgesvdx( char* jobu, char* jobvt, char* range, lapack_int* m, lapack_int* n,
+ lapack_complex_double* a, lapack_int* lda, lapack_int* vl, lapack_int* vu,
+ lapack_int* il, lapack_int* iu, lapack_int* ns, double* s,
+ lapack_complex_double* u, lapack_int* ldu,
+ lapack_complex_double* vt, lapack_int* ldvt,
+ lapack_complex_double* work, lapack_int* lwork,
+ double* rwork, lapack_int *iwork, lapack_int *info );
void LAPACK_sgesdd( char* jobz, lapack_int* m, lapack_int* n, float* a,
lapack_int* lda, float* s, float* u, lapack_int* ldu,
float* vt, lapack_int* ldvt, float* work, lapack_int* lwork,
diff --git a/LAPACKE/src/CMakeLists.txt b/LAPACKE/src/CMakeLists.txt
index 482fe0c9..0be69e5b 100644
--- a/LAPACKE/src/CMakeLists.txt
+++ b/LAPACKE/src/CMakeLists.txt
@@ -87,6 +87,8 @@ lapacke_cgesv.c
lapacke_cgesv_work.c
lapacke_cgesvd.c
lapacke_cgesvd_work.c
+lapacke_cgesvdx.c
+lapacke_cgesvdx_work.c
lapacke_cgesvj.c
lapacke_cgesvj_work.c
lapacke_cgesvx.c
@@ -525,6 +527,8 @@ lapacke_dbbcsd.c
lapacke_dbbcsd_work.c
lapacke_dbdsdc.c
lapacke_dbdsdc_work.c
+lapacke_dbdsvdx.c
+lapacke_dbdsvdx_work.c
lapacke_dbdsqr.c
lapacke_dbdsqr_work.c
lapacke_ddisna.c
@@ -611,6 +615,8 @@ lapacke_dgesv.c
lapacke_dgesv_work.c
lapacke_dgesvd.c
lapacke_dgesvd_work.c
+lapacke_dgesvdx.c
+lapacke_dgesvdx_work.c
lapacke_dgesvj.c
lapacke_dgesvj_work.c
lapacke_dgesvx.c
@@ -1029,6 +1035,8 @@ lapacke_sbbcsd.c
lapacke_sbbcsd_work.c
lapacke_sbdsdc.c
lapacke_sbdsdc_work.c
+lapacke_sbdsvdx.c
+lapacke_sbdsvdx_work.c
lapacke_sbdsqr.c
lapacke_sbdsqr_work.c
lapacke_sdisna.c
@@ -1115,6 +1123,8 @@ lapacke_sgesv.c
lapacke_sgesv_work.c
lapacke_sgesvd.c
lapacke_sgesvd_work.c
+lapacke_sgesvdx.c
+lapacke_sgesvdx_work.c
lapacke_sgesvj.c
lapacke_sgesvj_work.c
lapacke_sgesvx.c
@@ -1615,6 +1625,8 @@ lapacke_zgesv.c
lapacke_zgesv_work.c
lapacke_zgesvd.c
lapacke_zgesvd_work.c
+lapacke_zgesvdx.c
+lapacke_zgesvdx_work.c
lapacke_zgesvj.c
lapacke_zgesvj_work.c
lapacke_zgesvx.c
diff --git a/LAPACKE/src/Makefile b/LAPACKE/src/Makefile
index 1a541b80..0672a116 100644
--- a/LAPACKE/src/Makefile
+++ b/LAPACKE/src/Makefile
@@ -121,6 +121,8 @@ lapacke_cgesv.o \
lapacke_cgesv_work.o \
lapacke_cgesvd.o \
lapacke_cgesvd_work.o \
+lapacke_cgesvdx.o \
+lapacke_cgesvdx_work.o \
lapacke_cgesvj.o \
lapacke_cgesvj_work.o \
lapacke_cgesvx.o \
@@ -559,6 +561,8 @@ lapacke_dbbcsd.o \
lapacke_dbbcsd_work.o \
lapacke_dbdsdc.o \
lapacke_dbdsdc_work.o \
+lapacke_dbdsvdx.o \
+lapacke_dbdsvdx_work.o \
lapacke_dbdsqr.o \
lapacke_dbdsqr_work.o \
lapacke_ddisna.o \
@@ -645,6 +649,8 @@ lapacke_dgesv.o \
lapacke_dgesv_work.o \
lapacke_dgesvd.o \
lapacke_dgesvd_work.o \
+lapacke_dgesvdx.o \
+lapacke_dgesvdx_work.o \
lapacke_dgesvj.o \
lapacke_dgesvj_work.o \
lapacke_dgesvx.o \
@@ -1063,6 +1069,8 @@ lapacke_sbbcsd.o \
lapacke_sbbcsd_work.o \
lapacke_sbdsdc.o \
lapacke_sbdsdc_work.o \
+lapacke_sbdsvdx.o \
+lapacke_sbdsvdx_work.o \
lapacke_sbdsqr.o \
lapacke_sbdsqr_work.o \
lapacke_sdisna.o \
@@ -1149,6 +1157,8 @@ lapacke_sgesv.o \
lapacke_sgesv_work.o \
lapacke_sgesvd.o \
lapacke_sgesvd_work.o \
+lapacke_sgesvdx.o \
+lapacke_sgesvdx_work.o \
lapacke_sgesvj.o \
lapacke_sgesvj_work.o \
lapacke_sgesvx.o \
@@ -1649,6 +1659,8 @@ lapacke_zgesv.o \
lapacke_zgesv_work.o \
lapacke_zgesvd.o \
lapacke_zgesvd_work.o \
+lapacke_zgesvdx.o \
+lapacke_zgesvdx_work.o \
lapacke_zgesvj.o \
lapacke_zgesvj_work.o \
lapacke_zgesvx.o \
diff --git a/LAPACKE/src/lapacke_cgesvdx.c b/LAPACKE/src/lapacke_cgesvdx.c
new file mode 100644
index 00000000..da0bb070
--- /dev/null
+++ b/LAPACKE/src/lapacke_cgesvdx.c
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function cgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_cgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, lapack_complex_float* u, lapack_int ldu,
+ lapack_complex_float* vt, lapack_int ldvt,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = -1;
+ lapack_complex_float* work = NULL;
+ lapack_complex_float work_query;
+ float* rwork = NULL;
+ lapack_int lrwork = MIN(m,n)*(MIN(m,n)*2+15*MIN(m,n));
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_cgesvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
+ return -6;
+ }
+#endif
+ /* Query optimal working array(s) size */
+ info = LAPACKE_cgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, &work_query, lwork, rwork, iwork );
+ if( info != 0 ) {
+ goto exit_level_0;
+ }
+ lwork = (lapack_int)work_query;
+ /* Allocate memory for work arrays */
+ rwork = (float*)LAPACKE_malloc( sizeof(float) * lwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ work = (lapack_complex_float*)
+ LAPACKE_malloc( sizeof(lapack_complex_float) * lrwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*MIN(m,n)) );
+ if( iwork == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ /* Call middle-level interface */
+ info = LAPACKE_cgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, work, lwork, rwork, iwork );
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*MIN(m,n)-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_2:
+ LAPACKE_free( work );
+exit_level_1:
+ LAPACKE_free( rwork );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_cgesvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_cgesvdx_work.c b/LAPACKE/src/lapacke_cgesvdx_work.c
new file mode 100644
index 00000000..614cdaef
--- /dev/null
+++ b/LAPACKE/src/lapacke_cgesvdx_work.c
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function cgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_cgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, lapack_complex_float* u, lapack_int ldu,
+ lapack_complex_float* vt, lapack_int ldvt,
+ lapack_complex_float* work, lapack_int lwork,
+ float* rwork, lapack_int* iwork )
+{
+ lapack_int info = 0;
+ if( matrix_layout == LAPACK_COL_MAJOR ) {
+ /* Call LAPACK function and adjust info */
+ LAPACK_cgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu, vt, &ldvt,
+ work, &lwork, rwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
+ lapack_int nrows_u = ( LAPACKE_lsame( jobu, 'a' ) ||
+ LAPACKE_lsame( jobu, 's' ) ) ? m : 1;
+ lapack_int ncols_u = LAPACKE_lsame( jobu, 'a' ) ? m :
+ ( LAPACKE_lsame( jobu, 's' ) ? MIN(m,n) : 1);
+ lapack_int nrows_vt = LAPACKE_lsame( jobvt, 'a' ) ? n :
+ ( LAPACKE_lsame( jobvt, 's' ) ? MIN(m,n) : 1);
+ lapack_int lda_t = MAX(1,m);
+ lapack_int ldu_t = MAX(1,nrows_u);
+ lapack_int ldvt_t = MAX(1,nrows_vt);
+ lapack_complex_float* a_t = NULL;
+ lapack_complex_float* u_t = NULL;
+ lapack_complex_float* vt_t = NULL;
+ /* Check leading dimension(s) */
+ if( lda < n ) {
+ info = -8;
+ LAPACKE_xerbla( "LAPACKE_cgesvdx_work", info );
+ return info;
+ }
+ if( ldu < ncols_u ) {
+ info = -16;
+ LAPACKE_xerbla( "LAPACKE_cgesvdx_work", info );
+ return info;
+ }
+ if( ldvt < n ) {
+ info = -18;
+ LAPACKE_xerbla( "LAPACKE_cgesvdx_work", info );
+ return info;
+ }
+ /* Query optimal working array(s) size if requested */
+ if( lwork == -1 ) {
+ LAPACK_cgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, rwork, iwork, &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( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ u_t = (lapack_complex_float*)
+ LAPACKE_malloc( sizeof(lapack_complex_float) * ldu_t * MAX(1,ncols_u) );
+ if( u_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ vt_t = (lapack_complex_float*)
+ LAPACKE_malloc( sizeof(lapack_complex_float) * ldvt_t * MAX(1,n) );
+ if( vt_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ }
+ /* Transpose input matrices */
+ LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
+ /* Call LAPACK function and adjust info */
+ LAPACK_cgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, rwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ /* Transpose output matrices */
+ LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_cge_trans( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t,
+ u, ldu );
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_cge_trans( LAPACK_COL_MAJOR, nrows_vt, n, vt_t, ldvt_t, vt,
+ ldvt );
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_free( vt_t );
+ }
+exit_level_2:
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_free( u_t );
+ }
+exit_level_1:
+ LAPACKE_free( a_t );
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_cgesvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_cgesvdx_work", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_dbdsvdx.c b/LAPACKE/src/lapacke_dbdsvdx.c
new file mode 100644
index 00000000..d116f0db
--- /dev/null
+++ b/LAPACKE/src/lapacke_dbdsvdx.c
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function dbdsvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+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* s, double* z, lapack_int ldz,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = 14*n;
+ double* work = NULL;
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_dbdsvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_d_nancheck( n, d, 1 ) ) {
+ return -6;
+ }
+ if( LAPACKE_d_nancheck( n, e, 1 ) ) {
+ return -7;
+ }
+#endif
+ /* Allocate memory for work arrays */
+ work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*n) );
+ 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,
+ ldz, work, iwork);
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*n-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_1:
+ LAPACKE_free( work );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_dbdsvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_dbdsvdx_work.c b/LAPACKE/src/lapacke_dbdsvdx_work.c
new file mode 100644
index 00000000..255d8f71
--- /dev/null
+++ b/LAPACKE/src/lapacke_dbdsvdx_work.c
@@ -0,0 +1,95 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function dbdsvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+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 info = 0;
+ 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,
+ 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 ldz_t = MAX(1,nrows_z);
+ double* z_t = NULL;
+ /* Check leading dimension(s) */
+ if( ldz < nrows_z ) {
+ info = -3;
+ LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
+ return info;
+ }
+ /* Allocate memory for temporary array(s) */
+ if( LAPACKE_lsame( jobz, 'n' ) ) {
+ z_t = (double*)
+ LAPACKE_malloc( sizeof(double) * ldz_t * 2*n );
+ if( z_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ }
+ /* 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,
+ 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);
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobz, 'n' ) ) {
+ LAPACKE_free( z_t );
+ }
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_dbdsvdx_work", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_dgesvdx.c b/LAPACKE/src/lapacke_dgesvdx.c
new file mode 100644
index 00000000..ec487cea
--- /dev/null
+++ b/LAPACKE/src/lapacke_dgesvdx.c
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function dgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_dgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, double* u, lapack_int ldu,
+ double* vt, lapack_int ldvt,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = -1;
+ double* work = NULL;
+ double work_query;
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_dgesvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
+ return -6;
+ }
+#endif
+ /* Query optimal working array(s) size */
+ info = LAPACKE_dgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, &work_query, lwork, iwork );
+ if( info != 0 ) {
+ goto exit_level_0;
+ }
+ 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_0;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*MIN(m,n)) );
+ if( iwork == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ /* Call middle-level interface */
+ info = LAPACKE_dgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, work, lwork, iwork );
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*MIN(m,n)-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_1:
+ LAPACKE_free( work );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_dgesvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_dgesvdx_work.c b/LAPACKE/src/lapacke_dgesvdx_work.c
new file mode 100644
index 00000000..b334486f
--- /dev/null
+++ b/LAPACKE/src/lapacke_dgesvdx_work.c
@@ -0,0 +1,149 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function dgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_dgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, double* u, lapack_int ldu,
+ double* vt, lapack_int ldvt,
+ double* work, lapack_int lwork, lapack_int* iwork )
+{
+ lapack_int info = 0;
+ if( matrix_layout == LAPACK_COL_MAJOR ) {
+ /* Call LAPACK function and adjust info */
+ LAPACK_dgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu, vt, &ldvt,
+ work, &lwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
+ lapack_int nrows_u = ( LAPACKE_lsame( jobu, 'a' ) ||
+ LAPACKE_lsame( jobu, 's' ) ) ? m : 1;
+ lapack_int ncols_u = LAPACKE_lsame( jobu, 'a' ) ? m :
+ ( LAPACKE_lsame( jobu, 's' ) ? MIN(m,n) : 1);
+ lapack_int nrows_vt = LAPACKE_lsame( jobvt, 'a' ) ? n :
+ ( LAPACKE_lsame( jobvt, 's' ) ? MIN(m,n) : 1);
+ lapack_int lda_t = MAX(1,m);
+ lapack_int ldu_t = MAX(1,nrows_u);
+ lapack_int ldvt_t = MAX(1,nrows_vt);
+ double* a_t = NULL;
+ double* u_t = NULL;
+ double* vt_t = NULL;
+ /* Check leading dimension(s) */
+ if( lda < n ) {
+ info = -8;
+ LAPACKE_xerbla( "LAPACKE_dgesvdx_work", info );
+ return info;
+ }
+ if( ldu < ncols_u ) {
+ info = -16;
+ LAPACKE_xerbla( "LAPACKE_dgesvdx_work", info );
+ return info;
+ }
+ if( ldvt < n ) {
+ info = -18;
+ LAPACKE_xerbla( "LAPACKE_dgesvdx_work", info );
+ return info;
+ }
+ /* Query optimal working array(s) size if requested */
+ if( lwork == -1 ) {
+ LAPACK_dgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, iwork, &info );
+ return (info < 0) ? (info - 1) : 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;
+ }
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ u_t = (double*)
+ LAPACKE_malloc( sizeof(double) * ldu_t * MAX(1,ncols_u) );
+ if( u_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ vt_t = (double*)
+ LAPACKE_malloc( sizeof(double) * ldvt_t * MAX(1,n) );
+ if( vt_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ }
+ /* Transpose input matrices */
+ LAPACKE_dge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
+ /* Call LAPACK function and adjust info */
+ LAPACK_dgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ /* Transpose output matrices */
+ LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t,
+ u, ldu );
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_dge_trans( LAPACK_COL_MAJOR, nrows_vt, n, vt_t, ldvt_t, vt,
+ ldvt );
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_free( vt_t );
+ }
+exit_level_2:
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_free( u_t );
+ }
+exit_level_1:
+ LAPACKE_free( a_t );
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_dgesvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_dgesvdx_work", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_sbdsvdx.c b/LAPACKE/src/lapacke_sbdsvdx.c
new file mode 100644
index 00000000..2d773ba9
--- /dev/null
+++ b/LAPACKE/src/lapacke_sbdsvdx.c
@@ -0,0 +1,89 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function sbdsvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+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* s, float* z, lapack_int ldz,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = 14*n;
+ float* work = NULL;
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_sbdsvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_s_nancheck( n, d, 1 ) ) {
+ return -6;
+ }
+ if( LAPACKE_s_nancheck( n, e, 1 ) ) {
+ return -7;
+ }
+#endif
+ /* Allocate memory for work arrays */
+ work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*n) );
+ 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,
+ ldz, work, iwork);
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*n-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_1:
+ LAPACKE_free( work );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_sbdsvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_sbdsvdx_work.c b/LAPACKE/src/lapacke_sbdsvdx_work.c
new file mode 100644
index 00000000..4f281ef5
--- /dev/null
+++ b/LAPACKE/src/lapacke_sbdsvdx_work.c
@@ -0,0 +1,95 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function sbdsvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+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 info = 0;
+ 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,
+ 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 ldz_t = MAX(1,nrows_z);
+ float* z_t = NULL;
+ /* Check leading dimension(s) */
+ if( ldz < nrows_z ) {
+ info = -3;
+ LAPACKE_xerbla( "LAPACKE_sbdsvdx_work", info );
+ return info;
+ }
+ /* Allocate memory for temporary array(s) */
+ if( LAPACKE_lsame( jobz, 'n' ) ) {
+ z_t = (float*)
+ LAPACKE_malloc( sizeof(float) * ldz_t * 2*n );
+ if( z_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ }
+ /* 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,
+ 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);
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobz, 'n' ) ) {
+ LAPACKE_free( z_t );
+ }
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_sbdsvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_sbdsvdx_work", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_sgesvdx.c b/LAPACKE/src/lapacke_sgesvdx.c
new file mode 100644
index 00000000..c5d727a9
--- /dev/null
+++ b/LAPACKE/src/lapacke_sgesvdx.c
@@ -0,0 +1,96 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function sgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_sgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, float* u, lapack_int ldu,
+ float* vt, lapack_int ldvt,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = -1;
+ float* work = NULL;
+ float work_query;
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_sgesvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) {
+ return -6;
+ }
+#endif
+ /* Query optimal working array(s) size */
+ info = LAPACKE_sgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, &work_query, lwork, iwork );
+ if( info != 0 ) {
+ goto exit_level_0;
+ }
+ lwork = (lapack_int)work_query;
+ /* Allocate memory for work arrays */
+ work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*MIN(m,n)) );
+ if( iwork == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ /* Call middle-level interface */
+ info = LAPACKE_sgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, work, lwork, iwork );
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*MIN(m,n)-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_1:
+ LAPACKE_free( work );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_sgesvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_sgesvdx_work.c b/LAPACKE/src/lapacke_sgesvdx_work.c
new file mode 100644
index 00000000..edab2d16
--- /dev/null
+++ b/LAPACKE/src/lapacke_sgesvdx_work.c
@@ -0,0 +1,149 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function sgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_sgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, float* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ float* s, float* u, lapack_int ldu,
+ float* vt, lapack_int ldvt,
+ 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_sgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu, vt, &ldvt,
+ work, &lwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
+ lapack_int nrows_u = ( LAPACKE_lsame( jobu, 'a' ) ||
+ LAPACKE_lsame( jobu, 's' ) ) ? m : 1;
+ lapack_int ncols_u = LAPACKE_lsame( jobu, 'a' ) ? m :
+ ( LAPACKE_lsame( jobu, 's' ) ? MIN(m,n) : 1);
+ lapack_int nrows_vt = LAPACKE_lsame( jobvt, 'a' ) ? n :
+ ( LAPACKE_lsame( jobvt, 's' ) ? MIN(m,n) : 1);
+ lapack_int lda_t = MAX(1,m);
+ lapack_int ldu_t = MAX(1,nrows_u);
+ lapack_int ldvt_t = MAX(1,nrows_vt);
+ float* a_t = NULL;
+ float* u_t = NULL;
+ float* vt_t = NULL;
+ /* Check leading dimension(s) */
+ if( lda < n ) {
+ info = -8;
+ LAPACKE_xerbla( "LAPACKE_sgesvdx_work", info );
+ return info;
+ }
+ if( ldu < ncols_u ) {
+ info = -16;
+ LAPACKE_xerbla( "LAPACKE_sgesvdx_work", info );
+ return info;
+ }
+ if( ldvt < n ) {
+ info = -18;
+ LAPACKE_xerbla( "LAPACKE_sgesvdx_work", info );
+ return info;
+ }
+ /* Query optimal working array(s) size if requested */
+ if( lwork == -1 ) {
+ LAPACK_sgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_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;
+ }
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ u_t = (float*)
+ LAPACKE_malloc( sizeof(float) * ldu_t * MAX(1,ncols_u) );
+ if( u_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ vt_t = (float*)
+ LAPACKE_malloc( sizeof(float) * ldvt_t * MAX(1,n) );
+ if( vt_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ }
+ /* Transpose input matrices */
+ LAPACKE_sge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
+ /* Call LAPACK function and adjust info */
+ LAPACK_sgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ /* Transpose output matrices */
+ LAPACKE_sge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t,
+ u, ldu );
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_sge_trans( LAPACK_COL_MAJOR, nrows_vt, n, vt_t, ldvt_t, vt,
+ ldvt );
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_free( vt_t );
+ }
+exit_level_2:
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_free( u_t );
+ }
+exit_level_1:
+ LAPACKE_free( a_t );
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_sgesvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_sgesvdx_work", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_zgesvdx.c b/LAPACKE/src/lapacke_zgesvdx.c
new file mode 100644
index 00000000..43220780
--- /dev/null
+++ b/LAPACKE/src/lapacke_zgesvdx.c
@@ -0,0 +1,106 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native high-level C interface to LAPACK function zgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_zgesvdx( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, lapack_complex_double* u, lapack_int ldu,
+ lapack_complex_double* vt, lapack_int ldvt,
+ lapack_int* superb )
+{
+ lapack_int info = 0;
+ lapack_int lwork = -1;
+ lapack_complex_double* work = NULL;
+ lapack_complex_double work_query;
+ double* rwork = NULL;
+ lapack_int lrwork = MIN(m,n)*(MIN(m,n)*2+15*MIN(m,n));
+ lapack_int* iwork = NULL;
+ lapack_int i;
+ if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
+ LAPACKE_xerbla( "LAPACKE_zgesvdx", -1 );
+ return -1;
+ }
+#ifndef LAPACK_DISABLE_NAN_CHECK
+ /* Optionally check input matrices for NaNs */
+ if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
+ return -6;
+ }
+#endif
+ /* Query optimal working array(s) size */
+ info = LAPACKE_zgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, &work_query, lwork, rwork, iwork );
+ if( info != 0 ) {
+ goto exit_level_0;
+ }
+ lwork = (lapack_int)work_query;
+ /* Allocate memory for work arrays */
+ rwork = (double*)LAPACKE_malloc( sizeof(double) * lwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_0;
+ }
+ work = (lapack_complex_double*)
+ LAPACKE_malloc( sizeof(lapack_complex_double) * lrwork );
+ if( work == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * (12*MIN(m,n)) );
+ if( iwork == NULL ) {
+ info = LAPACK_WORK_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ /* Call middle-level interface */
+ info = LAPACKE_zgesvdx_work( matrix_layout, jobu, jobvt, range,
+ m, n, a, lda, vl, vu, il, iu, ns, s, u,
+ ldu, vt, ldvt, work, lwork, rwork, iwork );
+ /* Backup significant data from working array(s) */
+ for( i=0; i<12*MIN(m,n)-1; i++ ) {
+ superb[i] = iwork[i+1];
+ }
+ /* Release memory and exit */
+ LAPACKE_free( iwork );
+exit_level_2:
+ LAPACKE_free( work );
+exit_level_1:
+ LAPACKE_free( rwork );
+exit_level_0:
+ if( info == LAPACK_WORK_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_zgesvdx", info );
+ }
+ return info;
+}
diff --git a/LAPACKE/src/lapacke_zgesvdx_work.c b/LAPACKE/src/lapacke_zgesvdx_work.c
new file mode 100644
index 00000000..91b20165
--- /dev/null
+++ b/LAPACKE/src/lapacke_zgesvdx_work.c
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ Copyright (c) 2014, Intel Corp.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
+*****************************************************************************
+* Contents: Native middle-level C interface to LAPACK function zgesvdx
+* Author: Intel Corporation
+* Generated November, 2011
+*****************************************************************************/
+
+#include "lapacke_utils.h"
+
+lapack_int LAPACKE_zgesvdx_work( int matrix_layout, char jobu, char jobvt, char range,
+ lapack_int m, lapack_int n, lapack_complex_double* a,
+ lapack_int lda, lapack_int vl, lapack_int vu,
+ lapack_int il, lapack_int iu, lapack_int ns,
+ double* s, lapack_complex_double* u, lapack_int ldu,
+ lapack_complex_double* vt, lapack_int ldvt,
+ lapack_complex_double* work, lapack_int lwork,
+ double* rwork, lapack_int* iwork )
+{
+ lapack_int info = 0;
+ if( matrix_layout == LAPACK_COL_MAJOR ) {
+ /* Call LAPACK function and adjust info */
+ LAPACK_zgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu, vt, &ldvt,
+ work, &lwork, rwork, iwork, &info );
+ if( info < 0 ) {
+ info = info - 1;
+ }
+ } else if( matrix_layout == LAPACK_ROW_MAJOR ) {
+ lapack_int nrows_u = ( LAPACKE_lsame( jobu, 'a' ) ||
+ LAPACKE_lsame( jobu, 's' ) ) ? m : 1;
+ lapack_int ncols_u = LAPACKE_lsame( jobu, 'a' ) ? m :
+ ( LAPACKE_lsame( jobu, 's' ) ? MIN(m,n) : 1);
+ lapack_int nrows_vt = LAPACKE_lsame( jobvt, 'a' ) ? n :
+ ( LAPACKE_lsame( jobvt, 's' ) ? MIN(m,n) : 1);
+ lapack_int lda_t = MAX(1,m);
+ lapack_int ldu_t = MAX(1,nrows_u);
+ lapack_int ldvt_t = MAX(1,nrows_vt);
+ lapack_complex_double* a_t = NULL;
+ lapack_complex_double* u_t = NULL;
+ lapack_complex_double* vt_t = NULL;
+ /* Check leading dimension(s) */
+ if( lda < n ) {
+ info = -8;
+ LAPACKE_xerbla( "LAPACKE_zgesvdx_work", info );
+ return info;
+ }
+ if( ldu < ncols_u ) {
+ info = -16;
+ LAPACKE_xerbla( "LAPACKE_zgesvdx_work", info );
+ return info;
+ }
+ if( ldvt < n ) {
+ info = -18;
+ LAPACKE_xerbla( "LAPACKE_zgesvdx_work", info );
+ return info;
+ }
+ /* Query optimal working array(s) size if requested */
+ if( lwork == -1 ) {
+ LAPACK_zgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, rwork, iwork, &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( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ u_t = (lapack_complex_double*)
+ LAPACKE_malloc( sizeof(lapack_complex_double) * ldu_t * MAX(1,ncols_u) );
+ if( u_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_1;
+ }
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ vt_t = (lapack_complex_double*)
+ LAPACKE_malloc( sizeof(lapack_complex_double) * ldvt_t * MAX(1,n) );
+ if( vt_t == NULL ) {
+ info = LAPACK_TRANSPOSE_MEMORY_ERROR;
+ goto exit_level_2;
+ }
+ }
+ /* Transpose input matrices */
+ LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
+ /* Call LAPACK function and adjust info */
+ LAPACK_zgesvdx( &jobu, &jobvt, &range, &m, &n, a, &lda_t, &vl, &vu,
+ &il, &iu, &ns, s, u, &ldu_t, vt,
+ &ldvt_t, work, &lwork, rwork, iwork, &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( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_u, ncols_u, u_t, ldu_t,
+ u, ldu );
+ }
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_zge_trans( LAPACK_COL_MAJOR, nrows_vt, n, vt_t, ldvt_t, vt,
+ ldvt );
+ }
+ /* Release memory and exit */
+ if( LAPACKE_lsame( jobvt, 'a' ) || LAPACKE_lsame( jobvt, 's' ) ) {
+ LAPACKE_free( vt_t );
+ }
+exit_level_2:
+ if( LAPACKE_lsame( jobu, 'a' ) || LAPACKE_lsame( jobu, 's' ) ) {
+ LAPACKE_free( u_t );
+ }
+exit_level_1:
+ LAPACKE_free( a_t );
+exit_level_0:
+ if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
+ LAPACKE_xerbla( "LAPACKE_zgesvdx_work", info );
+ }
+ } else {
+ info = -1;
+ LAPACKE_xerbla( "LAPACKE_zgesvdx_work", info );
+ }
+ return info;
+}