Add LAPACKE interfaces for the new Householder Reconstruction functions from 3.9.1
This commit is contained in:
parent
fb7308b9b5
commit
d444344497
|
@ -162,6 +162,8 @@ lapacke_cgetrs.o \
|
||||||
lapacke_cgetrs_work.o \
|
lapacke_cgetrs_work.o \
|
||||||
lapacke_cgetsls.o \
|
lapacke_cgetsls.o \
|
||||||
lapacke_cgetsls_work.o \
|
lapacke_cgetsls_work.o \
|
||||||
|
lapacke_cgetsqrhrt.o \
|
||||||
|
lapacke_cgetsqrhrt_work.o \
|
||||||
lapacke_cggbak.o \
|
lapacke_cggbak.o \
|
||||||
lapacke_cggbak_work.o \
|
lapacke_cggbak_work.o \
|
||||||
lapacke_cggbal.o \
|
lapacke_cggbal.o \
|
||||||
|
@ -634,6 +636,8 @@ lapacke_cungrq.o \
|
||||||
lapacke_cungrq_work.o \
|
lapacke_cungrq_work.o \
|
||||||
lapacke_cungtr.o \
|
lapacke_cungtr.o \
|
||||||
lapacke_cungtr_work.o \
|
lapacke_cungtr_work.o \
|
||||||
|
lapacke_cungtsqr_row.o \
|
||||||
|
lapacke_cungtsqr_row_work.o \
|
||||||
lapacke_cunmbr.o \
|
lapacke_cunmbr.o \
|
||||||
lapacke_cunmbr_work.o \
|
lapacke_cunmbr_work.o \
|
||||||
lapacke_cunmhr.o \
|
lapacke_cunmhr.o \
|
||||||
|
@ -778,6 +782,8 @@ lapacke_dgetrs.o \
|
||||||
lapacke_dgetrs_work.o \
|
lapacke_dgetrs_work.o \
|
||||||
lapacke_dgetsls.o \
|
lapacke_dgetsls.o \
|
||||||
lapacke_dgetsls_work.o \
|
lapacke_dgetsls_work.o \
|
||||||
|
lapacke_dgetsqrhrt.o \
|
||||||
|
lapacke_dgetsqrhrt_work.o \
|
||||||
lapacke_dggbak.o \
|
lapacke_dggbak.o \
|
||||||
lapacke_dggbak_work.o \
|
lapacke_dggbak_work.o \
|
||||||
lapacke_dggbal.o \
|
lapacke_dggbal.o \
|
||||||
|
@ -900,6 +906,8 @@ lapacke_dorgrq.o \
|
||||||
lapacke_dorgrq_work.o \
|
lapacke_dorgrq_work.o \
|
||||||
lapacke_dorgtr.o \
|
lapacke_dorgtr.o \
|
||||||
lapacke_dorgtr_work.o \
|
lapacke_dorgtr_work.o \
|
||||||
|
lapacke_dorgtsqr_row.o \
|
||||||
|
lapacke_dorgtsqr_row_work.o \
|
||||||
lapacke_dormbr.o \
|
lapacke_dormbr.o \
|
||||||
lapacke_dormbr_work.o \
|
lapacke_dormbr_work.o \
|
||||||
lapacke_dormhr.o \
|
lapacke_dormhr.o \
|
||||||
|
@ -1348,6 +1356,8 @@ lapacke_sgetrs.o \
|
||||||
lapacke_sgetrs_work.o \
|
lapacke_sgetrs_work.o \
|
||||||
lapacke_sgetsls.o \
|
lapacke_sgetsls.o \
|
||||||
lapacke_sgetsls_work.o \
|
lapacke_sgetsls_work.o \
|
||||||
|
lapacke_sgetsqrhrt.o \
|
||||||
|
lapacke_sgetsqrhrt_work.o \
|
||||||
lapacke_sggbak.o \
|
lapacke_sggbak.o \
|
||||||
lapacke_sggbak_work.o \
|
lapacke_sggbak_work.o \
|
||||||
lapacke_sggbal.o \
|
lapacke_sggbal.o \
|
||||||
|
@ -1468,6 +1478,8 @@ lapacke_sorgrq.o \
|
||||||
lapacke_sorgrq_work.o \
|
lapacke_sorgrq_work.o \
|
||||||
lapacke_sorgtr.o \
|
lapacke_sorgtr.o \
|
||||||
lapacke_sorgtr_work.o \
|
lapacke_sorgtr_work.o \
|
||||||
|
lapacke_sorgtsqr_row.o \
|
||||||
|
lapacke_sorgtsqr_row_work.o \
|
||||||
lapacke_sormbr.o \
|
lapacke_sormbr.o \
|
||||||
lapacke_sormbr_work.o \
|
lapacke_sormbr_work.o \
|
||||||
lapacke_sormhr.o \
|
lapacke_sormhr.o \
|
||||||
|
@ -1908,6 +1920,8 @@ lapacke_zgetrs.o \
|
||||||
lapacke_zgetrs_work.o \
|
lapacke_zgetrs_work.o \
|
||||||
lapacke_zgetsls.o \
|
lapacke_zgetsls.o \
|
||||||
lapacke_zgetsls_work.o \
|
lapacke_zgetsls_work.o \
|
||||||
|
lapacke_zgetsqrhrt.o \
|
||||||
|
lapacke_zgetsqrhrt_work.o \
|
||||||
lapacke_zggbak.o \
|
lapacke_zggbak.o \
|
||||||
lapacke_zggbak_work.o \
|
lapacke_zggbak_work.o \
|
||||||
lapacke_zggbal.o \
|
lapacke_zggbal.o \
|
||||||
|
@ -2380,6 +2394,8 @@ lapacke_zungrq.o \
|
||||||
lapacke_zungrq_work.o \
|
lapacke_zungrq_work.o \
|
||||||
lapacke_zungtr.o \
|
lapacke_zungtr.o \
|
||||||
lapacke_zungtr_work.o \
|
lapacke_zungtr_work.o \
|
||||||
|
lapacke_zungtsqr_row.o \
|
||||||
|
lapacke_zungtsqr_row_work.o \
|
||||||
lapacke_zunmbr.o \
|
lapacke_zunmbr.o \
|
||||||
lapacke_zunmbr_work.o \
|
lapacke_zunmbr_work.o \
|
||||||
lapacke_zunmhr.o \
|
lapacke_zunmhr.o \
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function cgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_cgetsqrhrt( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
lapack_complex_float* a, lapack_int lda,
|
||||||
|
lapack_complex_float* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
lapack_complex_float* work = NULL;
|
||||||
|
lapack_complex_float work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_cgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = LAPACK_C2INT( work_query );
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_cgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function cgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_cgetsqrhrt_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
lapack_complex_float* a, lapack_int lda,
|
||||||
|
lapack_complex_float* t, lapack_int ldt,
|
||||||
|
lapack_complex_float* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if( matrix_layout == LAPACK_COL_MAJOR ) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
lapack_complex_float* a_t = NULL;
|
||||||
|
lapack_int ldt_t = MAX(1,nb2);
|
||||||
|
lapack_complex_float* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -8;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -10;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_cgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
LAPACKE_cge_trans( LAPACK_COL_MAJOR, nb2, n, t_t, ldt_t, t, ldt );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function cungtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_cungtsqr_row( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
lapack_complex_float* a, lapack_int lda,
|
||||||
|
const lapack_complex_float* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
lapack_complex_float* work = NULL;
|
||||||
|
lapack_complex_float work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_cge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if( LAPACKE_cge_nancheck( matrix_layout, nb, n, t, ldt ) ) {
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_cungtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = LAPACK_C2INT( work_query );
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_cungtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function cungtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_cungtsqr_row_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
lapack_complex_float* a, lapack_int lda,
|
||||||
|
const lapack_complex_float* t, lapack_int ldt,
|
||||||
|
lapack_complex_float* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if (matrix_layout == LAPACK_COL_MAJOR) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_cungtsqr_row( &m, &n, &mb, &nb, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info);
|
||||||
|
if (info < 0) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if (matrix_layout == LAPACK_ROW_MAJOR) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
lapack_complex_float* a_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -7;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
lapack_int ldt_t = MAX(1,nb);
|
||||||
|
lapack_complex_float* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -9;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_cungtsqr_row( &m, &n, &mb, &nb, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (lapack_complex_float*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_float) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_cge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
LAPACKE_cge_trans( matrix_layout, nb, n, a, lda, t_t, ldt_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_cungtsqr_row( &m, &n, &mb, &nb, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_cge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_cungtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function dgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_dgetsqrhrt( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
double* a, lapack_int lda,
|
||||||
|
double* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
double* work = NULL;
|
||||||
|
double work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_dgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = (lapack_int)work_query;
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_dgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function dgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_dgetsqrhrt_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
double* a, lapack_int lda,
|
||||||
|
double* t, lapack_int ldt,
|
||||||
|
double* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if( matrix_layout == LAPACK_COL_MAJOR ) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_dgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
double* a_t = NULL;
|
||||||
|
lapack_int ldt_t = MAX(1,nb2);
|
||||||
|
double* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -8;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -10;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_dgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_dge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_dgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
LAPACKE_dge_trans( LAPACK_COL_MAJOR, nb2, n, t_t, ldt_t, t, ldt );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function dorgtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_dorgtsqr_row( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
double* a, lapack_int lda,
|
||||||
|
const double* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
double* work = NULL;
|
||||||
|
double work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_dge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if( LAPACKE_dge_nancheck( matrix_layout, nb, n, t, ldt ) ) {
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_dorgtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = (lapack_int)work_query;
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (double*)LAPACKE_malloc( sizeof(double) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_dorgtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function dorgtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_dorgtsqr_row_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
double* a, lapack_int lda,
|
||||||
|
const double* t, lapack_int ldt,
|
||||||
|
double* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if (matrix_layout == LAPACK_COL_MAJOR) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_dorgtsqr_row( &m, &n, &mb, &nb, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info);
|
||||||
|
if (info < 0) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if (matrix_layout == LAPACK_ROW_MAJOR) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
double* a_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -7;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
lapack_int ldt_t = MAX(1,nb);
|
||||||
|
double* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -9;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_dorgtsqr_row( &m, &n, &mb, &nb, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (double*)LAPACKE_malloc( sizeof(double) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (double*)LAPACKE_malloc( sizeof(double) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_dge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
LAPACKE_dge_trans( matrix_layout, nb, n, a, lda, t_t, ldt_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_dorgtsqr_row( &m, &n, &mb, &nb, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_dge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_dorgtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function sgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_sgetsqrhrt( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
float* a, lapack_int lda,
|
||||||
|
float* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
float* work = NULL;
|
||||||
|
float work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_sgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = (lapack_int)work_query;
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_sgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,106 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function sgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_sgetsqrhrt_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
float* a, lapack_int lda,
|
||||||
|
float* t, lapack_int ldt,
|
||||||
|
float* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if( matrix_layout == LAPACK_COL_MAJOR ) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_sgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
float* a_t = NULL;
|
||||||
|
lapack_int ldt_t = MAX(1,nb2);
|
||||||
|
float* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -8;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -10;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_sgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (float*)LAPACKE_malloc( sizeof(float) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_sge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_sgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_sge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
LAPACKE_sge_trans( LAPACK_COL_MAJOR, nb2, n, t_t, ldt_t, t, ldt );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,82 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function sorgtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_sorgtsqr_row( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
float* a, lapack_int lda,
|
||||||
|
const float* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
float* work = NULL;
|
||||||
|
float work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_sge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if( LAPACKE_sge_nancheck( matrix_layout, nb, n, t, ldt ) ) {
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_sorgtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = (lapack_int)work_query;
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (float*)LAPACKE_malloc( sizeof(float) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_sorgtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function sorgtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_sorgtsqr_row_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
float* a, lapack_int lda,
|
||||||
|
const float* t, lapack_int ldt,
|
||||||
|
float* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if (matrix_layout == LAPACK_COL_MAJOR) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_sorgtsqr_row( &m, &n, &mb, &nb, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info);
|
||||||
|
if (info < 0) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if (matrix_layout == LAPACK_ROW_MAJOR) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
float* a_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -7;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
lapack_int ldt_t = MAX(1,nb);
|
||||||
|
float* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -9;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_sorgtsqr_row( &m, &n, &mb, &nb, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (float*)LAPACKE_malloc( sizeof(float) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (float*)LAPACKE_malloc( sizeof(float) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_sge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
LAPACKE_sge_trans( matrix_layout, nb, n, a, lda, t_t, ldt_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_sorgtsqr_row( &m, &n, &mb, &nb, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_sge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_sorgtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,80 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function zgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_zgetsqrhrt( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
lapack_complex_double* a, lapack_int lda,
|
||||||
|
lapack_complex_double* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
lapack_complex_double* work = NULL;
|
||||||
|
lapack_complex_double work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -7;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_zgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = LAPACK_Z2INT( work_query );
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_zgetsqrhrt_work( matrix_layout, m, n, mb1, nb1, nb2,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,108 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function zgetsqrhrt
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_zgetsqrhrt_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb1, lapack_int nb1, lapack_int nb2,
|
||||||
|
lapack_complex_double* a, lapack_int lda,
|
||||||
|
lapack_complex_double* t, lapack_int ldt,
|
||||||
|
lapack_complex_double* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if( matrix_layout == LAPACK_COL_MAJOR ) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_zgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if( matrix_layout == LAPACK_ROW_MAJOR ) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
lapack_complex_double* a_t = NULL;
|
||||||
|
lapack_int ldt_t = MAX(1,nb2);
|
||||||
|
lapack_complex_double* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -8;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -10;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_zgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_zgetsqrhrt( &m, &n, &mb1, &nb1, &nb2, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
LAPACKE_zge_trans( LAPACK_COL_MAJOR, nb2, n, t_t, ldt_t, t, ldt );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zgetsqrhrt_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native high-level C interface to LAPACK function zungtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_zungtsqr_row( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
lapack_complex_double* a, lapack_int lda,
|
||||||
|
const lapack_complex_double* t, lapack_int ldt )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
lapack_int lwork = -1;
|
||||||
|
lapack_complex_double* work = NULL;
|
||||||
|
lapack_complex_double work_query;
|
||||||
|
if( matrix_layout != LAPACK_COL_MAJOR && matrix_layout != LAPACK_ROW_MAJOR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row", -1 );
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifndef LAPACK_DISABLE_NAN_CHECK
|
||||||
|
if( LAPACKE_get_nancheck() ) {
|
||||||
|
/* Optionally check input matrices for NaNs */
|
||||||
|
if( LAPACKE_zge_nancheck( matrix_layout, m, n, a, lda ) ) {
|
||||||
|
return -6;
|
||||||
|
}
|
||||||
|
if( LAPACKE_zge_nancheck( matrix_layout, nb, n, t, ldt ) ) {
|
||||||
|
return -8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Query optimal working array(s) size */
|
||||||
|
info = LAPACKE_zungtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, &work_query, lwork );
|
||||||
|
if( info != 0 ) {
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
lwork = LAPACK_Z2INT( work_query );
|
||||||
|
/* Allocate memory for work arrays */
|
||||||
|
work = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * lwork );
|
||||||
|
if( work == NULL ) {
|
||||||
|
info = LAPACK_WORK_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
/* Call middle-level interface */
|
||||||
|
info = LAPACKE_zungtsqr_row_work( matrix_layout, m, n, mb, nb,
|
||||||
|
a, lda, t, ldt, work, lwork );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( work );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_WORK_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2020, Intel Corp.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in the
|
||||||
|
documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of Intel Corporation nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||||
|
THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*****************************************************************************
|
||||||
|
* Contents: Native middle-level C interface to LAPACK function zungtsqr_row
|
||||||
|
* Author: Intel Corporation
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "lapacke_utils.h"
|
||||||
|
|
||||||
|
lapack_int LAPACKE_zungtsqr_row_work( int matrix_layout, lapack_int m, lapack_int n,
|
||||||
|
lapack_int mb, lapack_int nb,
|
||||||
|
lapack_complex_double* a, lapack_int lda,
|
||||||
|
const lapack_complex_double* t, lapack_int ldt,
|
||||||
|
lapack_complex_double* work, lapack_int lwork )
|
||||||
|
{
|
||||||
|
lapack_int info = 0;
|
||||||
|
if (matrix_layout == LAPACK_COL_MAJOR) {
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_zungtsqr_row( &m, &n, &mb, &nb, a, &lda, t, &ldt,
|
||||||
|
work, &lwork, &info);
|
||||||
|
if (info < 0) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
} else if (matrix_layout == LAPACK_ROW_MAJOR) {
|
||||||
|
lapack_int lda_t = MAX(1,m);
|
||||||
|
lapack_complex_double* a_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( lda < n ) {
|
||||||
|
info = -7;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
lapack_int ldt_t = MAX(1,nb);
|
||||||
|
lapack_complex_double* t_t = NULL;
|
||||||
|
/* Check leading dimension(s) */
|
||||||
|
if( ldt < n ) {
|
||||||
|
info = -9;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row_work", info );
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
/* Query optimal working array(s) size if requested */
|
||||||
|
if( lwork == -1 ) {
|
||||||
|
LAPACK_zungtsqr_row( &m, &n, &mb, &nb, a, &lda_t, t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
return (info < 0) ? (info - 1) : info;
|
||||||
|
}
|
||||||
|
/* Allocate memory for temporary array(s) */
|
||||||
|
a_t = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * lda_t * MAX(1,n) );
|
||||||
|
if( a_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_0;
|
||||||
|
}
|
||||||
|
t_t = (lapack_complex_double*)
|
||||||
|
LAPACKE_malloc( sizeof(lapack_complex_double) * ldt_t * MAX(1,n) );
|
||||||
|
if( t_t == NULL ) {
|
||||||
|
info = LAPACK_TRANSPOSE_MEMORY_ERROR;
|
||||||
|
goto exit_level_1;
|
||||||
|
}
|
||||||
|
/* Transpose input matrices */
|
||||||
|
LAPACKE_zge_trans( matrix_layout, m, n, a, lda, a_t, lda_t );
|
||||||
|
LAPACKE_zge_trans( matrix_layout, nb, n, a, lda, t_t, ldt_t );
|
||||||
|
/* Call LAPACK function and adjust info */
|
||||||
|
LAPACK_zungtsqr_row( &m, &n, &mb, &nb, a_t, &lda_t, t_t, &ldt_t,
|
||||||
|
work, &lwork, &info );
|
||||||
|
if( info < 0 ) {
|
||||||
|
info = info - 1;
|
||||||
|
}
|
||||||
|
/* Transpose output matrices */
|
||||||
|
LAPACKE_zge_trans( LAPACK_COL_MAJOR, m, n, a_t, lda_t, a, lda );
|
||||||
|
/* Release memory and exit */
|
||||||
|
LAPACKE_free( t_t );
|
||||||
|
exit_level_1:
|
||||||
|
LAPACKE_free( a_t );
|
||||||
|
exit_level_0:
|
||||||
|
if( info == LAPACK_TRANSPOSE_MEMORY_ERROR ) {
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
info = -1;
|
||||||
|
LAPACKE_xerbla( "LAPACKE_zungtsqr_row_work", info );
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
Loading…
Reference in New Issue