Correcting Bug 129
authorjulie <julielangou@users.noreply.github.com>
Wed, 26 Aug 2015 04:46:55 +0000 (04:46 +0000)
committerjulie <julielangou@users.noreply.github.com>
Wed, 26 Aug 2015 04:46:55 +0000 (04:46 +0000)
See http://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4747

 Modify LAPACK_?syconv interface  - Work is used to return values

 (1) Remove the local work variable and its allocation and deallocation
 (2) Add work in LAPACK_?syconv interface
 (3) Update lapacke.h

LAPACKE/include/lapacke.h
LAPACKE/src/lapacke_csyconv.c
LAPACKE/src/lapacke_dsyconv.c
LAPACKE/src/lapacke_ssyconv.c
LAPACKE/src/lapacke_zsyconv.c

index 13d4e23..1a079e8 100644 (file)
@@ -10291,7 +10291,7 @@ lapack_int LAPACKE_chetrs2_work( int matrix_layout, char uplo, lapack_int n,
                                  lapack_complex_float* work );
 lapack_int LAPACKE_csyconv( int matrix_layout, char uplo, char way, lapack_int n,
                             lapack_complex_float* a, lapack_int lda,
-                            const lapack_int* ipiv );
+                            const lapack_int* ipiv, lapack_complex_float* work  );
 lapack_int LAPACKE_csyconv_work( int matrix_layout, char uplo, char way,
                                  lapack_int n, lapack_complex_float* a,
                                  lapack_int lda, const lapack_int* ipiv,
@@ -10430,7 +10430,7 @@ lapack_int LAPACKE_dorcsd_work( int matrix_layout, char jobu1, char jobu2,
                                 double* work, lapack_int lwork,
                                 lapack_int* iwork );
 lapack_int LAPACKE_dsyconv( int matrix_layout, char uplo, char way, lapack_int n,
-                            double* a, lapack_int lda, const lapack_int* ipiv );
+                            double* a, lapack_int lda, const lapack_int* ipiv, double* work);
 lapack_int LAPACKE_dsyconv_work( int matrix_layout, char uplo, char way,
                                  lapack_int n, double* a, lapack_int lda,
                                  const lapack_int* ipiv, double* work );
@@ -10512,7 +10512,7 @@ lapack_int LAPACKE_sorcsd_work( int matrix_layout, char jobu1, char jobu2,
                                 float* work, lapack_int lwork,
                                 lapack_int* iwork );
 lapack_int LAPACKE_ssyconv( int matrix_layout, char uplo, char way, lapack_int n,
-                            float* a, lapack_int lda, const lapack_int* ipiv );
+                            float* a, lapack_int lda, const lapack_int* ipiv, float* work );
 lapack_int LAPACKE_ssyconv_work( int matrix_layout, char uplo, char way,
                                  lapack_int n, float* a, lapack_int lda,
                                  const lapack_int* ipiv, float* work );
@@ -10593,7 +10593,7 @@ lapack_int LAPACKE_zhetrs2_work( int matrix_layout, char uplo, lapack_int n,
                                  lapack_complex_double* work );
 lapack_int LAPACKE_zsyconv( int matrix_layout, char uplo, char way, lapack_int n,
                             lapack_complex_double* a, lapack_int lda,
-                            const lapack_int* ipiv );
+                            const lapack_int* ipiv, lapack_complex_double* work );
 lapack_int LAPACKE_zsyconv_work( int matrix_layout, char uplo, char way,
                                  lapack_int n, lapack_complex_double* a,
                                  lapack_int lda, const lapack_int* ipiv,
index d937ef2..2d6ca41 100644 (file)
 
 lapack_int LAPACKE_csyconv( int matrix_layout, char uplo, char way, lapack_int n,
                             lapack_complex_float* a, lapack_int lda,
-                            const lapack_int* ipiv )
+                            const lapack_int* ipiv,
+                            lapack_complex_float* work )
 {
     lapack_int info = 0;
-    lapack_complex_float* work = NULL;
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_csyconv", -1 );
         return -1;
@@ -49,18 +49,9 @@ lapack_int LAPACKE_csyconv( int matrix_layout, char uplo, char way, lapack_int n
         return -5;
     }
 #endif
-    /* Allocate memory for working array(s) */
-    work = (lapack_complex_float*)
-        LAPACKE_malloc( sizeof(lapack_complex_float) * MAX(1,n) );
-    if( work == NULL ) {
-        info = LAPACK_WORK_MEMORY_ERROR;
-        goto exit_level_0;
-    }
     /* Call middle-level interface */
     info = LAPACKE_csyconv_work( matrix_layout, uplo, way, n, a, lda, ipiv,
                                  work );
-    /* Release memory and exit */
-    LAPACKE_free( work );
 exit_level_0:
     if( info == LAPACK_WORK_MEMORY_ERROR ) {
         LAPACKE_xerbla( "LAPACKE_csyconv", info );
index ed841f2..357f1a7 100644 (file)
 #include "lapacke_utils.h"
 
 lapack_int LAPACKE_dsyconv( int matrix_layout, char uplo, char way, lapack_int n,
-                            double* a, lapack_int lda, const lapack_int* ipiv )
+                            double* a, lapack_int lda, const lapack_int* ipiv, double* work )
 {
     lapack_int info = 0;
-    double* work = NULL;
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_dsyconv", -1 );
         return -1;
@@ -48,17 +47,10 @@ lapack_int LAPACKE_dsyconv( int matrix_layout, char uplo, char way, lapack_int n
         return -5;
     }
 #endif
-    /* Allocate memory for working array(s) */
-    work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,n) );
-    if( work == NULL ) {
-        info = LAPACK_WORK_MEMORY_ERROR;
-        goto exit_level_0;
-    }
+  
     /* Call middle-level interface */
     info = LAPACKE_dsyconv_work( matrix_layout, uplo, way, n, a, lda, ipiv,
                                  work );
-    /* Release memory and exit */
-    LAPACKE_free( work );
 exit_level_0:
     if( info == LAPACK_WORK_MEMORY_ERROR ) {
         LAPACKE_xerbla( "LAPACKE_dsyconv", info );
index b6c34a5..402f373 100644 (file)
 #include "lapacke_utils.h"
 
 lapack_int LAPACKE_ssyconv( int matrix_layout, char uplo, char way, lapack_int n,
-                            float* a, lapack_int lda, const lapack_int* ipiv )
+                            float* a, lapack_int lda, const lapack_int* ipiv, float* work )
 {
     lapack_int info = 0;
-    float* work = NULL;
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_ssyconv", -1 );
         return -1;
@@ -48,17 +47,10 @@ lapack_int LAPACKE_ssyconv( int matrix_layout, char uplo, char way, lapack_int n
         return -5;
     }
 #endif
-    /* Allocate memory for working array(s) */
-    work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,n) );
-    if( work == NULL ) {
-        info = LAPACK_WORK_MEMORY_ERROR;
-        goto exit_level_0;
-    }
+   
     /* Call middle-level interface */
     info = LAPACKE_ssyconv_work( matrix_layout, uplo, way, n, a, lda, ipiv,
                                  work );
-    /* Release memory and exit */
-    LAPACKE_free( work );
 exit_level_0:
     if( info == LAPACK_WORK_MEMORY_ERROR ) {
         LAPACKE_xerbla( "LAPACKE_ssyconv", info );
index d483358..933e3d5 100644 (file)
 
 lapack_int LAPACKE_zsyconv( int matrix_layout, char uplo, char way, lapack_int n,
                             lapack_complex_double* a, lapack_int lda,
-                            const lapack_int* ipiv )
+                            const lapack_int* ipiv,
+                            lapack_complex_double* work )
 {
     lapack_int info = 0;
-    lapack_complex_double* work = NULL;
     if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
         LAPACKE_xerbla( "LAPACKE_zsyconv", -1 );
         return -1;
@@ -49,18 +49,10 @@ lapack_int LAPACKE_zsyconv( int matrix_layout, char uplo, char way, lapack_int n
         return -5;
     }
 #endif
-    /* Allocate memory for working array(s) */
-    work = (lapack_complex_double*)
-        LAPACKE_malloc( sizeof(lapack_complex_double) * MAX(1,n) );
-    if( work == NULL ) {
-        info = LAPACK_WORK_MEMORY_ERROR;
-        goto exit_level_0;
-    }
     /* Call middle-level interface */
     info = LAPACKE_zsyconv_work( matrix_layout, uplo, way, n, a, lda, ipiv,
                                  work );
-    /* Release memory and exit */
-    LAPACKE_free( work );
+
 exit_level_0:
     if( info == LAPACK_WORK_MEMORY_ERROR ) {
         LAPACKE_xerbla( "LAPACKE_zsyconv", info );