Skip to content

Commit d444344

Browse files
authored
Add LAPACKE interfaces for the new Householder Reconstruction functions from 3.9.1
1 parent fb7308b commit d444344

17 files changed

+1526
-0
lines changed

lapack-netlib/LAPACKE/src/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ lapacke_cgetrs.o \
162162
lapacke_cgetrs_work.o \
163163
lapacke_cgetsls.o \
164164
lapacke_cgetsls_work.o \
165+
lapacke_cgetsqrhrt.o \
166+
lapacke_cgetsqrhrt_work.o \
165167
lapacke_cggbak.o \
166168
lapacke_cggbak_work.o \
167169
lapacke_cggbal.o \
@@ -634,6 +636,8 @@ lapacke_cungrq.o \
634636
lapacke_cungrq_work.o \
635637
lapacke_cungtr.o \
636638
lapacke_cungtr_work.o \
639+
lapacke_cungtsqr_row.o \
640+
lapacke_cungtsqr_row_work.o \
637641
lapacke_cunmbr.o \
638642
lapacke_cunmbr_work.o \
639643
lapacke_cunmhr.o \
@@ -778,6 +782,8 @@ lapacke_dgetrs.o \
778782
lapacke_dgetrs_work.o \
779783
lapacke_dgetsls.o \
780784
lapacke_dgetsls_work.o \
785+
lapacke_dgetsqrhrt.o \
786+
lapacke_dgetsqrhrt_work.o \
781787
lapacke_dggbak.o \
782788
lapacke_dggbak_work.o \
783789
lapacke_dggbal.o \
@@ -900,6 +906,8 @@ lapacke_dorgrq.o \
900906
lapacke_dorgrq_work.o \
901907
lapacke_dorgtr.o \
902908
lapacke_dorgtr_work.o \
909+
lapacke_dorgtsqr_row.o \
910+
lapacke_dorgtsqr_row_work.o \
903911
lapacke_dormbr.o \
904912
lapacke_dormbr_work.o \
905913
lapacke_dormhr.o \
@@ -1348,6 +1356,8 @@ lapacke_sgetrs.o \
13481356
lapacke_sgetrs_work.o \
13491357
lapacke_sgetsls.o \
13501358
lapacke_sgetsls_work.o \
1359+
lapacke_sgetsqrhrt.o \
1360+
lapacke_sgetsqrhrt_work.o \
13511361
lapacke_sggbak.o \
13521362
lapacke_sggbak_work.o \
13531363
lapacke_sggbal.o \
@@ -1468,6 +1478,8 @@ lapacke_sorgrq.o \
14681478
lapacke_sorgrq_work.o \
14691479
lapacke_sorgtr.o \
14701480
lapacke_sorgtr_work.o \
1481+
lapacke_sorgtsqr_row.o \
1482+
lapacke_sorgtsqr_row_work.o \
14711483
lapacke_sormbr.o \
14721484
lapacke_sormbr_work.o \
14731485
lapacke_sormhr.o \
@@ -1908,6 +1920,8 @@ lapacke_zgetrs.o \
19081920
lapacke_zgetrs_work.o \
19091921
lapacke_zgetsls.o \
19101922
lapacke_zgetsls_work.o \
1923+
lapacke_zgetsqrhrt.o \
1924+
lapacke_zgetsqrhrt_work.o \
19111925
lapacke_zggbak.o \
19121926
lapacke_zggbak_work.o \
19131927
lapacke_zggbal.o \
@@ -2380,6 +2394,8 @@ lapacke_zungrq.o \
23802394
lapacke_zungrq_work.o \
23812395
lapacke_zungtr.o \
23822396
lapacke_zungtr_work.o \
2397+
lapacke_zungtsqr_row.o \
2398+
lapacke_zungtsqr_row_work.o \
23832399
lapacke_zunmbr.o \
23842400
lapacke_zunmbr_work.o \
23852401
lapacke_zunmhr.o \
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
/*****************************************************************************
2+
Copyright (c) 2020, Intel Corp.
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice,
9+
this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
* Neither the name of Intel Corporation nor the names of its contributors
14+
may be used to endorse or promote products derived from this software
15+
without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27+
THE POSSIBILITY OF SUCH DAMAGE.
28+
*****************************************************************************
29+
* Contents: Native high-level C interface to LAPACK function cgetsqrhrt
30+
* Author: Intel Corporation
31+
*****************************************************************************/
32+
33+
#include "lapacke_utils.h"
34+
35+
lapack_int LAPACKE_cgetsqrhrt( int matrix_layout, lapack_int m, lapack_int n,
36+
lapack_int mb1, lapack_int nb1, lapack_int nb2,
37+
lapack_complex_float* a, lapack_int lda,
38+
lapack_complex_float* t, lapack_int ldt )
39+
{
40+
lapack_int info = 0;
41+
lapack_int lwork = -1;
42+
lapack_complex_float* work = NULL;
43+
lapack_complex_float work_query;
44+
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
45+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt", -1 );
46+
return -1;
47+
}
48+
#ifndef LAPACK_DISABLE_NAN_CHECK
49+
if( LAPACKE_get_nancheck() ) {
50+
/* Optionally check input matrices for NaNs */
51+
if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
52+
return -7;
53+
}
54+
}
55+
#endif
56+
/* Query optimal working array(s) size */
57+
info = LAPACKE_cgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
58+
a, lda, t, ldt, &work_query, lwork );
59+
if( info != 0 ) {
60+
goto exit_level_0;
61+
}
62+
lwork = LAPACK_C2INT( work_query );
63+
/* Allocate memory for work arrays */
64+
work = (lapack_complex_float*)
65+
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
66+
if( work == NULL ) {
67+
info = LAPACK_WORK_MEMORY_ERROR;
68+
goto exit_level_0;
69+
}
70+
/* Call middle-level interface */
71+
info = LAPACKE_cgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
72+
a, lda, t, ldt, work, lwork );
73+
/* Release memory and exit */
74+
LAPACKE_free( work );
75+
exit_level_0:
76+
if( info == LAPACK_WORK_MEMORY_ERROR ) {
77+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt", info );
78+
}
79+
return info;
80+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/*****************************************************************************
2+
Copyright (c) 2020, Intel Corp.
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice,
9+
this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
* Neither the name of Intel Corporation nor the names of its contributors
14+
may be used to endorse or promote products derived from this software
15+
without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27+
THE POSSIBILITY OF SUCH DAMAGE.
28+
*****************************************************************************
29+
* Contents: Native middle-level C interface to LAPACK function cgetsqrhrt
30+
* Author: Intel Corporation
31+
*****************************************************************************/
32+
33+
#include "lapacke_utils.h"
34+
35+
lapack_int LAPACKE_cgetsqrhrt_work( int matrix_layout, lapack_int m, lapack_int n,
36+
lapack_int mb1, lapack_int nb1, lapack_int nb2,
37+
lapack_complex_float* a, lapack_int lda,
38+
lapack_complex_float* t, lapack_int ldt,
39+
lapack_complex_float* work, lapack_int lwork )
40+
{
41+
lapack_int info = 0;
42+
if( matrix_layout == LAPACK_COL_MAJOR ) {
43+
/* Call LAPACK function and adjust info */
44+
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda, t, &ldt,
45+
work, &lwork, &info );
46+
if( info < 0 ) {
47+
info = info - 1;
48+
}
49+
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
50+
lapack_int lda_t = MAX(1,m);
51+
lapack_complex_float* a_t = NULL;
52+
lapack_int ldt_t = MAX(1,nb2);
53+
lapack_complex_float* t_t = NULL;
54+
/* Check leading dimension(s) */
55+
if( lda < n ) {
56+
info = -8;
57+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
58+
return info;
59+
}
60+
if( ldt < n ) {
61+
info = -10;
62+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
63+
return info;
64+
}
65+
/* Query optimal working array(s) size if requested */
66+
if( lwork == -1 ) {
67+
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda_t, t, &ldt_t,
68+
work, &lwork, &info );
69+
return (info < 0) ? (info - 1) : info;
70+
}
71+
/* Allocate memory for temporary array(s) */
72+
a_t = (lapack_complex_float*)
73+
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
74+
if( a_t == NULL ) {
75+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
76+
goto exit_level_0;
77+
}
78+
t_t = (lapack_complex_float*)
79+
LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
80+
if( t_t == NULL ) {
81+
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
82+
goto exit_level_1;
83+
}
84+
/* Transpose input matrices */
85+
LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
86+
/* Call LAPACK function and adjust info */
87+
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a_t, &lda_t, t_t, &ldt_t,
88+
work, &lwork, &info );
89+
if( info < 0 ) {
90+
info = info - 1;
91+
}
92+
/* Transpose output matrices */
93+
LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
94+
LAPACKE_cge_trans( LAPACK_COL_MAJOR, nb2, n, t_t, ldt_t, t, ldt );
95+
/* Release memory and exit */
96+
LAPACKE_free( t_t );
97+
exit_level_1:
98+
LAPACKE_free( a_t );
99+
exit_level_0:
100+
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
101+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
102+
}
103+
} else {
104+
info = -1;
105+
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
106+
}
107+
return info;
108+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*****************************************************************************
2+
Copyright (c) 2020, Intel Corp.
3+
All rights reserved.
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
* Redistributions of source code must retain the above copyright notice,
9+
this list of conditions and the following disclaimer.
10+
* Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
* Neither the name of Intel Corporation nor the names of its contributors
14+
may be used to endorse or promote products derived from this software
15+
without specific prior written permission.
16+
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27+
THE POSSIBILITY OF SUCH DAMAGE.
28+
*****************************************************************************
29+
* Contents: Native high-level C interface to LAPACK function cungtsqr_row
30+
* Author: Intel Corporation
31+
*****************************************************************************/
32+
33+
#include "lapacke_utils.h"
34+
35+
lapack_int LAPACKE_cungtsqr_row( int matrix_layout, lapack_int m, lapack_int n,
36+
lapack_int mb, lapack_int nb,
37+
lapack_complex_float* a, lapack_int lda,
38+
const lapack_complex_float* t, lapack_int ldt )
39+
{
40+
lapack_int info = 0;
41+
lapack_int lwork = -1;
42+
lapack_complex_float* work = NULL;
43+
lapack_complex_float work_query;
44+
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
45+
LAPACKE_xerbla( "LAPACKE_cungtsqr_row", -1 );
46+
return -1;
47+
}
48+
#ifndef LAPACK_DISABLE_NAN_CHECK
49+
if( LAPACKE_get_nancheck() ) {
50+
/* Optionally check input matrices for NaNs */
51+
if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
52+
return -6;
53+
}
54+
if( LAPACKE_cge_nancheck( matrix_layout, nb, n, t, ldt ) ) {
55+
return -8;
56+
}
57+
}
58+
#endif
59+
/* Query optimal working array(s) size */
60+
info = LAPACKE_cungtsqr_row_work( matrix_layout, m, n, mb, nb,
61+
a, lda, t, ldt, &work_query, lwork );
62+
if( info != 0 ) {
63+
goto exit_level_0;
64+
}
65+
lwork = LAPACK_C2INT( work_query );
66+
/* Allocate memory for work arrays */
67+
work = (lapack_complex_float*)
68+
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
69+
if( work == NULL ) {
70+
info = LAPACK_WORK_MEMORY_ERROR;
71+
goto exit_level_0;
72+
}
73+
/* Call middle-level interface */
74+
info = LAPACKE_cungtsqr_row_work( matrix_layout, m, n, mb, nb,
75+
a, lda, t, ldt, work, lwork );
76+
/* Release memory and exit */
77+
LAPACKE_free( work );
78+
exit_level_0:
79+
if( info == LAPACK_WORK_MEMORY_ERROR ) {
80+
LAPACKE_xerbla( "LAPACKE_cungtsqr_row", info );
81+
}
82+
return info;
83+
}

0 commit comments

Comments
 (0)