Skip to content

Commit 90aa8e2

Browse files
committed
Refs #615. Import bug fixes for LAPACKE dormlq.
1 parent 11ac466 commit 90aa8e2

4 files changed

Lines changed: 36 additions & 28 deletions

File tree

lapack-netlib/lapacke/src/lapacke_cunmlq_work.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************************
2-
Copyright (c) 2011, Intel Corp.
2+
Copyright (c) 2014, Intel Corp.
33
All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
@@ -33,28 +33,30 @@
3333

3434
#include "lapacke_utils.h"
3535

36-
lapack_int LAPACKE_cunmlq_work( int matrix_order, char side, char trans,
36+
lapack_int LAPACKE_cunmlq_work( int matrix_layout, char side, char trans,
3737
lapack_int m, lapack_int n, lapack_int k,
3838
const lapack_complex_float* a, lapack_int lda,
3939
const lapack_complex_float* tau,
4040
lapack_complex_float* c, lapack_int ldc,
4141
lapack_complex_float* work, lapack_int lwork )
4242
{
4343
lapack_int info = 0;
44-
if( matrix_order == LAPACK_COL_MAJOR ) {
44+
lapack_int r;
45+
if( matrix_layout == LAPACK_COL_MAJOR ) {
4546
/* Call LAPACK function and adjust info */
4647
LAPACK_cunmlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
4748
&lwork, &info );
4849
if( info < 0 ) {
4950
info = info - 1;
5051
}
51-
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
52+
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53+
r = LAPACKE_lsame( side, 'l' ) ? m : n;
5254
lapack_int lda_t = MAX(1,k);
5355
lapack_int ldc_t = MAX(1,m);
5456
lapack_complex_float* a_t = NULL;
5557
lapack_complex_float* c_t = NULL;
5658
/* Check leading dimension(s) */
57-
if( lda < m ) {
59+
if( lda < r ) {
5860
info = -8;
5961
LAPACKE_xerbla( "LAPACKE_cunmlq_work", info );
6062
return info;
@@ -84,8 +86,8 @@ lapack_int LAPACKE_cunmlq_work( int matrix_order, char side, char trans,
8486
goto exit_level_1;
8587
}
8688
/* Transpose input matrices */
87-
LAPACKE_cge_trans( matrix_order, k, m, a, lda, a_t, lda_t );
88-
LAPACKE_cge_trans( matrix_order, m, n, c, ldc, c_t, ldc_t );
89+
LAPACKE_cge_trans( matrix_layout, k, m, a, lda, a_t, lda_t );
90+
LAPACKE_cge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
8991
/* Call LAPACK function and adjust info */
9092
LAPACK_cunmlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t,
9193
work, &lwork, &info );

lapack-netlib/lapacke/src/lapacke_dormlq_work.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************************
2-
Copyright (c) 2011, Intel Corp.
2+
Copyright (c) 2014, Intel Corp.
33
All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
@@ -33,27 +33,29 @@
3333

3434
#include "lapacke_utils.h"
3535

36-
lapack_int LAPACKE_dormlq_work( int matrix_order, char side, char trans,
36+
lapack_int LAPACKE_dormlq_work( int matrix_layout, char side, char trans,
3737
lapack_int m, lapack_int n, lapack_int k,
3838
const double* a, lapack_int lda,
3939
const double* tau, double* c, lapack_int ldc,
4040
double* work, lapack_int lwork )
4141
{
4242
lapack_int info = 0;
43+
lapack_int r;
4344
lapack_int lda_t, ldc_t;
4445
double *a_t = NULL, *c_t = NULL;
45-
if( matrix_order == LAPACK_COL_MAJOR ) {
46+
if( matrix_layout == LAPACK_COL_MAJOR ) {
4647
/* Call LAPACK function and adjust info */
4748
LAPACK_dormlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
4849
&lwork, &info );
4950
if( info < 0 ) {
5051
info = info - 1;
5152
}
52-
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
53+
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54+
r = LAPACKE_lsame( side, 'l' ) ? m : n;
5355
lda_t = MAX(1,k);
5456
ldc_t = MAX(1,m);
5557
/* Check leading dimension(s) */
56-
if( lda < m ) {
58+
if( lda < r ) {
5759
info = -8;
5860
LAPACKE_xerbla( "LAPACKE_dormlq_work", info );
5961
return info;
@@ -81,8 +83,8 @@ lapack_int LAPACKE_dormlq_work( int matrix_order, char side, char trans,
8183
goto exit_level_1;
8284
}
8385
/* Transpose input matrices */
84-
LAPACKE_dge_trans( matrix_order, k, m, a, lda, a_t, lda_t );
85-
LAPACKE_dge_trans( matrix_order, m, n, c, ldc, c_t, ldc_t );
86+
LAPACKE_dge_trans( matrix_layout, k, m, a, lda, a_t, lda_t );
87+
LAPACKE_dge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
8688
/* Call LAPACK function and adjust info */
8789
LAPACK_dormlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t,
8890
work, &lwork, &info );

lapack-netlib/lapacke/src/lapacke_sormlq_work.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************************
2-
Copyright (c) 2011, Intel Corp.
2+
Copyright (c) 2014, Intel Corp.
33
All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
@@ -33,27 +33,29 @@
3333

3434
#include "lapacke_utils.h"
3535

36-
lapack_int LAPACKE_sormlq_work( int matrix_order, char side, char trans,
36+
lapack_int LAPACKE_sormlq_work( int matrix_layout, char side, char trans,
3737
lapack_int m, lapack_int n, lapack_int k,
3838
const float* a, lapack_int lda,
3939
const float* tau, float* c, lapack_int ldc,
4040
float* work, lapack_int lwork )
4141
{
4242
lapack_int info = 0;
43+
lapack_int r;
4344
lapack_int lda_t, ldc_t;
4445
float *a_t = NULL, *c_t = NULL;
45-
if( matrix_order == LAPACK_COL_MAJOR ) {
46+
if( matrix_layout == LAPACK_COL_MAJOR ) {
4647
/* Call LAPACK function and adjust info */
4748
LAPACK_sormlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
4849
&lwork, &info );
4950
if( info < 0 ) {
5051
info = info - 1;
5152
}
52-
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
53+
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
54+
r = LAPACKE_lsame( side, 'l' ) ? m : n;
5355
lda_t = MAX(1,k);
5456
ldc_t = MAX(1,m);
5557
/* Check leading dimension(s) */
56-
if( lda < m ) {
58+
if( lda < r ) {
5759
info = -8;
5860
LAPACKE_xerbla( "LAPACKE_sormlq_work", info );
5961
return info;
@@ -81,8 +83,8 @@ lapack_int LAPACKE_sormlq_work( int matrix_order, char side, char trans,
8183
goto exit_level_1;
8284
}
8385
/* Transpose input matrices */
84-
LAPACKE_sge_trans( matrix_order, k, m, a, lda, a_t, lda_t );
85-
LAPACKE_sge_trans( matrix_order, m, n, c, ldc, c_t, ldc_t );
86+
LAPACKE_sge_trans( matrix_layout, k, m, a, lda, a_t, lda_t );
87+
LAPACKE_sge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
8688
/* Call LAPACK function and adjust info */
8789
LAPACK_sormlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t,
8890
work, &lwork, &info );

lapack-netlib/lapacke/src/lapacke_zunmlq_work.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************************
2-
Copyright (c) 2011, Intel Corp.
2+
Copyright (c) 2014, Intel Corp.
33
All rights reserved.
44
55
Redistribution and use in source and binary forms, with or without
@@ -33,28 +33,30 @@
3333

3434
#include "lapacke_utils.h"
3535

36-
lapack_int LAPACKE_zunmlq_work( int matrix_order, char side, char trans,
36+
lapack_int LAPACKE_zunmlq_work( int matrix_layout, char side, char trans,
3737
lapack_int m, lapack_int n, lapack_int k,
3838
const lapack_complex_double* a, lapack_int lda,
3939
const lapack_complex_double* tau,
4040
lapack_complex_double* c, lapack_int ldc,
4141
lapack_complex_double* work, lapack_int lwork )
4242
{
4343
lapack_int info = 0;
44-
if( matrix_order == LAPACK_COL_MAJOR ) {
44+
lapack_int r;
45+
if( matrix_layout == LAPACK_COL_MAJOR ) {
4546
/* Call LAPACK function and adjust info */
4647
LAPACK_zunmlq( &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work,
4748
&lwork, &info );
4849
if( info < 0 ) {
4950
info = info - 1;
5051
}
51-
} else if( matrix_order == LAPACK_ROW_MAJOR ) {
52+
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
53+
r = LAPACKE_lsame( side, 'l' ) ? m : n;
5254
lapack_int lda_t = MAX(1,k);
5355
lapack_int ldc_t = MAX(1,m);
5456
lapack_complex_double* a_t = NULL;
5557
lapack_complex_double* c_t = NULL;
5658
/* Check leading dimension(s) */
57-
if( lda < m ) {
59+
if( lda < r ) {
5860
info = -8;
5961
LAPACKE_xerbla( "LAPACKE_zunmlq_work", info );
6062
return info;
@@ -84,8 +86,8 @@ lapack_int LAPACKE_zunmlq_work( int matrix_order, char side, char trans,
8486
goto exit_level_1;
8587
}
8688
/* Transpose input matrices */
87-
LAPACKE_zge_trans( matrix_order, k, m, a, lda, a_t, lda_t );
88-
LAPACKE_zge_trans( matrix_order, m, n, c, ldc, c_t, ldc_t );
89+
LAPACKE_zge_trans( matrix_layout, k, m, a, lda, a_t, lda_t );
90+
LAPACKE_zge_trans( matrix_layout, m, n, c, ldc, c_t, ldc_t );
8991
/* Call LAPACK function and adjust info */
9092
LAPACK_zunmlq( &side, &trans, &m, &n, &k, a_t, &lda_t, tau, c_t, &ldc_t,
9193
work, &lwork, &info );

0 commit comments

Comments
 (0)