1 Description: Dlange gives inconsistent/incorrect results for RowMajor (upstream bug #137)
2 Origin: backport, commit: r1602
3 Bug: https://icl.cs.utk.edu/lapack-forum/viewtopic.php?f=13&t=4789&p=0#p0
4 Reviewed-by: Sébastien Villemot <sebastien@debian.org>
5 Last-Update: 2015-10-31
7 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
8 --- a/lapacke/src/lapacke_clantr.c
9 +++ b/lapacke/src/lapacke_clantr.c
10 @@ -53,7 +53,7 @@ float LAPACKE_clantr( int matrix_order,
11 /* Allocate memory for working array(s) */
12 if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
13 LAPACKE_lsame( norm, 'O' ) ) {
14 - work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
15 + work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
17 info = LAPACK_WORK_MEMORY_ERROR;
19 --- a/lapacke/src/lapacke_clantr_work.c
20 +++ b/lapacke/src/lapacke_clantr_work.c
21 @@ -47,7 +47,7 @@ float LAPACKE_clantr_work( int matrix_or
24 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
25 - lapack_int lda_t = MAX(1,n);
26 + lapack_int lda_t = MAX(1,m);
27 lapack_complex_float* a_t = NULL;
28 /* Check leading dimension(s) */
30 @@ -57,13 +57,13 @@ float LAPACKE_clantr_work( int matrix_or
32 /* Allocate memory for temporary array(s) */
33 a_t = (lapack_complex_float*)
34 - LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
35 + LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,MAX(m,n)) );
37 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
40 /* Transpose input matrices */
41 - LAPACKE_ctr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
42 + LAPACKE_ctr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
43 /* Call LAPACK function and adjust info */
44 res = LAPACK_clantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
45 info = 0; /* LAPACK call is ok! */
46 --- a/lapacke/src/lapacke_dlantr.c
47 +++ b/lapacke/src/lapacke_dlantr.c
48 @@ -53,7 +53,7 @@ double LAPACKE_dlantr( int matrix_order,
49 /* Allocate memory for working array(s) */
50 if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
51 LAPACKE_lsame( norm, 'O' ) ) {
52 - work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
53 + work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
55 info = LAPACK_WORK_MEMORY_ERROR;
57 --- a/lapacke/src/lapacke_dlantr_work.c
58 +++ b/lapacke/src/lapacke_dlantr_work.c
59 @@ -46,7 +46,7 @@ double LAPACKE_dlantr_work( int matrix_o
62 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
63 - lapack_int lda_t = MAX(1,n);
64 + lapack_int lda_t = MAX(1,m);
66 /* Check leading dimension(s) */
68 @@ -55,13 +55,13 @@ double LAPACKE_dlantr_work( int matrix_o
71 /* Allocate memory for temporary array(s) */
72 - a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
73 + a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,MAX(m,n)) );
75 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
78 /* Transpose input matrices */
79 - LAPACKE_dtr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
80 + LAPACKE_dtr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
81 /* Call LAPACK function and adjust info */
82 res = LAPACK_dlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
83 info = 0; /* LAPACK call is ok! */
84 --- a/lapacke/src/lapacke_slantr.c
85 +++ b/lapacke/src/lapacke_slantr.c
86 @@ -53,7 +53,7 @@ float LAPACKE_slantr( int matrix_order,
87 /* Allocate memory for working array(s) */
88 if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
89 LAPACKE_lsame( norm, 'O' ) ) {
90 - work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,m) );
91 + work = (float*)LAPACKE_malloc( sizeof(float) * MAX(1,MAX(m,n)) );
93 info = LAPACK_WORK_MEMORY_ERROR;
95 --- a/lapacke/src/lapacke_slantr_work.c
96 +++ b/lapacke/src/lapacke_slantr_work.c
97 @@ -46,7 +46,7 @@ float LAPACKE_slantr_work( int matrix_or
100 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
101 - lapack_int lda_t = MAX(1,n);
102 + lapack_int lda_t = MAX(1,m);
104 /* Check leading dimension(s) */
106 @@ -55,13 +55,13 @@ float LAPACKE_slantr_work( int matrix_or
109 /* Allocate memory for temporary array(s) */
110 - a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
111 + a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,MAX(m,n)) );
113 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
116 /* Transpose input matrices */
117 - LAPACKE_str_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
118 + LAPACKE_str_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
119 /* Call LAPACK function and adjust info */
120 res = LAPACK_slantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
121 info = 0; /* LAPACK call is ok! */
122 --- a/lapacke/src/lapacke_zlantr.c
123 +++ b/lapacke/src/lapacke_zlantr.c
124 @@ -53,7 +53,7 @@ double LAPACKE_zlantr( int matrix_order,
125 /* Allocate memory for working array(s) */
126 if( LAPACKE_lsame( norm, 'i' ) || LAPACKE_lsame( norm, '1' ) ||
127 LAPACKE_lsame( norm, 'O' ) ) {
128 - work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,m) );
129 + work = (double*)LAPACKE_malloc( sizeof(double) * MAX(1,MAX(m,n)) );
131 info = LAPACK_WORK_MEMORY_ERROR;
133 --- a/lapacke/src/lapacke_zlantr_work.c
134 +++ b/lapacke/src/lapacke_zlantr_work.c
135 @@ -47,7 +47,7 @@ double LAPACKE_zlantr_work( int matrix_o
138 } else if( matrix_order == LAPACK_ROW_MAJOR ) {
139 - lapack_int lda_t = MAX(1,n);
140 + lapack_int lda_t = MAX(1,m);
141 lapack_complex_double* a_t = NULL;
142 /* Check leading dimension(s) */
144 @@ -57,13 +57,13 @@ double LAPACKE_zlantr_work( int matrix_o
146 /* Allocate memory for temporary array(s) */
147 a_t = (lapack_complex_double*)
148 - LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
149 + LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,MAX(m,n)) );
151 info = LAPACK_TRANSPOSE_MEMORY_ERROR;
154 /* Transpose input matrices */
155 - LAPACKE_ztr_trans( matrix_order, uplo, diag, n, a, lda, a_t, lda_t );
156 + LAPACKE_ztr_trans( matrix_order, uplo, diag, MAX(m,n), a, lda, a_t, lda_t );
157 /* Call LAPACK function and adjust info */
158 res = LAPACK_zlantr( &norm, &uplo, &diag, &m, &n, a_t, &lda_t, work );
159 info = 0; /* LAPACK call is ok! */