| @@ -53,7 +53,7 @@ float LAPACKE_clantr( int matrix_order, char norm, char uplo, char diag, | |||||
| /* Allocate memory for working array(s) */ | /* Allocate memory for working array(s) */ | ||||
| if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | ||||
| LAPACKE_lsame( norm, '0' ) ) { | 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 ) { | if( work == NULL ) { | ||||
| info = LAPACK_WORK_MEMORY_ERROR; | info = LAPACK_WORK_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| @@ -47,7 +47,7 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo, | |||||
| info = info - 1; | info = info - 1; | ||||
| } | } | ||||
| } else if( matrix_order == LAPACK_ROW_MAJOR ) { | } 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; | lapack_complex_float* a_t = NULL; | ||||
| /* Check leading dimension(s) */ | /* Check leading dimension(s) */ | ||||
| if( lda < n ) { | if( lda < n ) { | ||||
| @@ -57,13 +57,13 @@ float LAPACKE_clantr_work( int matrix_order, char norm, char uplo, | |||||
| } | } | ||||
| /* Allocate memory for temporary array(s) */ | /* Allocate memory for temporary array(s) */ | ||||
| a_t = (lapack_complex_float*) | 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 ) { | if( a_t == NULL ) { | ||||
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| } | } | ||||
| /* Transpose input matrices */ | /* 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 */ | /* Call LAPACK function and adjust info */ | ||||
| res = LAPACK_clantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | res = LAPACK_clantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | ||||
| info = 0; /* LAPACK call is ok! */ | info = 0; /* LAPACK call is ok! */ | ||||
| @@ -53,7 +53,7 @@ double LAPACKE_dlantr( int matrix_order, char norm, char uplo, char diag, | |||||
| /* Allocate memory for working array(s) */ | /* Allocate memory for working array(s) */ | ||||
| if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | ||||
| LAPACKE_lsame( norm, '0' ) ) { | 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 ) { | if( work == NULL ) { | ||||
| info = LAPACK_WORK_MEMORY_ERROR; | info = LAPACK_WORK_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| @@ -46,7 +46,7 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo, | |||||
| info = info - 1; | info = info - 1; | ||||
| } | } | ||||
| } else if( matrix_order == LAPACK_ROW_MAJOR ) { | } 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; | double* a_t = NULL; | ||||
| /* Check leading dimension(s) */ | /* Check leading dimension(s) */ | ||||
| if( lda < n ) { | if( lda < n ) { | ||||
| @@ -55,13 +55,13 @@ double LAPACKE_dlantr_work( int matrix_order, char norm, char uplo, | |||||
| return info; | return info; | ||||
| } | } | ||||
| /* Allocate memory for temporary array(s) */ | /* 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 ) { | if( a_t == NULL ) { | ||||
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| } | } | ||||
| /* Transpose input matrices */ | /* 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 */ | /* Call LAPACK function and adjust info */ | ||||
| res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | ||||
| info = 0; /* LAPACK call is ok! */ | info = 0; /* LAPACK call is ok! */ | ||||
| @@ -53,7 +53,7 @@ float LAPACKE_slantr( int matrix_order, char norm, char uplo, char diag, | |||||
| /* Allocate memory for working array(s) */ | /* Allocate memory for working array(s) */ | ||||
| if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | ||||
| LAPACKE_lsame( norm, '0' ) ) { | 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 ) { | if( work == NULL ) { | ||||
| info = LAPACK_WORK_MEMORY_ERROR; | info = LAPACK_WORK_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| @@ -46,7 +46,7 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo, | |||||
| info = info - 1; | info = info - 1; | ||||
| } | } | ||||
| } else if( matrix_order == LAPACK_ROW_MAJOR ) { | } 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; | float* a_t = NULL; | ||||
| /* Check leading dimension(s) */ | /* Check leading dimension(s) */ | ||||
| if( lda < n ) { | if( lda < n ) { | ||||
| @@ -55,13 +55,13 @@ float LAPACKE_slantr_work( int matrix_order, char norm, char uplo, | |||||
| return info; | return info; | ||||
| } | } | ||||
| /* Allocate memory for temporary array(s) */ | /* 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 ) { | if( a_t == NULL ) { | ||||
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| } | } | ||||
| /* Transpose input matrices */ | /* 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 */ | /* Call LAPACK function and adjust info */ | ||||
| res = LAPACK_slantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | res = LAPACK_slantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | ||||
| info = 0; /* LAPACK call is ok! */ | info = 0; /* LAPACK call is ok! */ | ||||
| @@ -53,7 +53,7 @@ double LAPACKE_zlantr( int matrix_order, char norm, char uplo, char diag, | |||||
| /* Allocate memory for working array(s) */ | /* Allocate memory for working array(s) */ | ||||
| if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) || | ||||
| LAPACKE_lsame( norm, '0' ) ) { | 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 ) { | if( work == NULL ) { | ||||
| info = LAPACK_WORK_MEMORY_ERROR; | info = LAPACK_WORK_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| @@ -47,7 +47,7 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo, | |||||
| info = info - 1; | info = info - 1; | ||||
| } | } | ||||
| } else if( matrix_order == LAPACK_ROW_MAJOR ) { | } 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; | lapack_complex_double* a_t = NULL; | ||||
| /* Check leading dimension(s) */ | /* Check leading dimension(s) */ | ||||
| if( lda < n ) { | if( lda < n ) { | ||||
| @@ -57,13 +57,13 @@ double LAPACKE_zlantr_work( int matrix_order, char norm, char uplo, | |||||
| } | } | ||||
| /* Allocate memory for temporary array(s) */ | /* Allocate memory for temporary array(s) */ | ||||
| a_t = (lapack_complex_double*) | 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 ) { | if( a_t == NULL ) { | ||||
| info = LAPACK_TRANSPOSE_MEMORY_ERROR; | info = LAPACK_TRANSPOSE_MEMORY_ERROR; | ||||
| goto exit_level_0; | goto exit_level_0; | ||||
| } | } | ||||
| /* Transpose input matrices */ | /* 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 */ | /* Call LAPACK function and adjust info */ | ||||
| res = LAPACK_zlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | res = LAPACK_zlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work ); | ||||
| info = 0; /* LAPACK call is ok! */ | info = 0; /* LAPACK call is ok! */ | ||||