mirror of
https://github.com/gonum/gonum.git
synced 2025-10-23 23:23:15 +08:00
qr working with lapacke binding
This commit is contained in:
25
clapack/float64.go
Normal file
25
clapack/float64.go
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package clapack
|
||||||
|
|
||||||
|
/*
|
||||||
|
#cgo linux LDFLAGS: -llapacke -lblas
|
||||||
|
#cgo darwin LDFLAGS: -DYA_BLAS -DYA_LAPACK -DYA_BLASMULT -framework vecLib
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "lapacke.h"
|
||||||
|
*/
|
||||||
|
import "C"
|
||||||
|
import (
|
||||||
|
"github.com/gonum/blas/d"
|
||||||
|
)
|
||||||
|
|
||||||
|
type La struct{}
|
||||||
|
|
||||||
|
func (La) Dgeqrf(A d.General, tau []float64) {
|
||||||
|
C.LAPACKE_dgeqrf(C.int(A.Order), C.int(A.Rows), C.int(A.Cols),
|
||||||
|
(*C.double)(&A.Data[0]), C.int(A.Stride), (*C.double)(&tau[0]))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (La) Dormqr(s byte, t byte, A d.General, tau []float64, B d.General) {
|
||||||
|
C.LAPACKE_dormqr(C.int(A.Order), C.char(s), C.char(t), C.int(B.Rows),
|
||||||
|
C.int(B.Cols), C.int(A.Cols), (*C.double)(&A.Data[0]),
|
||||||
|
C.int(A.Stride), (*C.double)(&tau[0]), (*C.double)(&B.Data[0]), C.int(B.Stride))
|
||||||
|
}
|
16305
clapack/lapacke.h
Normal file
16305
clapack/lapacke.h
Normal file
File diff suppressed because it is too large
Load Diff
119
clapack/lapacke_config.h
Normal file
119
clapack/lapacke_config.h
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2010, 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 C interface to LAPACK
|
||||||
|
* Author: Intel Corporation
|
||||||
|
* Generated May, 2011
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _LAPACKE_CONFIG_H_
|
||||||
|
#define _LAPACKE_CONFIG_H_
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
#if defined(LAPACK_COMPLEX_CPP)
|
||||||
|
#include <complex>
|
||||||
|
#endif
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifndef lapack_int
|
||||||
|
#if defined(LAPACK_ILP64)
|
||||||
|
#define lapack_int long
|
||||||
|
#else
|
||||||
|
#define lapack_int int
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef lapack_logical
|
||||||
|
#define lapack_logical lapack_int
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LAPACK_COMPLEX_CUSTOM
|
||||||
|
|
||||||
|
#if defined(LAPACK_COMPLEX_STRUCTURE)
|
||||||
|
|
||||||
|
typedef struct { float real, imag; } _lapack_complex_float;
|
||||||
|
typedef struct { double real, imag; } _lapack_complex_double;
|
||||||
|
#define lapack_complex_float _lapack_complex_float
|
||||||
|
#define lapack_complex_double _lapack_complex_double
|
||||||
|
#define lapack_complex_float_real(z) ((z).real)
|
||||||
|
#define lapack_complex_float_imag(z) ((z).imag)
|
||||||
|
#define lapack_complex_double_real(z) ((z).real)
|
||||||
|
#define lapack_complex_double_imag(z) ((z).imag)
|
||||||
|
|
||||||
|
#elif defined(LAPACK_COMPLEX_C99)
|
||||||
|
|
||||||
|
#include <complex.h>
|
||||||
|
#define lapack_complex_float float _Complex
|
||||||
|
#define lapack_complex_double double _Complex
|
||||||
|
#define lapack_complex_float_real(z) (creal(z))
|
||||||
|
#define lapack_complex_float_imag(z) (cimag(z))
|
||||||
|
#define lapack_complex_double_real(z) (creal(z))
|
||||||
|
#define lapack_complex_double_imag(z) (cimag(z))
|
||||||
|
|
||||||
|
#elif defined(LAPACK_COMPLEX_CPP)
|
||||||
|
|
||||||
|
#define lapack_complex_float std::complex<float>
|
||||||
|
#define lapack_complex_double std::complex<double>
|
||||||
|
#define lapack_complex_float_real(z) ((z).real())
|
||||||
|
#define lapack_complex_float_imag(z) ((z).imag())
|
||||||
|
#define lapack_complex_double_real(z) ((z).real())
|
||||||
|
#define lapack_complex_double_imag(z) ((z).imag())
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <complex.h>
|
||||||
|
#define lapack_complex_float float _Complex
|
||||||
|
#define lapack_complex_double double _Complex
|
||||||
|
#define lapack_complex_float_real(z) (creal(z))
|
||||||
|
#define lapack_complex_float_imag(z) (cimag(z))
|
||||||
|
#define lapack_complex_double_real(z) (creal(z))
|
||||||
|
#define lapack_complex_double_imag(z) (cimag(z))
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lapack_complex_float lapack_make_complex_float( float re, float im );
|
||||||
|
lapack_complex_double lapack_make_complex_double( double re, double im );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LAPACK_malloc
|
||||||
|
#define LAPACK_malloc( size ) malloc( size )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef LAPACK_free
|
||||||
|
#define LAPACK_free( p ) free( p )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _LAPACKE_CONFIG_H_ */
|
17
clapack/lapacke_mangling.h
Normal file
17
clapack/lapacke_mangling.h
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#ifndef LAPACK_HEADER_INCLUDED
|
||||||
|
#define LAPACK_HEADER_INCLUDED
|
||||||
|
|
||||||
|
#ifndef LAPACK_GLOBAL
|
||||||
|
#if defined(LAPACK_GLOBAL_PATTERN_LC) || defined(ADD_)
|
||||||
|
#define LAPACK_GLOBAL(lcname,UCNAME) lcname##_
|
||||||
|
#elif defined(LAPACK_GLOBAL_PATTERN_UC) || defined(UPPER)
|
||||||
|
#define LAPACK_GLOBAL(lcname,UCNAME) UCNAME
|
||||||
|
#elif defined(LAPACK_GLOBAL_PATTERN_MC) || defined(NOCHANGE)
|
||||||
|
#define LAPACK_GLOBAL(lcname,UCNAME) lcname
|
||||||
|
#else
|
||||||
|
#define LAPACK_GLOBAL(lcname,UCNAME) lcname##_
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
579
clapack/lapacke_utils.h
Normal file
579
clapack/lapacke_utils.h
Normal file
@@ -0,0 +1,579 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
Copyright (c) 2010, 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 C interface to LAPACK utility functions
|
||||||
|
* Author: Intel Corporation
|
||||||
|
* Created in January, 2010
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _LAPACKE_UTILS_H_
|
||||||
|
#define _LAPACKE_UTILS_H_
|
||||||
|
|
||||||
|
#include "lapacke.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#ifndef ABS
|
||||||
|
#define ABS(x) (((x) < 0) ? -(x) : (x))
|
||||||
|
#endif
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
|
||||||
|
#endif
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
|
||||||
|
#endif
|
||||||
|
#ifndef MAX3
|
||||||
|
#define MAX3(x,y,z) (((x) > MAX(y,z)) ? (x) : MAX(y,z))
|
||||||
|
#endif
|
||||||
|
#ifndef MIN3
|
||||||
|
#define MIN3(x,y,z) (((x) < MIN(y,z)) ? (x) : MIN(y,z))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define IS_S_NONZERO(x) ( (x) < 0 || (x) > 0 )
|
||||||
|
#define IS_D_NONZERO(x) ( (x) < 0 || (x) > 0 )
|
||||||
|
#define IS_C_NONZERO(x) ( IS_S_NONZERO(*((float*)&x)) || \
|
||||||
|
IS_S_NONZERO(*(((float*)&x)+1)) )
|
||||||
|
#define IS_Z_NONZERO(x) ( IS_D_NONZERO(*((double*)&x)) || \
|
||||||
|
IS_D_NONZERO(*(((double*)&x)+1)) )
|
||||||
|
|
||||||
|
/* Error handler */
|
||||||
|
void LAPACKE_xerbla( const char *name, lapack_int info );
|
||||||
|
|
||||||
|
/* Compare two chars (case-insensitive) */
|
||||||
|
lapack_logical LAPACKE_lsame( char ca, char cb );
|
||||||
|
|
||||||
|
/* Functions to convert column-major to row-major 2d arrays and vice versa. */
|
||||||
|
void LAPACKE_cgb_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
lapack_int kl, lapack_int ku,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_cge_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const lapack_complex_float* in, lapack_int ldin,
|
||||||
|
lapack_complex_float* out, lapack_int ldout );
|
||||||
|
void LAPACKE_cgg_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const lapack_complex_float* in, lapack_int ldin,
|
||||||
|
lapack_complex_float* out, lapack_int ldout );
|
||||||
|
void LAPACKE_chb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_che_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_chp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_chs_trans( int matrix_order, lapack_int n,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_cpb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_cpf_trans( int matrix_order, char transr, char uplo,
|
||||||
|
lapack_int n, const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_cpo_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_cpp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_csp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_csy_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_ctb_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_ctf_trans( int matrix_order, char transr, char uplo, char diag,
|
||||||
|
lapack_int n, const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_ctp_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, const lapack_complex_float *in,
|
||||||
|
lapack_complex_float *out );
|
||||||
|
void LAPACKE_ctr_trans( int matrix_order, char uplo, char diag, lapack_int n,
|
||||||
|
const lapack_complex_float *in, lapack_int ldin,
|
||||||
|
lapack_complex_float *out, lapack_int ldout );
|
||||||
|
|
||||||
|
void LAPACKE_dgb_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
lapack_int kl, lapack_int ku,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dge_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const double* in, lapack_int ldin,
|
||||||
|
double* out, lapack_int ldout );
|
||||||
|
void LAPACKE_dgg_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const double* in, lapack_int ldin,
|
||||||
|
double* out, lapack_int ldout );
|
||||||
|
void LAPACKE_dhs_trans( int matrix_order, lapack_int n,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dpb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dpf_trans( int matrix_order, char transr, char uplo,
|
||||||
|
lapack_int n, const double *in,
|
||||||
|
double *out );
|
||||||
|
void LAPACKE_dpo_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dpp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const double *in,
|
||||||
|
double *out );
|
||||||
|
void LAPACKE_dsb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dsp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const double *in,
|
||||||
|
double *out );
|
||||||
|
void LAPACKE_dsy_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dtb_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_dtf_trans( int matrix_order, char transr, char uplo, char diag,
|
||||||
|
lapack_int n, const double *in,
|
||||||
|
double *out );
|
||||||
|
void LAPACKE_dtp_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, const double *in,
|
||||||
|
double *out );
|
||||||
|
void LAPACKE_dtr_trans( int matrix_order, char uplo, char diag, lapack_int n,
|
||||||
|
const double *in, lapack_int ldin,
|
||||||
|
double *out, lapack_int ldout );
|
||||||
|
|
||||||
|
void LAPACKE_sgb_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
lapack_int kl, lapack_int ku,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_sge_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const float* in, lapack_int ldin,
|
||||||
|
float* out, lapack_int ldout );
|
||||||
|
void LAPACKE_sgg_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const float* in, lapack_int ldin,
|
||||||
|
float* out, lapack_int ldout );
|
||||||
|
void LAPACKE_shs_trans( int matrix_order, lapack_int n,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_spb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_spf_trans( int matrix_order, char transr, char uplo,
|
||||||
|
lapack_int n, const float *in,
|
||||||
|
float *out );
|
||||||
|
void LAPACKE_spo_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_spp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const float *in,
|
||||||
|
float *out );
|
||||||
|
void LAPACKE_ssb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_ssp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const float *in,
|
||||||
|
float *out );
|
||||||
|
void LAPACKE_ssy_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_stb_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
void LAPACKE_stf_trans( int matrix_order, char transr, char uplo, char diag,
|
||||||
|
lapack_int n, const float *in,
|
||||||
|
float *out );
|
||||||
|
void LAPACKE_stp_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, const float *in,
|
||||||
|
float *out );
|
||||||
|
void LAPACKE_str_trans( int matrix_order, char uplo, char diag, lapack_int n,
|
||||||
|
const float *in, lapack_int ldin,
|
||||||
|
float *out, lapack_int ldout );
|
||||||
|
|
||||||
|
void LAPACKE_zgb_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
lapack_int kl, lapack_int ku,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zge_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const lapack_complex_double* in, lapack_int ldin,
|
||||||
|
lapack_complex_double* out, lapack_int ldout );
|
||||||
|
void LAPACKE_zgg_trans( int matrix_order, lapack_int m, lapack_int n,
|
||||||
|
const lapack_complex_double* in, lapack_int ldin,
|
||||||
|
lapack_complex_double* out, lapack_int ldout );
|
||||||
|
void LAPACKE_zhb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zhe_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zhp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_zhs_trans( int matrix_order, lapack_int n,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zpb_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
lapack_int kd,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zpf_trans( int matrix_order, char transr, char uplo,
|
||||||
|
lapack_int n, const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_zpo_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_zpp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_zsp_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_zsy_trans( int matrix_order, char uplo, lapack_int n,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_ztb_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
void LAPACKE_ztf_trans( int matrix_order, char transr, char uplo, char diag,
|
||||||
|
lapack_int n, const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_ztp_trans( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, const lapack_complex_double *in,
|
||||||
|
lapack_complex_double *out );
|
||||||
|
void LAPACKE_ztr_trans( int matrix_order, char uplo, char diag, lapack_int n,
|
||||||
|
const lapack_complex_double *in, lapack_int ldin,
|
||||||
|
lapack_complex_double *out, lapack_int ldout );
|
||||||
|
|
||||||
|
/* NaN checkers */
|
||||||
|
#define LAPACK_SISNAN( x ) ( x != x )
|
||||||
|
#define LAPACK_DISNAN( x ) ( x != x )
|
||||||
|
#define LAPACK_CISNAN( x ) ( LAPACK_SISNAN(*((float*) &x)) || \
|
||||||
|
LAPACK_SISNAN(*(((float*) &x)+1)) )
|
||||||
|
#define LAPACK_ZISNAN( x ) ( LAPACK_DISNAN(*((double*)&x)) || \
|
||||||
|
LAPACK_DISNAN(*(((double*)&x)+1)) )
|
||||||
|
|
||||||
|
/* NaN checkers for vectors */
|
||||||
|
lapack_logical LAPACKE_c_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *x,
|
||||||
|
lapack_int incx );
|
||||||
|
lapack_logical LAPACKE_d_nancheck( lapack_int n,
|
||||||
|
const double *x,
|
||||||
|
lapack_int incx );
|
||||||
|
lapack_logical LAPACKE_s_nancheck( lapack_int n,
|
||||||
|
const float *x,
|
||||||
|
lapack_int incx );
|
||||||
|
lapack_logical LAPACKE_z_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *x,
|
||||||
|
lapack_int incx );
|
||||||
|
/* NaN checkers for matrices */
|
||||||
|
lapack_logical LAPACKE_cgb_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n, lapack_int kl,
|
||||||
|
lapack_int ku,
|
||||||
|
const lapack_complex_float *ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_cge_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_cgg_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_cgt_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *dl,
|
||||||
|
const lapack_complex_float *d,
|
||||||
|
const lapack_complex_float *du );
|
||||||
|
lapack_logical LAPACKE_chb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_che_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_chp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *ap );
|
||||||
|
lapack_logical LAPACKE_chs_nancheck( int matrix_order, lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_cpb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_cpf_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *a );
|
||||||
|
lapack_logical LAPACKE_cpo_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_cpp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *ap );
|
||||||
|
lapack_logical LAPACKE_cpt_nancheck( lapack_int n,
|
||||||
|
const float *d,
|
||||||
|
const lapack_complex_float *e );
|
||||||
|
lapack_logical LAPACKE_csp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *ap );
|
||||||
|
lapack_logical LAPACKE_cst_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_float *d,
|
||||||
|
const lapack_complex_float *e );
|
||||||
|
lapack_logical LAPACKE_csy_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_ctb_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_ctf_nancheck( int matrix_order, char transr,
|
||||||
|
char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a );
|
||||||
|
lapack_logical LAPACKE_ctp_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *ap );
|
||||||
|
lapack_logical LAPACKE_ctr_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
|
||||||
|
lapack_logical LAPACKE_dgb_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n, lapack_int kl,
|
||||||
|
lapack_int ku,
|
||||||
|
const double *ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_dge_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_dgg_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_dgt_nancheck( lapack_int n,
|
||||||
|
const double *dl,
|
||||||
|
const double *d,
|
||||||
|
const double *du );
|
||||||
|
lapack_logical LAPACKE_dhs_nancheck( int matrix_order, lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_dpb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_dpf_nancheck( lapack_int n,
|
||||||
|
const double *a );
|
||||||
|
lapack_logical LAPACKE_dpo_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_dpp_nancheck( lapack_int n,
|
||||||
|
const double *ap );
|
||||||
|
lapack_logical LAPACKE_dpt_nancheck( lapack_int n,
|
||||||
|
const double *d,
|
||||||
|
const double *e );
|
||||||
|
lapack_logical LAPACKE_dsb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_dsp_nancheck( lapack_int n,
|
||||||
|
const double *ap );
|
||||||
|
lapack_logical LAPACKE_dst_nancheck( lapack_int n,
|
||||||
|
const double *d,
|
||||||
|
const double *e );
|
||||||
|
lapack_logical LAPACKE_dsy_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_dtb_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_dtf_nancheck( int matrix_order, char transr,
|
||||||
|
char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a );
|
||||||
|
lapack_logical LAPACKE_dtp_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const double *ap );
|
||||||
|
lapack_logical LAPACKE_dtr_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
|
||||||
|
lapack_logical LAPACKE_sgb_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n, lapack_int kl,
|
||||||
|
lapack_int ku,
|
||||||
|
const float *ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_sge_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_sgg_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_sgt_nancheck( lapack_int n,
|
||||||
|
const float *dl,
|
||||||
|
const float *d,
|
||||||
|
const float *du );
|
||||||
|
lapack_logical LAPACKE_shs_nancheck( int matrix_order, lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_spb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_spf_nancheck( lapack_int n,
|
||||||
|
const float *a );
|
||||||
|
lapack_logical LAPACKE_spo_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_spp_nancheck( lapack_int n,
|
||||||
|
const float *ap );
|
||||||
|
lapack_logical LAPACKE_spt_nancheck( lapack_int n,
|
||||||
|
const float *d,
|
||||||
|
const float *e );
|
||||||
|
lapack_logical LAPACKE_ssb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_ssp_nancheck( lapack_int n,
|
||||||
|
const float *ap );
|
||||||
|
lapack_logical LAPACKE_sst_nancheck( lapack_int n,
|
||||||
|
const float *d,
|
||||||
|
const float *e );
|
||||||
|
lapack_logical LAPACKE_ssy_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_stb_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const float* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_stf_nancheck( int matrix_order, char transr,
|
||||||
|
char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a );
|
||||||
|
lapack_logical LAPACKE_stp_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const float *ap );
|
||||||
|
lapack_logical LAPACKE_str_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const float *a,
|
||||||
|
lapack_int lda );
|
||||||
|
|
||||||
|
lapack_logical LAPACKE_zgb_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n, lapack_int kl,
|
||||||
|
lapack_int ku,
|
||||||
|
const lapack_complex_double *ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_zge_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_zgg_nancheck( int matrix_order, lapack_int m,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_zgt_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *dl,
|
||||||
|
const lapack_complex_double *d,
|
||||||
|
const lapack_complex_double *du );
|
||||||
|
lapack_logical LAPACKE_zhb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_zhe_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_zhp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *ap );
|
||||||
|
lapack_logical LAPACKE_zhs_nancheck( int matrix_order, lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_zpb_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_zpf_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *a );
|
||||||
|
lapack_logical LAPACKE_zpo_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_zpp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *ap );
|
||||||
|
lapack_logical LAPACKE_zpt_nancheck( lapack_int n,
|
||||||
|
const double *d,
|
||||||
|
const lapack_complex_double *e );
|
||||||
|
lapack_logical LAPACKE_zsp_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *ap );
|
||||||
|
lapack_logical LAPACKE_zst_nancheck( lapack_int n,
|
||||||
|
const lapack_complex_double *d,
|
||||||
|
const lapack_complex_double *e );
|
||||||
|
lapack_logical LAPACKE_zsy_nancheck( int matrix_order, char uplo,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
lapack_logical LAPACKE_ztb_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n, lapack_int kd,
|
||||||
|
const lapack_complex_double* ab,
|
||||||
|
lapack_int ldab );
|
||||||
|
lapack_logical LAPACKE_ztf_nancheck( int matrix_order, char transr,
|
||||||
|
char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a );
|
||||||
|
lapack_logical LAPACKE_ztp_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *ap );
|
||||||
|
lapack_logical LAPACKE_ztr_nancheck( int matrix_order, char uplo, char diag,
|
||||||
|
lapack_int n,
|
||||||
|
const lapack_complex_double *a,
|
||||||
|
lapack_int lda );
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
#endif /* _LAPACKE_UTILS_H_ */
|
44
dla/dla_test.go
Normal file
44
dla/dla_test.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package dla
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/dane-unltd/lapack/clapack"
|
||||||
|
"github.com/gonum/blas"
|
||||||
|
"github.com/gonum/blas/cblas"
|
||||||
|
"github.com/gonum/blas/d"
|
||||||
|
"github.com/gonum/matrix/mat64"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
type fm struct {
|
||||||
|
mat64.Matrix
|
||||||
|
margin int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m fm) Format(fs fmt.State, c rune) {
|
||||||
|
if c == 'v' && fs.Flag('#') {
|
||||||
|
fmt.Fprintf(fs, "%#v", m.Matrix)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mat64.Format(m.Matrix, m.margin, '.', fs, c)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Register(clapack.La{})
|
||||||
|
d.Register(cblas.Blas{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestQR(t *testing.T) {
|
||||||
|
A := d.NewGeneral(blas.ColMajor, 3, 2,
|
||||||
|
[]float64{1, 2, 3, 4, 5, 6})
|
||||||
|
B := d.NewGeneral(blas.ColMajor, 3, 2,
|
||||||
|
[]float64{1, 1, 1, 2, 2, 2})
|
||||||
|
|
||||||
|
tau := d.Allocate(2)
|
||||||
|
|
||||||
|
f := QR(A, tau)
|
||||||
|
|
||||||
|
fmt.Println(fm{B, 0})
|
||||||
|
f.Solve(B)
|
||||||
|
fmt.Println(fm{B, 0})
|
||||||
|
}
|
27
dla/dqr.go
Normal file
27
dla/dqr.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package dla
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gonum/blas"
|
||||||
|
"github.com/gonum/blas/d"
|
||||||
|
)
|
||||||
|
|
||||||
|
type QRFact struct {
|
||||||
|
a d.General
|
||||||
|
tau []float64
|
||||||
|
}
|
||||||
|
|
||||||
|
func QR(A d.General, tau []float64) QRFact {
|
||||||
|
impl.Dgeqrf(A, tau)
|
||||||
|
return QRFact{A, tau}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f QRFact) R() d.Triangular {
|
||||||
|
return d.Ge2Tr(f.a, blas.NonUnit, blas.Upper)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f QRFact) Solve(B d.General) d.General {
|
||||||
|
impl.Dormqr('L', 'T', f.a, f.tau, B)
|
||||||
|
B.Rows = f.a.Cols
|
||||||
|
f.R().SolveM(blas.Left, blas.NoTrans, 1, B)
|
||||||
|
return B
|
||||||
|
}
|
9
dla/impl.go
Normal file
9
dla/impl.go
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package dla
|
||||||
|
|
||||||
|
import "github.com/dane-unltd/lapack"
|
||||||
|
|
||||||
|
var impl lapack.Float64
|
||||||
|
|
||||||
|
func Register(i lapack.Float64) {
|
||||||
|
impl = i
|
||||||
|
}
|
21
dqr.go
21
dqr.go
@@ -1,21 +0,0 @@
|
|||||||
package lapack
|
|
||||||
|
|
||||||
import "github.com/gonum/blas"
|
|
||||||
|
|
||||||
type QRFact struct {
|
|
||||||
A blas.General
|
|
||||||
tau []float64
|
|
||||||
}
|
|
||||||
|
|
||||||
func QR(A blas.General, tau []float64) QRFact {
|
|
||||||
impl.Dgeqrf(A, tau)
|
|
||||||
return QRFact{A, tau}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f QRFact) Solve(B blas.General) blas.General {
|
|
||||||
impl.Dormqr(blas.Left, blas.Trans, f.A, f.tau, B)
|
|
||||||
blas.Dtrsm(blas.Left, blas.NoTrans, 1,
|
|
||||||
blas.Ge2Tr(f.A, blas.NonUnit, blas.Upper), B)
|
|
||||||
B.Rows = f.A.Cols
|
|
||||||
return B
|
|
||||||
}
|
|
7
impl.go
7
impl.go
@@ -1,7 +0,0 @@
|
|||||||
package lapack
|
|
||||||
|
|
||||||
var impl Lapack
|
|
||||||
|
|
||||||
func Register(i Lapack) {
|
|
||||||
impl = i
|
|
||||||
}
|
|
@@ -1,10 +1,10 @@
|
|||||||
package lapack
|
package lapack
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gonum/blas"
|
"github.com/gonum/blas/d"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Lapack interface {
|
type Float64 interface {
|
||||||
Dgeqrf(A blas.General, tau []float64)
|
Dgeqrf(A d.General, tau []float64)
|
||||||
Dormqr(s blas.Side, t blas.Transpose, A blas.General, tau []float64, B blas.General)
|
Dormqr(s byte, t byte, A d.General, tau []float64, B d.General)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user