Browse Source

Allocate work array when ijob is zero (Reference-LAPACK PR 733)

tags/v0.3.22^2
Martin Kroeker GitHub 2 years ago
parent
commit
d59dcd7b16
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 36 deletions
  1. +5
    -9
      lapack-netlib/LAPACKE/src/lapacke_ctgsen.c
  2. +5
    -9
      lapack-netlib/LAPACKE/src/lapacke_dtgsen.c
  3. +5
    -9
      lapack-netlib/LAPACKE/src/lapacke_stgsen.c
  4. +5
    -9
      lapack-netlib/LAPACKE/src/lapacke_ztgsen.c

+ 5
- 9
lapack-netlib/LAPACKE/src/lapacke_ctgsen.c View File

@@ -86,12 +86,10 @@ lapack_int LAPACKE_ctgsen( int matrix_layout, lapack_int ijob,
liwork = iwork_query; liwork = iwork_query;
lwork = LAPACK_C2INT( work_query ); lwork = LAPACK_C2INT( work_query );
/* Allocate memory for work arrays */ /* Allocate memory for work arrays */
if( ijob != 0 ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
} }
work = (lapack_complex_float*) work = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork ); LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
@@ -106,9 +104,7 @@ lapack_int LAPACKE_ctgsen( int matrix_layout, lapack_int ijob,
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( work ); LAPACKE_free( work );
exit_level_1: exit_level_1:
if( ijob != 0 ) {
LAPACKE_free( iwork );
}
LAPACKE_free( iwork );
exit_level_0: exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) { if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ctgsen", info ); LAPACKE_xerbla( "LAPACKE_ctgsen", info );


+ 5
- 9
lapack-netlib/LAPACKE/src/lapacke_dtgsen.c View File

@@ -83,12 +83,10 @@ lapack_int LAPACKE_dtgsen( int matrix_layout, lapack_int ijob,
liwork = iwork_query; liwork = iwork_query;
lwork = (lapack_int)work_query; lwork = (lapack_int)work_query;
/* Allocate memory for work arrays */ /* Allocate memory for work arrays */
if( ijob != 0 ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
} }
work = (double*)LAPACKE_malloc( sizeof(double) * lwork ); work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
if( work == NULL ) { if( work == NULL ) {
@@ -103,9 +101,7 @@ lapack_int LAPACKE_dtgsen( int matrix_layout, lapack_int ijob,
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( work ); LAPACKE_free( work );
exit_level_1: exit_level_1:
if( ijob != 0 ) {
LAPACKE_free( iwork );
}
LAPACKE_free( iwork );
exit_level_0: exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) { if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_dtgsen", info ); LAPACKE_xerbla( "LAPACKE_dtgsen", info );


+ 5
- 9
lapack-netlib/LAPACKE/src/lapacke_stgsen.c View File

@@ -83,12 +83,10 @@ lapack_int LAPACKE_stgsen( int matrix_layout, lapack_int ijob,
liwork = iwork_query; liwork = iwork_query;
lwork = (lapack_int)work_query; lwork = (lapack_int)work_query;
/* Allocate memory for work arrays */ /* Allocate memory for work arrays */
if( ijob != 0 ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
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 ); work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
if( work == NULL ) { if( work == NULL ) {
@@ -103,9 +101,7 @@ lapack_int LAPACKE_stgsen( int matrix_layout, lapack_int ijob,
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( work ); LAPACKE_free( work );
exit_level_1: exit_level_1:
if( ijob != 0 ) {
LAPACKE_free( iwork );
}
LAPACKE_free( iwork );
exit_level_0: exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) { if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_stgsen", info ); LAPACKE_xerbla( "LAPACKE_stgsen", info );


+ 5
- 9
lapack-netlib/LAPACKE/src/lapacke_ztgsen.c View File

@@ -86,12 +86,10 @@ lapack_int LAPACKE_ztgsen( int matrix_layout, lapack_int ijob,
liwork = iwork_query; liwork = iwork_query;
lwork = LAPACK_Z2INT( work_query ); lwork = LAPACK_Z2INT( work_query );
/* Allocate memory for work arrays */ /* Allocate memory for work arrays */
if( ijob != 0 ) {
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
}
iwork = (lapack_int*)LAPACKE_malloc( sizeof(lapack_int) * liwork );
if( iwork == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;
} }
work = (lapack_complex_double*) work = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork ); LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
@@ -106,9 +104,7 @@ lapack_int LAPACKE_ztgsen( int matrix_layout, lapack_int ijob,
/* Release memory and exit */ /* Release memory and exit */
LAPACKE_free( work ); LAPACKE_free( work );
exit_level_1: exit_level_1:
if( ijob != 0 ) {
LAPACKE_free( iwork );
}
LAPACKE_free( iwork );
exit_level_0: exit_level_0:
if( info == LAPACK_WORK_MEMORY_ERROR ) { if( info == LAPACK_WORK_MEMORY_ERROR ) {
LAPACKE_xerbla( "LAPACKE_ztgsen", info ); LAPACKE_xerbla( "LAPACKE_ztgsen", info );


Loading…
Cancel
Save