Browse Source

Merge pull request #634 from kortschak/lantr-trans-prep

Fix lantr preparation for row major matrices
tags/v0.2.15^2
Zhang Xianyi 10 years ago
parent
commit
22353b1727
8 changed files with 16 additions and 16 deletions
  1. +1
    -1
      lapack-netlib/lapacke/src/lapacke_clantr.c
  2. +3
    -3
      lapack-netlib/lapacke/src/lapacke_clantr_work.c
  3. +1
    -1
      lapack-netlib/lapacke/src/lapacke_dlantr.c
  4. +3
    -3
      lapack-netlib/lapacke/src/lapacke_dlantr_work.c
  5. +1
    -1
      lapack-netlib/lapacke/src/lapacke_slantr.c
  6. +3
    -3
      lapack-netlib/lapacke/src/lapacke_slantr_work.c
  7. +1
    -1
      lapack-netlib/lapacke/src/lapacke_zlantr.c
  8. +3
    -3
      lapack-netlib/lapacke/src/lapacke_zlantr_work.c

+ 1
- 1
lapack-netlib/lapacke/src/lapacke_clantr.c View File

@@ -53,7 +53,7 @@ float LAPACKE_clantr( int matrix_order, char norm, char uplo, char diag,
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
LAPACKE_lsame( norm, '0' ) ) {
work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;


+ 3
- 3
lapack-netlib/lapacke/src/lapacke_clantr_work.c View File

@@ -47,7 +47,7 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo,
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int lda_t = MAX(1,m);
lapack_complex_float* a_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
@@ -57,13 +57,13 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo,
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_float*)
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,MAX(m,n)) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_ctr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
LAPACKE_ctr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
res = LAPACK_clantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
info = 0; /* LAPACK call is ok! */


+ 1
- 1
lapack-netlib/lapacke/src/lapacke_dlantr.c View File

@@ -53,7 +53,7 @@ double LAPACKE_dlantr( int matrix_order, char norm, char uplo, char diag,
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
LAPACKE_lsame( norm, '0' ) ) {
work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;


+ 3
- 3
lapack-netlib/lapacke/src/lapacke_dlantr_work.c View File

@@ -46,7 +46,7 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo,
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int lda_t = MAX(1,m);
double* a_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
@@ -55,13 +55,13 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo,
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,MAX(m,n)) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_dtr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
LAPACKE_dtr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
info = 0; /* LAPACK call is ok! */


+ 1
- 1
lapack-netlib/lapacke/src/lapacke_slantr.c View File

@@ -53,7 +53,7 @@ float LAPACKE_slantr( int matrix_order, char norm, char uplo, char diag,
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
LAPACKE_lsame( norm, '0' ) ) {
work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;


+ 3
- 3
lapack-netlib/lapacke/src/lapacke_slantr_work.c View File

@@ -46,7 +46,7 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo,
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int lda_t = MAX(1,m);
float* a_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
@@ -55,13 +55,13 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo,
return info;
}
/* Allocate memory for temporary array(s) */
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,MAX(m,n)) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_str_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
LAPACKE_str_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
res = LAPACK_slantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
info = 0; /* LAPACK call is ok! */


+ 1
- 1
lapack-netlib/lapacke/src/lapacke_zlantr.c View File

@@ -53,7 +53,7 @@ double LAPACKE_zlantr( int matrix_order, char norm, char uplo, char diag,
/* Allocate memory for working array(s) */
if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
LAPACKE_lsame( norm, '0' ) ) {
work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
if( work == NULL ) {
info = LAPACK_WORK_MEMORY_ERROR;
goto exit_level_0;


+ 3
- 3
lapack-netlib/lapacke/src/lapacke_zlantr_work.c View File

@@ -47,7 +47,7 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo,
info = info - 1;
}
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
lapack_int lda_t = MAX(1,n);
lapack_int lda_t = MAX(1,m);
lapack_complex_double* a_t = NULL;
/* Check leading dimension(s) */
if( lda < n ) {
@@ -57,13 +57,13 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo,
}
/* Allocate memory for temporary array(s) */
a_t = (lapack_complex_double*)
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,MAX(m,n)) );
if( a_t == NULL ) {
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
goto exit_level_0;
}
/* Transpose input matrices */
LAPACKE_ztr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
LAPACKE_ztr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
/* Call LAPACK function and adjust info */
res = LAPACK_zlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
info = 0; /* LAPACK call is ok! */


Loading…
Cancel
Save