@@ -42,10 +42,7 @@ lapack_int LAPACKE_zlacpy_work( int matrix_layout, char uplo, lapack_int m,
4242 /* Call LAPACK function and adjust info */
4343 LAPACK_zlacpy ( & uplo , & m , & n , a , & lda , b , & ldb );
4444 } else if ( matrix_layout == LAPACK_ROW_MAJOR ) {
45- lapack_int lda_t = MAX (1 ,m );
46- lapack_int ldb_t = MAX (1 ,m );
47- lapack_complex_double * a_t = NULL ;
48- lapack_complex_double * b_t = NULL ;
45+ char uplo_t = uplo ;
4946 /* Check leading dimension(s) */
5047 if ( lda < n ) {
5148 info = -6 ;
@@ -57,34 +54,13 @@ lapack_int LAPACKE_zlacpy_work( int matrix_layout, char uplo, lapack_int m,
5754 LAPACKE_xerbla ( "LAPACKE_zlacpy_work" , info );
5855 return info ;
5956 }
60- /* Allocate memory for temporary array(s) */
61- a_t = (lapack_complex_double * )
62- LAPACKE_malloc ( sizeof (lapack_complex_double ) * lda_t * MAX (1 ,n ) );
63- if ( a_t == NULL ) {
64- info = LAPACK_TRANSPOSE_MEMORY_ERROR ;
65- goto exit_level_0 ;
57+ if ( uplo == 'U' || uplo == 'u' ) {
58+ uplo_t = 'L' ;
59+ } else if ( uplo == 'L' || uplo == 'l' ) {
60+ uplo_t = 'U' ;
6661 }
67- b_t = (lapack_complex_double * )
68- LAPACKE_malloc ( sizeof (lapack_complex_double ) * ldb_t * MAX (1 ,n ) );
69- if ( b_t == NULL ) {
70- info = LAPACK_TRANSPOSE_MEMORY_ERROR ;
71- goto exit_level_1 ;
72- }
73- /* Transpose input matrices */
74- LAPACKE_zge_trans ( matrix_layout , m , n , a , lda , a_t , lda_t );
75- /* Call LAPACK function and adjust info */
76- LAPACK_zlacpy ( & uplo , & m , & n , a_t , & lda_t , b_t , & ldb_t );
62+ LAPACK_zlacpy ( & uplo_t , & n , & m , a , & lda , b , & ldb );
7763 info = 0 ; /* LAPACK call is ok! */
78- /* Transpose output matrices */
79- LAPACKE_zge_trans ( LAPACK_COL_MAJOR , m , n , b_t , ldb_t , b , ldb );
80- /* Release memory and exit */
81- LAPACKE_free ( b_t );
82- exit_level_1 :
83- LAPACKE_free ( a_t );
84- exit_level_0 :
85- if ( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
86- LAPACKE_xerbla ( "LAPACKE_zlacpy_work" , info );
87- }
8864 } else {
8965 info = -1 ;
9066 LAPACKE_xerbla ( "LAPACKE_zlacpy_work" , info );
0 commit comments