/src/lib/libqt/lapack_intfc.cc
C++ | 12343 lines | 893 code | 121 blank | 11329 comment | 0 complexity | 5f62f5e55b7d33b0f1c546d75ddc1322 MD5 | raw file
- /*
- *@BEGIN LICENSE
- *
- * PSI4: an ab initio quantum chemistry software package
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- *@END LICENSE
- */
- /**!
- ** \file
- ** \brief Interface to all LAPACK routines
- ** \ingroup QT
- **
- ** Autogenerated by Rob Parrish on 1/23/2011
- **
- */
- #include "qt.h"
- #include "lapack_intfc_mangle.h"
- extern "C" {
- extern int F_DBDSDC(char*, char*, int*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DBDSQR(char*, int*, int*, int*, int*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DDISNA(char*, int*, int*, double*, double*, int*);
- extern int F_DGBBRD(char*, int*, int*, int*, int*, int*, double*, int*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DGBCON(char*, int*, int*, int*, double*, int*, int*, double*, double*, double*, int*, int*);
- extern int F_DGBEQU(int*, int*, int*, int*, double*, int*, double*, double*, double*, double*, double*, int*);
- extern int F_DGBRFS(char*, int*, int*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DGBSV(int*, int*, int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DGBSVX(char*, char*, int*, int*, int*, int*, double*, int*, double*, int*, int*, char*, double*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGBTRF(int*, int*, int*, int*, double*, int*, int*, int*);
- extern int F_DGBTRS(char*, int*, int*, int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DGEBAK(char*, char*, int*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DGEBAL(char*, int*, double*, int*, int*, int*, double*, int*);
- extern int F_DGEBRD(int*, int*, double*, int*, double*, double*, double*, double*, double*, int*, int*);
- extern int F_DGECON(char*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DGEEQU(int*, int*, double*, int*, double*, double*, double*, double*, double*, int*);
- extern int F_DGEES(char*, char*, int*, double*, int*, int*, double*, double*, double*, int*, double*, int*, int*);
- extern int F_DGEESX(char*, char*, char*, int*, double*, int*, int*, double*, double*, double*, int*, double*, double*, double*, int*, int*, int*, int*);
- extern int F_DGEEV(char*, char*, int*, double*, int*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGEEVX(char*, char*, char*, char*, int*, double*, int*, double*, double*, double*, int*, double*, int*, int*, int*, double*, double*, double*, double*, double*, int*, int*, int*);
- extern int F_DGEGS(char*, char*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGEGV(char*, char*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGEHRD(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DGELQF(int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DGELS(char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGELSD(int*, int*, int*, double*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DGELSS(int*, int*, int*, double*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DGELSX(int*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*);
- extern int F_DGELSY(int*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DGEQLF(int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DGEQP3(int*, int*, double*, int*, int*, double*, double*, int*, int*);
- extern int F_DGEQPF(int*, int*, double*, int*, int*, double*, double*, int*);
- extern int F_DGEQRF(int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DGERFS(char*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DGERQF(int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DGESDD(char*, int*, int*, double*, int*, double*, double*, int*, double*, int*, double*, int*, int*, int*);
- extern int F_DGESV(int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DGESVX(char*, char*, int*, int*, double*, int*, double*, int*, int*, char*, double*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGETRF(int*, int*, double*, int*, int*, int*);
- extern int F_DGETRI(int*, double*, int*, int*, double*, int*, int*);
- extern int F_DGETRS(char*, int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DGGBAK(char*, char*, int*, int*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DGGBAL(char*, int*, double*, int*, double*, int*, int*, int*, double*, double*, double*, int*);
- extern int F_DGGES(char*, char*, char*, int*, double*, int*, double*, int*, int*, double*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGGESX(char*, char*, char*, char*, int*, double*, int*, double*, int*, int*, double*, double*, double*, double*, int*, double*, int*, double*, double*, double*, int*, int*, int*, int*);
- extern int F_DGGEV(char*, char*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGGEVX(char*, char*, char*, char*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, int*, int*, double*, double*, double*, double*, double*, double*, double*, int*, int*, int*);
- extern int F_DGGGLM(int*, int*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGGHRD(char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGGLSE(int*, int*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGGQRF(int*, int*, int*, double*, int*, double*, double*, int*, double*, double*, int*, int*);
- extern int F_DGGRQF(int*, int*, int*, double*, int*, double*, double*, int*, double*, double*, int*, int*);
- extern int F_DGGSVD(char*, char*, char*, int*, int*, int*, int*, int*, double*, int*, double*, int*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DGGSVP(char*, char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, int*, double*, int*, int*, double*, double*, int*);
- extern int F_DGTCON(char*, int*, double*, double*, double*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DGTRFS(char*, int*, int*, double*, double*, double*, double*, double*, double*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DGTSV(int*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGTSVX(char*, char*, int*, int*, double*, double*, double*, double*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DGTTRF(int*, double*, double*, double*, double*, int*, int*);
- extern int F_DGTTRS(char*, int*, int*, double*, double*, double*, double*, int*, double*, int*, int*);
- extern int F_DHGEQZ(char*, char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DHSEIN(char*, char*, char*, int*, double*, int*, double*, double*, double*, int*, double*, int*, int*, int*, double*, int*, int*, int*);
- extern int F_DHSEQR(char*, char*, int*, int*, int*, double*, int*, double*, double*, double*, int*, double*, int*, int*);
- extern int F_DOPGTR(char*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DOPMTR(char*, char*, char*, int*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DORGBR(char*, int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGHR(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGLQ(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGQL(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGQR(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGRQ(int*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORGTR(char*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DORMBR(char*, char*, char*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMHR(char*, char*, int*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMLQ(char*, char*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMQL(char*, char*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMQR(char*, char*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMR3(char*, char*, int*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*);
- extern int F_DORMRQ(char*, char*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMRZ(char*, char*, int*, int*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DORMTR(char*, char*, char*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*);
- extern int F_DPBCON(char*, int*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DPBEQU(char*, int*, int*, double*, int*, double*, double*, double*, int*);
- extern int F_DPBRFS(char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DPBSTF(char*, int*, int*, double*, int*, int*);
- extern int F_DPBSV(char*, int*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DPBSVX(char*, char*, int*, int*, int*, double*, int*, double*, int*, char*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DPBTRF(char*, int*, int*, double*, int*, int*);
- extern int F_DPBTRS(char*, int*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DPOCON(char*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DPOEQU(int*, double*, int*, double*, double*, double*, int*);
- extern int F_DPORFS(char*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DPOSV(char*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DPOSVX(char*, char*, int*, int*, double*, int*, double*, int*, char*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DPOTRF(char*, int*, double*, int*, int*);
- extern int F_DPOTRI(char*, int*, double*, int*, int*);
- extern int F_DPOTRS(char*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DPPCON(char*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DPPEQU(char*, int*, double*, double*, double*, double*, int*);
- extern int F_DPPRFS(char*, int*, int*, double*, double*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DPPSV(char*, int*, int*, double*, double*, int*, int*);
- extern int F_DPPSVX(char*, char*, int*, int*, double*, double*, char*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DPPTRF(char*, int*, double*, int*);
- extern int F_DPPTRI(char*, int*, double*, int*);
- extern int F_DPPTRS(char*, int*, int*, double*, double*, int*, int*);
- extern int F_DPTCON(int*, double*, double*, double*, double*, double*, int*);
- extern int F_DPTEQR(char*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DPTRFS(int*, int*, double*, double*, double*, double*, double*, int*, double*, int*, double*, double*, double*, int*);
- extern int F_DPTSV(int*, int*, double*, double*, double*, int*, int*);
- extern int F_DPTSVX(char*, int*, int*, double*, double*, double*, double*, double*, int*, double*, int*, double*, double*, double*, double*, int*);
- extern int F_DPTTRF(int*, double*, double*, int*);
- extern int F_DPTTRS(int*, int*, double*, double*, double*, int*, int*);
- extern int F_DSBEV(char*, char*, int*, int*, double*, int*, double*, double*, int*, double*, int*);
- extern int F_DSBEVD(char*, char*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSBEVX(char*, char*, char*, int*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DSBGST(char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DSBGV(char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, double*, int*, double*, int*);
- extern int F_DSBGVD(char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSBGVX(char*, char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DSBTRD(char*, char*, int*, int*, double*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DSGESV(int*, int*, double*, int*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DSPCON(char*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DSPEV(char*, char*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DSPEVD(char*, char*, int*, double*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSPEVX(char*, char*, char*, int*, double*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DSPGST(int*, char*, int*, double*, double*, int*);
- extern int F_DSPGV(int*, char*, char*, int*, double*, double*, double*, double*, int*, double*, int*);
- extern int F_DSPGVD(int*, char*, char*, int*, double*, double*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSPGVX(int*, char*, char*, char*, int*, double*, double*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DSPRFS(char*, int*, int*, double*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DSPSV(char*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DSPSVX(char*, char*, int*, int*, double*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DSPTRD(char*, int*, double*, double*, double*, double*, int*);
- extern int F_DSPTRF(char*, int*, double*, int*, int*);
- extern int F_DSPTRI(char*, int*, double*, int*, double*, int*);
- extern int F_DSPTRS(char*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DSTEBZ(char*, char*, int*, double*, double*, int*, int*, double*, double*, double*, int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DSTEDC(char*, int*, double*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSTEGR(char*, char*, int*, double*, double*, double*, double*, int*, int*, double*, int*, double*, double*, int*, int*, double*, int*, int*, int*, int*);
- extern int F_DSTEIN(int*, double*, double*, int*, double*, int*, int*, double*, int*, double*, int*, int*, int*);
- extern int F_DSTEQR(char*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DSTERF(int*, double*, double*, int*);
- extern int F_DSTEV(char*, int*, double*, double*, double*, int*, double*, int*);
- extern int F_DSTEVD(char*, int*, double*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSTEVR(char*, char*, int*, double*, double*, double*, double*, int*, int*, double*, int*, double*, double*, int*, int*, double*, int*, int*, int*, int*);
- extern int F_DSTEVX(char*, char*, int*, double*, double*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*);
- extern int F_DSYCON(char*, int*, double*, int*, int*, double*, double*, double*, int*, int*);
- extern int F_DSYEV(char*, char*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DSYEVD(char*, char*, int*, double*, int*, double*, double*, int*, int*, int*, int*);
- extern int F_DSYEVR(char*, char*, char*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, double*, int*, int*, double*, int*, int*, int*, int*);
- extern int F_DSYEVX(char*, char*, char*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSYGST(int*, char*, int*, double*, int*, double*, int*, int*);
- extern int F_DSYGV(int*, char*, char*, int*, double*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DSYGVD(int*, char*, char*, int*, double*, int*, double*, int*, double*, double*, int*, int*, int*, int*);
- extern int F_DSYGVX(int*, char*, char*, char*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, double*, double*, int*, double*, int*, int*, int*, int*);
- extern int F_DSYRFS(char*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DSYSV(char*, int*, int*, double*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DSYSVX(char*, char*, int*, int*, double*, int*, double*, int*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DSYTRD(char*, int*, double*, int*, double*, double*, double*, double*, int*, int*);
- extern int F_DSYTRF(char*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DSYTRI(char*, int*, double*, int*, int*, double*, int*);
- extern int F_DSYTRS(char*, int*, int*, double*, int*, int*, double*, int*, int*);
- extern int F_DTBCON(char*, char*, char*, int*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DTBRFS(char*, char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DTBTRS(char*, char*, char*, int*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DTGEVC(char*, char*, int*, double*, int*, double*, int*, double*, int*, double*, int*, int*, int*, double*, int*);
- extern int F_DTGEXC(int*, double*, int*, double*, int*, double*, int*, double*, int*, int*, int*, double*, int*, int*);
- extern int F_DTGSEN(int*, int*, double*, int*, double*, int*, double*, double*, double*, double*, int*, double*, int*, int*, double*, double*, double*, double*, int*, int*, int*, int*);
- extern int F_DTGSJA(char*, char*, char*, int*, int*, int*, int*, int*, double*, int*, double*, int*, double*, double*, double*, double*, double*, int*, double*, int*, double*, int*, double*, int*, int*);
- extern int F_DTGSNA(char*, char*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, int*, int*);
- extern int F_DTGSYL(char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*, int*);
- extern int F_DTPCON(char*, char*, char*, int*, double*, double*, double*, int*, int*);
- extern int F_DTPRFS(char*, char*, char*, int*, int*, double*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DTPTRI(char*, char*, int*, double*, int*);
- extern int F_DTPTRS(char*, char*, char*, int*, int*, double*, double*, int*, int*);
- extern int F_DTRCON(char*, char*, char*, int*, double*, int*, double*, double*, int*, int*);
- extern int F_DTREVC(char*, char*, int*, double*, int*, double*, int*, double*, int*, int*, int*, double*, int*);
- extern int F_DTREXC(char*, int*, double*, int*, double*, int*, int*, int*, double*, int*);
- extern int F_DTRRFS(char*, char*, char*, int*, int*, double*, int*, double*, int*, double*, int*, double*, double*, double*, int*, int*);
- extern int F_DTRSEN(char*, char*, int*, double*, int*, double*, int*, double*, double*, int*, double*, double*, double*, int*, int*, int*, int*);
- extern int F_DTRSNA(char*, char*, int*, double*, int*, double*, int*, double*, int*, double*, double*, int*, int*, double*, int*, int*, int*);
- extern int F_DTRSYL(char*, char*, int*, int*, int*, double*, int*, double*, int*, double*, int*, double*, int*);
- extern int F_DTRTRI(char*, char*, int*, double*, int*, int*);
- extern int F_DTRTRS(char*, char*, char*, int*, int*, double*, int*, double*, int*, int*);
- extern int F_DTZRQF(int*, int*, double*, int*, double*, int*);
- extern int F_DTZRZF(int*, int*, double*, int*, double*, double*, int*, int*);
- }
- namespace psi {
- /**
- * Purpose
- * =======
- *
- * DBDSDC computes the singular value decomposition (SVD) of a real
- * N-by-N (upper or lower) bidiagonal matrix B: B = U * S * VT,
- * using a divide and conquer method, where S is a diagonal matrix
- * with non-negative diagonal elements (the singular values of B), and
- * U and VT are orthogonal matrices of left and right singular vectors,
- * respectively. DBDSDC can be used to compute all singular values,
- * and optionally, singular vectors or singular vectors in compact form.
- *
- * This code makes very mild assumptions about floating point
- * arithmetic. It will work on machines with a guard digit in
- * add/subtract, or on those binary machines without guard digits
- * which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2.
- * It could conceivably fail on hexadecimal or decimal machines
- * without guard digits, but we know of none. See DLASD3 for details.
- *
- * The code currently calls DLASDQ if singular values only are desired.
- * However, it can be slightly modified to compute singular values
- * using the divide and conquer method.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': B is upper bidiagonal.
- * = 'L': B is lower bidiagonal.
- *
- * COMPQ (input) CHARACTER*1
- * Specifies whether singular vectors are to be computed
- * as follows:
- * = 'N': Compute singular values only;
- * = 'P': Compute singular values and compute singular
- * vectors in compact form;
- * = 'I': Compute singular values and singular vectors.
- *
- * N (input) INTEGER
- * The order of the matrix B. N >= 0.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, the n diagonal elements of the bidiagonal matrix B.
- * On exit, if INFO=0, the singular values of B.
- *
- * E (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, the elements of E contain the offdiagonal
- * elements of the bidiagonal matrix whose SVD is desired.
- * On exit, E has been destroyed.
- *
- * U (output) DOUBLE PRECISION array, dimension (LDU,N)
- * If COMPQ = 'I', then:
- * On exit, if INFO = 0, U contains the left singular vectors
- * of the bidiagonal matrix.
- * For other values of COMPQ, U is not referenced.
- *
- * LDU (input) INTEGER
- * The leading dimension of the array U. LDU >= 1.
- * If singular vectors are desired, then LDU >= max( 1, N ).
- *
- * VT (output) DOUBLE PRECISION array, dimension (LDVT,N)
- * If COMPQ = 'I', then:
- * On exit, if INFO = 0, VT' contains the right singular
- * vectors of the bidiagonal matrix.
- * For other values of COMPQ, VT is not referenced.
- *
- * LDVT (input) INTEGER
- * The leading dimension of the array VT. LDVT >= 1.
- * If singular vectors are desired, then LDVT >= max( 1, N ).
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ)
- * If COMPQ = 'P', then:
- * On exit, if INFO = 0, Q and IQ contain the left
- * and right singular vectors in a compact form,
- * requiring O(N log N) space instead of 2*N**2.
- * In particular, Q contains all the DOUBLE PRECISION data in
- * LDQ >= N*(11 + 2*SMLSIZ + 8*INT(LOG_2(N/(SMLSIZ+1))))
- * words of memory, where SMLSIZ is returned by ILAENV and
- * is equal to the maximum size of the subproblems at the
- * bottom of the computation tree (usually about 25).
- * For other values of COMPQ, Q is not referenced.
- *
- * IQ (output) INTEGER array, dimension (LDIQ)
- * If COMPQ = 'P', then:
- * On exit, if INFO = 0, Q and IQ contain the left
- * and right singular vectors in a compact form,
- * requiring O(N log N) space instead of 2*N**2.
- * In particular, IQ contains all INTEGER data in
- * LDIQ >= N*(3 + 3*INT(LOG_2(N/(SMLSIZ+1))))
- * words of memory, where SMLSIZ is returned by ILAENV and
- * is equal to the maximum size of the subproblems at the
- * bottom of the computation tree (usually about 25).
- * For other values of COMPQ, IQ is not referenced.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * If COMPQ = 'N' then LWORK >= (4 * N).
- * If COMPQ = 'P' then LWORK >= (6 * N).
- * If COMPQ = 'I' then LWORK >= (3 * N**2 + 4 * N).
- *
- * IWORK (workspace) INTEGER array, dimension (8*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: The algorithm failed to compute a singular value.
- * The update process of divide and conquer failed.
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * Ming Gu and Huan Ren, Computer Science Division, University of
- * California at Berkeley, USA
- *
- * =====================================================================
- * Changed dimension statement in comment describing E from (N) to
- * (N-1). Sven, 17 Feb 05.
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DBDSDC(char uplo, char compq, int n, double* d, double* e, double* u, int ldu, double* vt, int ldvt, double* q, int* iq, double* work, int* iwork)
- {
- int info;
- ::F_DBDSDC(&uplo, &compq, &n, d, e, u, &ldu, vt, &ldvt, q, iq, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DBDSQR computes the singular values and, optionally, the right and/or
- * left singular vectors from the singular value decomposition (SVD) of
- * a real N-by-N (upper or lower) bidiagonal matrix B using the implicit
- * zero-shift QR algorithm. The SVD of B has the form
- *
- * B = Q * S * P**T
- *
- * where S is the diagonal matrix of singular values, Q is an orthogonal
- * matrix of left singular vectors, and P is an orthogonal matrix of
- * right singular vectors. If left singular vectors are requested, this
- * subroutine actually returns U*Q instead of Q, and, if right singular
- * vectors are requested, this subroutine returns P**T*VT instead of
- * P**T, for given real input matrices U and VT. When U and VT are the
- * orthogonal matrices that reduce a general matrix A to bidiagonal
- * form: A = U*B*VT, as computed by DGEBRD, then
- *
- * A = (U*Q) * S * (P**T*VT)
- *
- * is the SVD of A. Optionally, the subroutine may also compute Q**T*C
- * for a given real input matrix C.
- *
- * See "Computing Small Singular Values of Bidiagonal Matrices With
- * Guaranteed High Relative Accuracy," by J. Demmel and W. Kahan,
- * LAPACK Working Note #3 (or SIAM J. Sci. Statist. Comput. vol. 11,
- * no. 5, pp. 873-912, Sept 1990) and
- * "Accurate singular values and differential qd algorithms," by
- * B. Parlett and V. Fernando, Technical Report CPAM-554, Mathematics
- * Department, University of California at Berkeley, July 1992
- * for a detailed description of the algorithm.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': B is upper bidiagonal;
- * = 'L': B is lower bidiagonal.
- *
- * N (input) INTEGER
- * The order of the matrix B. N >= 0.
- *
- * NCVT (input) INTEGER
- * The number of columns of the matrix VT. NCVT >= 0.
- *
- * NRU (input) INTEGER
- * The number of rows of the matrix U. NRU >= 0.
- *
- * NCC (input) INTEGER
- * The number of columns of the matrix C. NCC >= 0.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, the n diagonal elements of the bidiagonal matrix B.
- * On exit, if INFO=0, the singular values of B in decreasing
- * order.
- *
- * E (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, the N-1 offdiagonal elements of the bidiagonal
- * matrix B.
- * On exit, if INFO = 0, E is destroyed; if INFO > 0, D and E
- * will contain the diagonal and superdiagonal elements of a
- * bidiagonal matrix orthogonally equivalent to the one given
- * as input.
- *
- * VT (input/output) DOUBLE PRECISION array, dimension (LDVT, NCVT)
- * On entry, an N-by-NCVT matrix VT.
- * On exit, VT is overwritten by P**T * VT.
- * Not referenced if NCVT = 0.
- *
- * LDVT (input) INTEGER
- * The leading dimension of the array VT.
- * LDVT >= max(1,N) if NCVT > 0; LDVT >= 1 if NCVT = 0.
- *
- * U (input/output) DOUBLE PRECISION array, dimension (LDU, N)
- * On entry, an NRU-by-N matrix U.
- * On exit, U is overwritten by U * Q.
- * Not referenced if NRU = 0.
- *
- * LDU (input) INTEGER
- * The leading dimension of the array U. LDU >= max(1,NRU).
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC, NCC)
- * On entry, an N-by-NCC matrix C.
- * On exit, C is overwritten by Q**T * C.
- * Not referenced if NCC = 0.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C.
- * LDC >= max(1,N) if NCC > 0; LDC >=1 if NCC = 0.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (4*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: If INFO = -i, the i-th argument had an illegal value
- * > 0:
- * if NCVT = NRU = NCC = 0,
- * = 1, a split was marked by a positive value in E
- * = 2, current block of Z not diagonalized after 30*N
- * iterations (in inner while loop)
- * = 3, termination criterion of outer while loop not met
- * (program created more than N unreduced blocks)
- * else NCVT = NRU = NCC = 0,
- * the algorithm did not converge; D and E contain the
- * elements of a bidiagonal matrix which is orthogonally
- * similar to the input matrix B; if INFO = i, i
- * elements of E have not converged to zero.
- *
- * Internal Parameters
- * ===================
- *
- * TOLMUL DOUBLE PRECISION, default = max(10,min(100,EPS**(-1/8)))
- * TOLMUL controls the convergence criterion of the QR loop.
- * If it is positive, TOLMUL*EPS is the desired relative
- * precision in the computed singular values.
- * If it is negative, abs(TOLMUL*EPS*sigma_max) is the
- * desired absolute accuracy in the computed singular
- * values (corresponds to relative accuracy
- * abs(TOLMUL*EPS) in the largest singular value.
- * abs(TOLMUL) should be between 1 and 1/EPS, and preferably
- * between 10 (for fast convergence) and .1/EPS
- * (for there to be some accuracy in the results).
- * Default is to lose at either one eighth or 2 of the
- * available decimal digits in each computed singular value
- * (whichever is smaller).
- *
- * MAXITR INTEGER, default = 6
- * MAXITR controls the maximum number of passes of the
- * algorithm through its inner loop. The algorithms stops
- * (and so fails to converge) if the number of passes
- * through the inner loop exceeds MAXITR*N**2.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DBDSQR(char uplo, int n, int ncvt, int nru, int ncc, double* d, double* e, double* vt, int ldvt, double* u, int ldu, double* c, int ldc, double* work)
- {
- int info;
- ::F_DBDSQR(&uplo, &n, &ncvt, &nru, &ncc, d, e, vt, &ldvt, u, &ldu, c, &ldc, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DDISNA computes the reciprocal condition numbers for the eigenvectors
- * of a real symmetric or complex Hermitian matrix or for the left or
- * right singular vectors of a general m-by-n matrix. The reciprocal
- * condition number is the 'gap' between the corresponding eigenvalue or
- * singular value and the nearest other one.
- *
- * The bound on the error, measured by angle in radians, in the I-th
- * computed vector is given by
- *
- * DLAMCH( 'E' ) * ( ANORM / SEP( I ) )
- *
- * where ANORM = 2-norm(A) = max( abs( D(j) ) ). SEP(I) is not allowed
- * to be smaller than DLAMCH( 'E' )*ANORM in order to limit the size of
- * the error bound.
- *
- * DDISNA may also be used to compute error bounds for eigenvectors of
- * the generalized symmetric definite eigenproblem.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * Specifies for which problem the reciprocal condition numbers
- * should be computed:
- * = 'E': the eigenvectors of a symmetric/Hermitian matrix;
- * = 'L': the left singular vectors of a general matrix;
- * = 'R': the right singular vectors of a general matrix.
- *
- * M (input) INTEGER
- * The number of rows of the matrix. M >= 0.
- *
- * N (input) INTEGER
- * If JOB = 'L' or 'R', the number of columns of the matrix,
- * in which case N >= 0. Ignored if JOB = 'E'.
- *
- * D (input) DOUBLE PRECISION array, dimension (M) if JOB = 'E'
- * dimension (min(M,N)) if JOB = 'L' or 'R'
- * The eigenvalues (if JOB = 'E') or singular values (if JOB =
- * 'L' or 'R') of the matrix, in either increasing or decreasing
- * order. If singular values, they must be non-negative.
- *
- * SEP (output) DOUBLE PRECISION array, dimension (M) if JOB = 'E'
- * dimension (min(M,N)) if JOB = 'L' or 'R'
- * The reciprocal condition numbers of the vectors.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DDISNA(char job, int m, int n, double* d, double* sep)
- {
- int info;
- ::F_DDISNA(&job, &m, &n, d, sep, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBBRD reduces a real general m-by-n band matrix A to upper
- * bidiagonal form B by an orthogonal transformation: Q' * A * P = B.
- *
- * The routine computes B, and optionally forms Q or P', or computes
- * Q'*C for a given matrix C.
- *
- * Arguments
- * =========
- *
- * VECT (input) CHARACTER*1
- * Specifies whether or not the matrices Q and P' are to be
- * formed.
- * = 'N': do not form Q or P';
- * = 'Q': form Q only;
- * = 'P': form P' only;
- * = 'B': form both.
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * NCC (input) INTEGER
- * The number of columns of the matrix C. NCC >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals of the matrix A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals of the matrix A. KU >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the m-by-n band matrix A, stored in rows 1 to
- * KL+KU+1. The j-th column of A is stored in the j-th column of
- * the array AB as follows:
- * AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
- * On exit, A is overwritten by values generated during the
- * reduction.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array A. LDAB >= KL+KU+1.
- *
- * D (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The diagonal elements of the bidiagonal matrix B.
- *
- * E (output) DOUBLE PRECISION array, dimension (min(M,N)-1)
- * The superdiagonal elements of the bidiagonal matrix B.
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ,M)
- * If VECT = 'Q' or 'B', the m-by-m orthogonal matrix Q.
- * If VECT = 'N' or 'P', the array Q is not referenced.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q.
- * LDQ >= max(1,M) if VECT = 'Q' or 'B'; LDQ >= 1 otherwise.
- *
- * PT (output) DOUBLE PRECISION array, dimension (LDPT,N)
- * If VECT = 'P' or 'B', the n-by-n orthogonal matrix P'.
- * If VECT = 'N' or 'Q', the array PT is not referenced.
- *
- * LDPT (input) INTEGER
- * The leading dimension of the array PT.
- * LDPT >= max(1,N) if VECT = 'P' or 'B'; LDPT >= 1 otherwise.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,NCC)
- * On entry, an m-by-ncc matrix C.
- * On exit, C is overwritten by Q'*C.
- * C is not referenced if NCC = 0.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C.
- * LDC >= max(1,M) if NCC > 0; LDC >= 1 if NCC = 0.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (2*max(M,N))
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBBRD(char vect, int m, int n, int ncc, int kl, int ku, double* ab, int ldab, double* d, double* e, double* q, int ldq, double* pt, int ldpt, double* c, int ldc, double* work)
- {
- int info;
- ::F_DGBBRD(&vect, &m, &n, &ncc, &kl, &ku, ab, &ldab, d, e, q, &ldq, pt, &ldpt, c, &ldc, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBCON estimates the reciprocal of the condition number of a real
- * general band matrix A, in either the 1-norm or the infinity-norm,
- * using the LU factorization computed by DGBTRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as
- * RCOND = 1 / ( norm(A) * norm(inv(A)) ).
- *
- * Arguments
- * =========
- *
- * NORM (input) CHARACTER*1
- * Specifies whether the 1-norm condition number or the
- * infinity-norm condition number is required:
- * = '1' or 'O': 1-norm;
- * = 'I': Infinity-norm.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * Details of the LU factorization of the band matrix A, as
- * computed by DGBTRF. U is stored as an upper triangular band
- * matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
- * the multipliers used during the factorization are stored in
- * rows KL+KU+2 to 2*KL+KU+1.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= N, row i of the matrix was
- * interchanged with row IPIV(i).
- *
- * ANORM (input) DOUBLE PRECISION
- * If NORM = '1' or 'O', the 1-norm of the original matrix A.
- * If NORM = 'I', the infinity-norm of the original matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(norm(A) * norm(inv(A))).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBCON(char norm, int n, int kl, int ku, double* ab, int ldab, int* ipiv, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DGBCON(&norm, &n, &kl, &ku, ab, &ldab, ipiv, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBEQU computes row and column scalings intended to equilibrate an
- * M-by-N band matrix A and reduce its condition number. R returns the
- * row scale factors and C the column scale factors, chosen to try to
- * make the largest element in each row and column of the matrix B with
- * elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
- *
- * R(i) and C(j) are restricted to be between SMLNUM = smallest safe
- * number and BIGNUM = largest safe number. Use of these scaling
- * factors is not guaranteed to reduce the condition number of A but
- * works well in practice.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The band matrix A, stored in rows 1 to KL+KU+1. The j-th
- * column of A is stored in the j-th column of the array AB as
- * follows:
- * AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KL+KU+1.
- *
- * R (output) DOUBLE PRECISION array, dimension (M)
- * If INFO = 0, or INFO > M, R contains the row scale factors
- * for A.
- *
- * C (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, C contains the column scale factors for A.
- *
- * ROWCND (output) DOUBLE PRECISION
- * If INFO = 0 or INFO > M, ROWCND contains the ratio of the
- * smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
- * AMAX is neither too large nor too small, it is not worth
- * scaling by R.
- *
- * COLCND (output) DOUBLE PRECISION
- * If INFO = 0, COLCND contains the ratio of the smallest
- * C(i) to the largest C(i). If COLCND >= 0.1, it is not
- * worth scaling by C.
- *
- * AMAX (output) DOUBLE PRECISION
- * Absolute value of largest matrix element. If AMAX is very
- * close to overflow or very close to underflow, the matrix
- * should be scaled.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= M: the i-th row of A is exactly zero
- * > M: the (i-M)-th column of A is exactly zero
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBEQU(int m, int n, int kl, int ku, double* ab, int ldab, double* r, double* c, double* rowcnd, double* colcnd, double* amax)
- {
- int info;
- ::F_DGBEQU(&m, &n, &kl, &ku, ab, &ldab, r, c, rowcnd, colcnd, amax, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBRFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is banded, and provides
- * error bounds and backward error estimates for the solution.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The original band matrix A, stored in rows 1 to KL+KU+1.
- * The j-th column of A is stored in the j-th column of the
- * array AB as follows:
- * AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KL+KU+1.
- *
- * AFB (input) DOUBLE PRECISION array, dimension (LDAFB,N)
- * Details of the LU factorization of the band matrix A, as
- * computed by DGBTRF. U is stored as an upper triangular band
- * matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
- * the multipliers used during the factorization are stored in
- * rows KL+KU+2 to 2*KL+KU+1.
- *
- * LDAFB (input) INTEGER
- * The leading dimension of the array AFB. LDAFB >= 2*KL*KU+1.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices from DGBTRF; for 1<=i<=N, row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DGBTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBRFS(char trans, int n, int kl, int ku, int nrhs, double* ab, int ldab, double* afb, int ldafb, int* ipiv, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DGBRFS(&trans, &n, &kl, &ku, &nrhs, ab, &ldab, afb, &ldafb, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBSV computes the solution to a real system of linear equations
- * A * X = B, where A is a band matrix of order N with KL subdiagonals
- * and KU superdiagonals, and X and B are N-by-NRHS matrices.
- *
- * The LU decomposition with partial pivoting and row interchanges is
- * used to factor A as A = L * U, where L is a product of permutation
- * and unit lower triangular matrices with KL subdiagonals, and U is
- * upper triangular with KL+KU superdiagonals. The factored form of A
- * is then used to solve the system of equations A * X = B.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the matrix A in band storage, in rows KL+1 to
- * 2*KL+KU+1; rows 1 to KL of the array need not be set.
- * The j-th column of A is stored in the j-th column of the
- * array AB as follows:
- * AB(KL+KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+KL)
- * On exit, details of the factorization: U is stored as an
- * upper triangular band matrix with KL+KU superdiagonals in
- * rows 1 to KL+KU+1, and the multipliers used during the
- * factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
- * See below for further details.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
- *
- * IPIV (output) INTEGER array, dimension (N)
- * The pivot indices that define the permutation matrix P;
- * row i of the matrix was interchanged with row IPIV(i).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, and the solution has not been computed.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * M = N = 6, KL = 2, KU = 1:
- *
- * On entry: On exit:
- *
- * * * * + + + * * * u14 u25 u36
- * * * + + + + * * u13 u24 u35 u46
- * * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
- * a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
- * a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 *
- * a31 a42 a53 a64 * * m31 m42 m53 m64 * *
- *
- * Array elements marked * are not used by the routine; elements marked
- * + need not be set on entry, but are required by the routine to store
- * elements of U because of fill-in resulting from the row interchanges.
- *
- * =====================================================================
- *
- * .. External Subroutines ..
- **/
- int C_DGBSV(int n, int kl, int ku, int nrhs, double* ab, int ldab, int* ipiv, double* b, int ldb)
- {
- int info;
- ::F_DGBSV(&n, &kl, &ku, &nrhs, ab, &ldab, ipiv, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBSVX uses the LU factorization to compute the solution to a real
- * system of linear equations A * X = B, A**T * X = B, or A**H * X = B,
- * where A is a band matrix of order N with KL subdiagonals and KU
- * superdiagonals, and X and B are N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed by this subroutine:
- *
- * 1. If FACT = 'E', real scaling factors are computed to equilibrate
- * the system:
- * TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B
- * TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
- * TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B
- * Whether or not the system will be equilibrated depends on the
- * scaling of the matrix A, but if equilibration is used, A is
- * overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')
- * or diag(C)*B (if TRANS = 'T' or 'C').
- *
- * 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the
- * matrix A (after equilibration if FACT = 'E') as
- * A = L * U,
- * where L is a product of permutation and unit lower triangular
- * matrices with KL subdiagonals, and U is upper triangular with
- * KL+KU superdiagonals.
- *
- * 3. If some U(i,i)=0, so that U is exactly singular, then the routine
- * returns with INFO = i. Otherwise, the factored form of A is used
- * to estimate the condition number of the matrix A. If the
- * reciprocal of the condition number is less than machine precision,
- * C++ Return value: INFO (output) INTEGER
- * to solve for X and compute error bounds as described below.
- *
- * 4. The system of equations is solved for X using the factored form
- * of A.
- *
- * 5. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * 6. If equilibration was used, the matrix X is premultiplied by
- * diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so
- * that it solves the original system before equilibration.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of the matrix A is
- * supplied on entry, and if not, whether the matrix A should be
- * equilibrated before it is factored.
- * = 'F': On entry, AFB and IPIV contain the factored form of
- * A. If EQUED is not 'N', the matrix A has been
- * equilibrated with scaling factors given by R and C.
- * AB, AFB, and IPIV are not modified.
- * = 'N': The matrix A will be copied to AFB and factored.
- * = 'E': The matrix A will be equilibrated if necessary, then
- * copied to AFB and factored.
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations.
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Transpose)
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the matrix A in band storage, in rows 1 to KL+KU+1.
- * The j-th column of A is stored in the j-th column of the
- * array AB as follows:
- * AB(KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+kl)
- *
- * If FACT = 'F' and EQUED is not 'N', then A must have been
- * equilibrated by the scaling factors in R and/or C. AB is not
- * modified if FACT = 'F' or 'N', or if FACT = 'E' and
- * EQUED = 'N' on exit.
- *
- * On exit, if EQUED .ne. 'N', A is scaled as follows:
- * EQUED = 'R': A := diag(R) * A
- * EQUED = 'C': A := A * diag(C)
- * EQUED = 'B': A := diag(R) * A * diag(C).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KL+KU+1.
- *
- * AFB (input or output) DOUBLE PRECISION array, dimension (LDAFB,N)
- * If FACT = 'F', then AFB is an input argument and on entry
- * contains details of the LU factorization of the band matrix
- * A, as computed by DGBTRF. U is stored as an upper triangular
- * band matrix with KL+KU superdiagonals in rows 1 to KL+KU+1,
- * and the multipliers used during the factorization are stored
- * in rows KL+KU+2 to 2*KL+KU+1. If EQUED .ne. 'N', then AFB is
- * the factored form of the equilibrated matrix A.
- *
- * If FACT = 'N', then AFB is an output argument and on exit
- * returns details of the LU factorization of A.
- *
- * If FACT = 'E', then AFB is an output argument and on exit
- * returns details of the LU factorization of the equilibrated
- * matrix A (see the description of AB for the form of the
- * equilibrated matrix).
- *
- * LDAFB (input) INTEGER
- * The leading dimension of the array AFB. LDAFB >= 2*KL+KU+1.
- *
- * IPIV (input or output) INTEGER array, dimension (N)
- * If FACT = 'F', then IPIV is an input argument and on entry
- * contains the pivot indices from the factorization A = L*U
- * as computed by DGBTRF; row i of the matrix was interchanged
- * with row IPIV(i).
- *
- * If FACT = 'N', then IPIV is an output argument and on exit
- * contains the pivot indices from the factorization A = L*U
- * of the original matrix A.
- *
- * If FACT = 'E', then IPIV is an output argument and on exit
- * contains the pivot indices from the factorization A = L*U
- * of the equilibrated matrix A.
- *
- * EQUED (input or output) CHARACTER*1
- * Specifies the form of equilibration that was done.
- * = 'N': No equilibration (always true if FACT = 'N').
- * = 'R': Row equilibration, i.e., A has been premultiplied by
- * diag(R).
- * = 'C': Column equilibration, i.e., A has been postmultiplied
- * by diag(C).
- * = 'B': Both row and column equilibration, i.e., A has been
- * replaced by diag(R) * A * diag(C).
- * EQUED is an input argument if FACT = 'F'; otherwise, it is an
- * output argument.
- *
- * R (input or output) DOUBLE PRECISION array, dimension (N)
- * The row scale factors for A. If EQUED = 'R' or 'B', A is
- * multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
- * is not accessed. R is an input argument if FACT = 'F';
- * otherwise, R is an output argument. If FACT = 'F' and
- * EQUED = 'R' or 'B', each element of R must be positive.
- *
- * C (input or output) DOUBLE PRECISION array, dimension (N)
- * The column scale factors for A. If EQUED = 'C' or 'B', A is
- * multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
- * is not accessed. C is an input argument if FACT = 'F';
- * otherwise, C is an output argument. If FACT = 'F' and
- * EQUED = 'C' or 'B', each element of C must be positive.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit,
- * if EQUED = 'N', B is not modified;
- * if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by
- * diag(R)*B;
- * if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is
- * overwritten by diag(C)*B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X
- * to the original system of equations. Note that A and B are
- * modified on exit if EQUED .ne. 'N', and the solution to the
- * equilibrated system is inv(diag(C))*X if TRANS = 'N' and
- * EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C'
- * and EQUED = 'R' or 'B'.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A after equilibration (if done). If RCOND is less than the
- * machine precision (in particular, if RCOND = 0), the matrix
- * is singular to working precision. This condition is
- * indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (3*N)
- * On exit, WORK(1) contains the reciprocal pivot growth
- * factor norm(A)/norm(U). The "max absolute element" norm is
- * used. If WORK(1) is much less than 1, then the stability
- * of the LU factorization of the (equilibrated) matrix A
- * could be poor. This also means that the solution X, condition
- * estimator RCOND, and forward error bound FERR could be
- * unreliable. If factorization fails with 0<INFO<=N, then
- * WORK(1) contains the reciprocal pivot growth factor for the
- * leading INFO columns of A.
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: U(i,i) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, so the solution and error bounds
- * could not be computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBSVX(char fact, char trans, int n, int kl, int ku, int nrhs, double* ab, int ldab, double* afb, int ldafb, int* ipiv, char equed, double* r, double* c, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DGBSVX(&fact, &trans, &n, &kl, &ku, &nrhs, ab, &ldab, afb, &ldafb, ipiv, &equed, r, c, b, &ldb, x, &ldx, rcond, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBTRF computes an LU factorization of a real m-by-n band matrix A
- * using partial pivoting with row interchanges.
- *
- * This is the blocked version of the algorithm, calling Level 3 BLAS.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the matrix A in band storage, in rows KL+1 to
- * 2*KL+KU+1; rows 1 to KL of the array need not be set.
- * The j-th column of A is stored in the j-th column of the
- * array AB as follows:
- * AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
- *
- * On exit, details of the factorization: U is stored as an
- * upper triangular band matrix with KL+KU superdiagonals in
- * rows 1 to KL+KU+1, and the multipliers used during the
- * factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
- * See below for further details.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
- *
- * IPIV (output) INTEGER array, dimension (min(M,N))
- * The pivot indices; for 1 <= i <= min(M,N), row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = +i, U(i,i) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, and division by zero will occur if it is used
- * to solve a system of equations.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * M = N = 6, KL = 2, KU = 1:
- *
- * On entry: On exit:
- *
- * * * * + + + * * * u14 u25 u36
- * * * + + + + * * u13 u24 u35 u46
- * * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
- * a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
- * a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 *
- * a31 a42 a53 a64 * * m31 m42 m53 m64 * *
- *
- * Array elements marked * are not used by the routine; elements marked
- * + need not be set on entry, but are required by the routine to store
- * elements of U because of fill-in resulting from the row interchanges.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBTRF(int m, int n, int kl, int ku, double* ab, int ldab, int* ipiv)
- {
- int info;
- ::F_DGBTRF(&m, &n, &kl, &ku, ab, &ldab, ipiv, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGBTRS solves a system of linear equations
- * A * X = B or A' * X = B
- * with a general band matrix A using the LU factorization computed
- * by DGBTRF.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations.
- * = 'N': A * X = B (No transpose)
- * = 'T': A'* X = B (Transpose)
- * = 'C': A'* X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KL (input) INTEGER
- * The number of subdiagonals within the band of A. KL >= 0.
- *
- * KU (input) INTEGER
- * The number of superdiagonals within the band of A. KU >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * Details of the LU factorization of the band matrix A, as
- * computed by DGBTRF. U is stored as an upper triangular band
- * matrix with KL+KU superdiagonals in rows 1 to KL+KU+1, and
- * the multipliers used during the factorization are stored in
- * rows KL+KU+2 to 2*KL+KU+1.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= N, row i of the matrix was
- * interchanged with row IPIV(i).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit, the solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGBTRS(char trans, int n, int kl, int ku, int nrhs, double* ab, int ldab, int* ipiv, double* b, int ldb)
- {
- int info;
- ::F_DGBTRS(&trans, &n, &kl, &ku, &nrhs, ab, &ldab, ipiv, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEBAK forms the right or left eigenvectors of a real general matrix
- * by backward transformation on the computed eigenvectors of the
- * balanced matrix output by DGEBAL.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * Specifies the type of backward transformation required:
- * = 'N', do nothing, return immediately;
- * = 'P', do backward transformation for permutation only;
- * = 'S', do backward transformation for scaling only;
- * = 'B', do backward transformations for both permutation and
- * scaling.
- * JOB must be the same as the argument JOB supplied to DGEBAL.
- *
- * SIDE (input) CHARACTER*1
- * = 'R': V contains right eigenvectors;
- * = 'L': V contains left eigenvectors.
- *
- * N (input) INTEGER
- * The number of rows of the matrix V. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * The integers ILO and IHI determined by DGEBAL.
- * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
- *
- * SCALE (input) DOUBLE PRECISION array, dimension (N)
- * Details of the permutation and scaling factors, as returned
- * by DGEBAL.
- *
- * M (input) INTEGER
- * The number of columns of the matrix V. M >= 0.
- *
- * V (input/output) DOUBLE PRECISION array, dimension (LDV,M)
- * On entry, the matrix of right or left eigenvectors to be
- * transformed, as returned by DHSEIN or DTREVC.
- * On exit, V is overwritten by the transformed eigenvectors.
- *
- * LDV (input) INTEGER
- * The leading dimension of the array V. LDV >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEBAK(char job, char side, int n, int ilo, int ihi, double* scale, int m, double* v, int ldv)
- {
- int info;
- ::F_DGEBAK(&job, &side, &n, &ilo, &ihi, scale, &m, v, &ldv, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEBAL balances a general real matrix A. This involves, first,
- * permuting A by a similarity transformation to isolate eigenvalues
- * in the first 1 to ILO-1 and last IHI+1 to N elements on the
- * diagonal; and second, applying a diagonal similarity transformation
- * to rows and columns ILO to IHI to make the rows and columns as
- * close in norm as possible. Both steps are optional.
- *
- * Balancing may reduce the 1-norm of the matrix, and improve the
- * accuracy of the computed eigenvalues and/or eigenvectors.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * Specifies the operations to be performed on A:
- * = 'N': none: simply set ILO = 1, IHI = N, SCALE(I) = 1.0
- * for i = 1,...,N;
- * = 'P': permute only;
- * = 'S': scale only;
- * = 'B': both permute and scale.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the input matrix A.
- * On exit, A is overwritten by the balanced matrix.
- * If JOB = 'N', A is not referenced.
- * See Further Details.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * ILO (output) INTEGER
- * IHI (output) INTEGER
- * ILO and IHI are set to integers such that on exit
- * A(i,j) = 0 if i > j and j = 1,...,ILO-1 or I = IHI+1,...,N.
- * If JOB = 'N' or 'S', ILO = 1 and IHI = N.
- *
- * SCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied to
- * A. If P(j) is the index of the row and column interchanged
- * with row and column j and D(j) is the scaling factor
- * applied to row and column j, then
- * SCALE(j) = P(j) for j = 1,...,ILO-1
- * = D(j) for j = ILO,...,IHI
- * = P(j) for j = IHI+1,...,N.
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The permutations consist of row and column interchanges which put
- * the matrix in the form
- *
- * ( T1 X Y )
- * P A P = ( 0 B Z )
- * ( 0 0 T2 )
- *
- * where T1 and T2 are upper triangular matrices whose eigenvalues lie
- * along the diagonal. The column indices ILO and IHI mark the starting
- * and ending columns of the submatrix B. Balancing consists of applying
- * a diagonal similarity transformation inv(D) * B * D to make the
- * 1-norms of each row of B and its corresponding column nearly equal.
- * The output matrix is
- *
- * ( T1 X*D Y )
- * ( 0 inv(D)*B*D inv(D)*Z ).
- * ( 0 0 T2 )
- *
- * Information about the permutations P and the diagonal matrix D is
- * returned in the vector SCALE.
- *
- * This subroutine is based on the EISPACK routine BALANC.
- *
- * Modified by Tzu-Yi Chen, Computer Science Division, University of
- * California at Berkeley, USA
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEBAL(char job, int n, double* a, int lda, int* ilo, int* ihi, double* scale)
- {
- int info;
- ::F_DGEBAL(&job, &n, a, &lda, ilo, ihi, scale, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEBRD reduces a general real M-by-N matrix A to upper or lower
- * bidiagonal form B by an orthogonal transformation: Q**T * A * P = B.
- *
- * If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows in the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns in the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N general matrix to be reduced.
- * On exit,
- * if m >= n, the diagonal and the first superdiagonal are
- * overwritten with the upper bidiagonal matrix B; the
- * elements below the diagonal, with the array TAUQ, represent
- * the orthogonal matrix Q as a product of elementary
- * reflectors, and the elements above the first superdiagonal,
- * with the array TAUP, represent the orthogonal matrix P as
- * a product of elementary reflectors;
- * if m < n, the diagonal and the first subdiagonal are
- * overwritten with the lower bidiagonal matrix B; the
- * elements below the first subdiagonal, with the array TAUQ,
- * represent the orthogonal matrix Q as a product of
- * elementary reflectors, and the elements above the diagonal,
- * with the array TAUP, represent the orthogonal matrix P as
- * a product of elementary reflectors.
- * See Further Details.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * D (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The diagonal elements of the bidiagonal matrix B:
- * D(i) = A(i,i).
- *
- * E (output) DOUBLE PRECISION array, dimension (min(M,N)-1)
- * The off-diagonal elements of the bidiagonal matrix B:
- * if m >= n, E(i) = A(i,i+1) for i = 1,2,...,n-1;
- * if m < n, E(i) = A(i+1,i) for i = 1,2,...,m-1.
- *
- * TAUQ (output) DOUBLE PRECISION array dimension (min(M,N))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix Q. See Further Details.
- *
- * TAUP (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix P. See Further Details.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The length of the array WORK. LWORK >= max(1,M,N).
- * For optimum performance LWORK >= (M+N)*NB, where NB
- * is the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The matrices Q and P are represented as products of elementary
- * reflectors:
- *
- * If m >= n,
- *
- * Q = H(1) H(2) . . . H(n) and P = G(1) G(2) . . . G(n-1)
- *
- * Each H(i) and G(i) has the form:
- *
- * H(i) = I - tauq * v * v' and G(i) = I - taup * u * u'
- *
- * where tauq and taup are real scalars, and v and u are real vectors;
- * v(1:i-1) = 0, v(i) = 1, and v(i+1:m) is stored on exit in A(i+1:m,i);
- * u(1:i) = 0, u(i+1) = 1, and u(i+2:n) is stored on exit in A(i,i+2:n);
- * tauq is stored in TAUQ(i) and taup in TAUP(i).
- *
- * If m < n,
- *
- * Q = H(1) H(2) . . . H(m-1) and P = G(1) G(2) . . . G(m)
- *
- * Each H(i) and G(i) has the form:
- *
- * H(i) = I - tauq * v * v' and G(i) = I - taup * u * u'
- *
- * where tauq and taup are real scalars, and v and u are real vectors;
- * v(1:i) = 0, v(i+1) = 1, and v(i+2:m) is stored on exit in A(i+2:m,i);
- * u(1:i-1) = 0, u(i) = 1, and u(i+1:n) is stored on exit in A(i,i+1:n);
- * tauq is stored in TAUQ(i) and taup in TAUP(i).
- *
- * The contents of A on exit are illustrated by the following examples:
- *
- * m = 6 and n = 5 (m > n): m = 5 and n = 6 (m < n):
- *
- * ( d e u1 u1 u1 ) ( d u1 u1 u1 u1 u1 )
- * ( v1 d e u2 u2 ) ( e d u2 u2 u2 u2 )
- * ( v1 v2 d e u3 ) ( v1 e d u3 u3 u3 )
- * ( v1 v2 v3 d e ) ( v1 v2 e d u4 u4 )
- * ( v1 v2 v3 v4 d ) ( v1 v2 v3 e d u5 )
- * ( v1 v2 v3 v4 v5 )
- *
- * where d and e denote diagonal and off-diagonal elements of B, vi
- * denotes an element of the vector defining H(i), and ui an element of
- * the vector defining G(i).
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEBRD(int m, int n, double* a, int lda, double* d, double* e, double* tauq, double* taup, double* work, int lwork)
- {
- int info;
- ::F_DGEBRD(&m, &n, a, &lda, d, e, tauq, taup, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGECON estimates the reciprocal of the condition number of a general
- * real matrix A, in either the 1-norm or the infinity-norm, using
- * the LU factorization computed by DGETRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as
- * RCOND = 1 / ( norm(A) * norm(inv(A)) ).
- *
- * Arguments
- * =========
- *
- * NORM (input) CHARACTER*1
- * Specifies whether the 1-norm condition number or the
- * infinity-norm condition number is required:
- * = '1' or 'O': 1-norm;
- * = 'I': Infinity-norm.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The factors L and U from the factorization A = P*L*U
- * as computed by DGETRF.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * ANORM (input) DOUBLE PRECISION
- * If NORM = '1' or 'O', the 1-norm of the original matrix A.
- * If NORM = 'I', the infinity-norm of the original matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(norm(A) * norm(inv(A))).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (4*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGECON(char norm, int n, double* a, int lda, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DGECON(&norm, &n, a, &lda, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEEQU computes row and column scalings intended to equilibrate an
- * M-by-N matrix A and reduce its condition number. R returns the row
- * scale factors and C the column scale factors, chosen to try to make
- * the largest element in each row and column of the matrix B with
- * elements B(i,j)=R(i)*A(i,j)*C(j) have absolute value 1.
- *
- * R(i) and C(j) are restricted to be between SMLNUM = smallest safe
- * number and BIGNUM = largest safe number. Use of these scaling
- * factors is not guaranteed to reduce the condition number of A but
- * works well in practice.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The M-by-N matrix whose equilibration factors are
- * to be computed.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * R (output) DOUBLE PRECISION array, dimension (M)
- * If INFO = 0 or INFO > M, R contains the row scale factors
- * for A.
- *
- * C (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, C contains the column scale factors for A.
- *
- * ROWCND (output) DOUBLE PRECISION
- * If INFO = 0 or INFO > M, ROWCND contains the ratio of the
- * smallest R(i) to the largest R(i). If ROWCND >= 0.1 and
- * AMAX is neither too large nor too small, it is not worth
- * scaling by R.
- *
- * COLCND (output) DOUBLE PRECISION
- * If INFO = 0, COLCND contains the ratio of the smallest
- * C(i) to the largest C(i). If COLCND >= 0.1, it is not
- * worth scaling by C.
- *
- * AMAX (output) DOUBLE PRECISION
- * Absolute value of largest matrix element. If AMAX is very
- * close to overflow or very close to underflow, the matrix
- * should be scaled.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= M: the i-th row of A is exactly zero
- * > M: the (i-M)-th column of A is exactly zero
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEEQU(int m, int n, double* a, int lda, double* r, double* c, double* rowcnd, double* colcnd, double* amax)
- {
- int info;
- ::F_DGEEQU(&m, &n, a, &lda, r, c, rowcnd, colcnd, amax, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEES computes for an N-by-N real nonsymmetric matrix A, the
- * eigenvalues, the real Schur form T, and, optionally, the matrix of
- * Schur vectors Z. This gives the Schur factorization A = Z*T*(Z**T).
- *
- * Optionally, it also orders the eigenvalues on the diagonal of the
- * real Schur form so that selected eigenvalues are at the top left.
- * The leading columns of Z then form an orthonormal basis for the
- * invariant subspace corresponding to the selected eigenvalues.
- *
- * A matrix is in real Schur form if it is upper quasi-triangular with
- * 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in the
- * form
- * [ a b ]
- * [ c a ]
- *
- * where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).
- *
- * Arguments
- * =========
- *
- * JOBVS (input) CHARACTER*1
- * = 'N': Schur vectors are not computed;
- * = 'V': Schur vectors are computed.
- *
- * SORT (input) CHARACTER*1
- * Specifies whether or not to order the eigenvalues on the
- * diagonal of the Schur form.
- * = 'N': Eigenvalues are not ordered;
- * = 'S': Eigenvalues are ordered (see SELECT).
- *
- * SELECT (external procedure) LOGICAL FUNCTION of two DOUBLE PRECISION arguments
- * SELECT must be declared EXTERNAL in the calling subroutine.
- * If SORT = 'S', SELECT is used to select eigenvalues to sort
- * to the top left of the Schur form.
- * If SORT = 'N', SELECT is not referenced.
- * An eigenvalue WR(j)+sqrt(-1)*WI(j) is selected if
- * SELECT(WR(j),WI(j)) is true; i.e., if either one of a complex
- * conjugate pair of eigenvalues is selected, then both complex
- * eigenvalues are selected.
- * Note that a selected complex eigenvalue may no longer
- * satisfy SELECT(WR(j),WI(j)) = .TRUE. after ordering, since
- * ordering may change the value of complex eigenvalues
- * (especially if the eigenvalue is ill-conditioned); in this
- * case INFO is set to N+2 (see INFO below).
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N matrix A.
- * On exit, A has been overwritten by its real Schur form T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * SDIM (output) INTEGER
- * If SORT = 'N', SDIM = 0.
- * If SORT = 'S', SDIM = number of eigenvalues (after sorting)
- * for which SELECT is true. (Complex conjugate
- * pairs for which SELECT is true for either
- * eigenvalue count as 2.)
- *
- * WR (output) DOUBLE PRECISION array, dimension (N)
- * WI (output) DOUBLE PRECISION array, dimension (N)
- * WR and WI contain the real and imaginary parts,
- * respectively, of the computed eigenvalues in the same order
- * that they appear on the diagonal of the output Schur form T.
- * Complex conjugate pairs of eigenvalues will appear
- * consecutively with the eigenvalue having the positive
- * imaginary part first.
- *
- * VS (output) DOUBLE PRECISION array, dimension (LDVS,N)
- * If JOBVS = 'V', VS contains the orthogonal matrix Z of Schur
- * vectors.
- * If JOBVS = 'N', VS is not referenced.
- *
- * LDVS (input) INTEGER
- * The leading dimension of the array VS. LDVS >= 1; if
- * JOBVS = 'V', LDVS >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) contains the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,3*N).
- * For good performance, LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * BWORK (workspace) LOGICAL array, dimension (N)
- * Not referenced if SORT = 'N'.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, and i is
- * <= N: the QR algorithm failed to compute all the
- * eigenvalues; elements 1:ILO-1 and i+1:N of WR and WI
- * contain those eigenvalues which have converged; if
- * JOBVS = 'V', VS contains the matrix which reduces A
- * to its partially converged Schur form.
- * = N+1: the eigenvalues could not be reordered because some
- * eigenvalues were too close to separate (the problem
- * is very ill-conditioned);
- * = N+2: after reordering, roundoff changed values of some
- * complex eigenvalues so that leading eigenvalues in
- * the Schur form no longer satisfy SELECT=.TRUE. This
- * could also be caused by underflow due to scaling.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEES(char jobvs, char sort, int n, double* a, int lda, int* sdim, double* wr, double* wi, double* vs, int ldvs, double* work, int lwork)
- {
- int info;
- ::F_DGEES(&jobvs, &sort, &n, a, &lda, sdim, wr, wi, vs, &ldvs, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEESX computes for an N-by-N real nonsymmetric matrix A, the
- * eigenvalues, the real Schur form T, and, optionally, the matrix of
- * Schur vectors Z. This gives the Schur factorization A = Z*T*(Z**T).
- *
- * Optionally, it also orders the eigenvalues on the diagonal of the
- * real Schur form so that selected eigenvalues are at the top left;
- * computes a reciprocal condition number for the average of the
- * selected eigenvalues (RCONDE); and computes a reciprocal condition
- * number for the right invariant subspace corresponding to the
- * selected eigenvalues (RCONDV). The leading columns of Z form an
- * orthonormal basis for this invariant subspace.
- *
- * For further explanation of the reciprocal condition numbers RCONDE
- * and RCONDV, see Section 4.10 of the LAPACK Users' Guide (where
- * these quantities are called s and sep respectively).
- *
- * A real matrix is in real Schur form if it is upper quasi-triangular
- * with 1-by-1 and 2-by-2 blocks. 2-by-2 blocks will be standardized in
- * the form
- * [ a b ]
- * [ c a ]
- *
- * where b*c < 0. The eigenvalues of such a block are a +- sqrt(bc).
- *
- * Arguments
- * =========
- *
- * JOBVS (input) CHARACTER*1
- * = 'N': Schur vectors are not computed;
- * = 'V': Schur vectors are computed.
- *
- * SORT (input) CHARACTER*1
- * Specifies whether or not to order the eigenvalues on the
- * diagonal of the Schur form.
- * = 'N': Eigenvalues are not ordered;
- * = 'S': Eigenvalues are ordered (see SELECT).
- *
- * SELECT (external procedure) LOGICAL FUNCTION of two DOUBLE PRECISION arguments
- * SELECT must be declared EXTERNAL in the calling subroutine.
- * If SORT = 'S', SELECT is used to select eigenvalues to sort
- * to the top left of the Schur form.
- * If SORT = 'N', SELECT is not referenced.
- * An eigenvalue WR(j)+sqrt(-1)*WI(j) is selected if
- * SELECT(WR(j),WI(j)) is true; i.e., if either one of a
- * complex conjugate pair of eigenvalues is selected, then both
- * are. Note that a selected complex eigenvalue may no longer
- * satisfy SELECT(WR(j),WI(j)) = .TRUE. after ordering, since
- * ordering may change the value of complex eigenvalues
- * (especially if the eigenvalue is ill-conditioned); in this
- * case INFO may be set to N+3 (see INFO below).
- *
- * SENSE (input) CHARACTER*1
- * Determines which reciprocal condition numbers are computed.
- * = 'N': None are computed;
- * = 'E': Computed for average of selected eigenvalues only;
- * = 'V': Computed for selected right invariant subspace only;
- * = 'B': Computed for both.
- * If SENSE = 'E', 'V' or 'B', SORT must equal 'S'.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the N-by-N matrix A.
- * On exit, A is overwritten by its real Schur form T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * SDIM (output) INTEGER
- * If SORT = 'N', SDIM = 0.
- * If SORT = 'S', SDIM = number of eigenvalues (after sorting)
- * for which SELECT is true. (Complex conjugate
- * pairs for which SELECT is true for either
- * eigenvalue count as 2.)
- *
- * WR (output) DOUBLE PRECISION array, dimension (N)
- * WI (output) DOUBLE PRECISION array, dimension (N)
- * WR and WI contain the real and imaginary parts, respectively,
- * of the computed eigenvalues, in the same order that they
- * appear on the diagonal of the output Schur form T. Complex
- * conjugate pairs of eigenvalues appear consecutively with the
- * eigenvalue having the positive imaginary part first.
- *
- * VS (output) DOUBLE PRECISION array, dimension (LDVS,N)
- * If JOBVS = 'V', VS contains the orthogonal matrix Z of Schur
- * vectors.
- * If JOBVS = 'N', VS is not referenced.
- *
- * LDVS (input) INTEGER
- * The leading dimension of the array VS. LDVS >= 1, and if
- * JOBVS = 'V', LDVS >= N.
- *
- * RCONDE (output) DOUBLE PRECISION
- * If SENSE = 'E' or 'B', RCONDE contains the reciprocal
- * condition number for the average of the selected eigenvalues.
- * Not referenced if SENSE = 'N' or 'V'.
- *
- * RCONDV (output) DOUBLE PRECISION
- * If SENSE = 'V' or 'B', RCONDV contains the reciprocal
- * condition number for the selected right invariant subspace.
- * Not referenced if SENSE = 'N' or 'E'.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,3*N).
- * Also, if SENSE = 'E' or 'V' or 'B',
- * LWORK >= N+2*SDIM*(N-SDIM), where SDIM is the number of
- * selected eigenvalues computed by this routine. Note that
- * N+2*SDIM*(N-SDIM) <= N+N*N/2. Note also that an error is only
- * returned if LWORK < max(1,3*N), but if SENSE = 'E' or 'V' or
- * 'B' this may not be large enough.
- * For good performance, LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates upper bounds on the optimal sizes of the
- * arrays WORK and IWORK, returns these values as the first
- * entries of the WORK and IWORK arrays, and no error messages
- * related to LWORK or LIWORK are issued by XERBLA.
- *
- * IWORK (workspace/output) INTEGER array, dimension (MAX(1,LIWORK))
- * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
- *
- * LIWORK (input) INTEGER
- * The dimension of the array IWORK.
- * LIWORK >= 1; if SENSE = 'V' or 'B', LIWORK >= SDIM*(N-SDIM).
- * Note that SDIM*(N-SDIM) <= N*N/4. Note also that an error is
- * only returned if LIWORK < 1, but if SENSE = 'V' or 'B' this
- * may not be large enough.
- *
- * If LIWORK = -1, then a workspace query is assumed; the
- * routine only calculates upper bounds on the optimal sizes of
- * the arrays WORK and IWORK, returns these values as the first
- * entries of the WORK and IWORK arrays, and no error messages
- * related to LWORK or LIWORK are issued by XERBLA.
- *
- * BWORK (workspace) LOGICAL array, dimension (N)
- * Not referenced if SORT = 'N'.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, and i is
- * <= N: the QR algorithm failed to compute all the
- * eigenvalues; elements 1:ILO-1 and i+1:N of WR and WI
- * contain those eigenvalues which have converged; if
- * JOBVS = 'V', VS contains the transformation which
- * reduces A to its partially converged Schur form.
- * = N+1: the eigenvalues could not be reordered because some
- * eigenvalues were too close to separate (the problem
- * is very ill-conditioned);
- * = N+2: after reordering, roundoff changed values of some
- * complex eigenvalues so that leading eigenvalues in
- * the Schur form no longer satisfy SELECT=.TRUE. This
- * could also be caused by underflow due to scaling.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEESX(char jobvs, char sort, char sense, int n, double* a, int lda, int* sdim, double* wr, double* wi, double* vs, int ldvs, double* rconde, double* rcondv, double* work, int lwork, int* iwork, int liwork)
- {
- int info;
- ::F_DGEESX(&jobvs, &sort, &sense, &n, a, &lda, sdim, wr, wi, vs, &ldvs, rconde, rcondv, work, &lwork, iwork, &liwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEEV computes for an N-by-N real nonsymmetric matrix A, the
- * eigenvalues and, optionally, the left and/or right eigenvectors.
- *
- * The right eigenvector v(j) of A satisfies
- * A * v(j) = lambda(j) * v(j)
- * where lambda(j) is its eigenvalue.
- * The left eigenvector u(j) of A satisfies
- * u(j)**H * A = lambda(j) * u(j)**H
- * where u(j)**H denotes the conjugate transpose of u(j).
- *
- * The computed eigenvectors are normalized to have Euclidean norm
- * equal to 1 and largest component real.
- *
- * Arguments
- * =========
- *
- * JOBVL (input) CHARACTER*1
- * = 'N': left eigenvectors of A are not computed;
- * = 'V': left eigenvectors of A are computed.
- *
- * JOBVR (input) CHARACTER*1
- * = 'N': right eigenvectors of A are not computed;
- * = 'V': right eigenvectors of A are computed.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N matrix A.
- * On exit, A has been overwritten.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * WR (output) DOUBLE PRECISION array, dimension (N)
- * WI (output) DOUBLE PRECISION array, dimension (N)
- * WR and WI contain the real and imaginary parts,
- * respectively, of the computed eigenvalues. Complex
- * conjugate pairs of eigenvalues appear consecutively
- * with the eigenvalue having the positive imaginary part
- * first.
- *
- * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
- * If JOBVL = 'V', the left eigenvectors u(j) are stored one
- * after another in the columns of VL, in the same order
- * as their eigenvalues.
- * If JOBVL = 'N', VL is not referenced.
- * If the j-th eigenvalue is real, then u(j) = VL(:,j),
- * the j-th column of VL.
- * If the j-th and (j+1)-st eigenvalues form a complex
- * conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and
- * u(j+1) = VL(:,j) - i*VL(:,j+1).
- *
- * LDVL (input) INTEGER
- * The leading dimension of the array VL. LDVL >= 1; if
- * JOBVL = 'V', LDVL >= N.
- *
- * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
- * If JOBVR = 'V', the right eigenvectors v(j) are stored one
- * after another in the columns of VR, in the same order
- * as their eigenvalues.
- * If JOBVR = 'N', VR is not referenced.
- * If the j-th eigenvalue is real, then v(j) = VR(:,j),
- * the j-th column of VR.
- * If the j-th and (j+1)-st eigenvalues form a complex
- * conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and
- * v(j+1) = VR(:,j) - i*VR(:,j+1).
- *
- * LDVR (input) INTEGER
- * The leading dimension of the array VR. LDVR >= 1; if
- * JOBVR = 'V', LDVR >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,3*N), and
- * if JOBVL = 'V' or JOBVR = 'V', LWORK >= 4*N. For good
- * performance, LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, the QR algorithm failed to compute all the
- * eigenvalues, and no eigenvectors have been computed;
- * elements i+1:N of WR and WI contain eigenvalues which
- * have converged.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEEV(char jobvl, char jobvr, int n, double* a, int lda, double* wr, double* wi, double* vl, int ldvl, double* vr, int ldvr, double* work, int lwork)
- {
- int info;
- ::F_DGEEV(&jobvl, &jobvr, &n, a, &lda, wr, wi, vl, &ldvl, vr, &ldvr, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEEVX computes for an N-by-N real nonsymmetric matrix A, the
- * eigenvalues and, optionally, the left and/or right eigenvectors.
- *
- * Optionally also, it computes a balancing transformation to improve
- * the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
- * SCALE, and ABNRM), reciprocal condition numbers for the eigenvalues
- * (RCONDE), and reciprocal condition numbers for the right
- * eigenvectors (RCONDV).
- *
- * The right eigenvector v(j) of A satisfies
- * A * v(j) = lambda(j) * v(j)
- * where lambda(j) is its eigenvalue.
- * The left eigenvector u(j) of A satisfies
- * u(j)**H * A = lambda(j) * u(j)**H
- * where u(j)**H denotes the conjugate transpose of u(j).
- *
- * The computed eigenvectors are normalized to have Euclidean norm
- * equal to 1 and largest component real.
- *
- * Balancing a matrix means permuting the rows and columns to make it
- * more nearly upper triangular, and applying a diagonal similarity
- * transformation D * A * D**(-1), where D is a diagonal matrix, to
- * make its rows and columns closer in norm and the condition numbers
- * of its eigenvalues and eigenvectors smaller. The computed
- * reciprocal condition numbers correspond to the balanced matrix.
- * Permuting rows and columns will not change the condition numbers
- * (in exact arithmetic) but diagonal scaling will. For further
- * explanation of balancing, see section 4.10.2 of the LAPACK
- * Users' Guide.
- *
- * Arguments
- * =========
- *
- * BALANC (input) CHARACTER*1
- * Indicates how the input matrix should be diagonally scaled
- * and/or permuted to improve the conditioning of its
- * eigenvalues.
- * = 'N': Do not diagonally scale or permute;
- * = 'P': Perform permutations to make the matrix more nearly
- * upper triangular. Do not diagonally scale;
- * = 'S': Diagonally scale the matrix, i.e. replace A by
- * D*A*D**(-1), where D is a diagonal matrix chosen
- * to make the rows and columns of A more equal in
- * norm. Do not permute;
- * = 'B': Both diagonally scale and permute A.
- *
- * Computed reciprocal condition numbers will be for the matrix
- * after balancing and/or permuting. Permuting does not change
- * condition numbers (in exact arithmetic), but balancing does.
- *
- * JOBVL (input) CHARACTER*1
- * = 'N': left eigenvectors of A are not computed;
- * = 'V': left eigenvectors of A are computed.
- * If SENSE = 'E' or 'B', JOBVL must = 'V'.
- *
- * JOBVR (input) CHARACTER*1
- * = 'N': right eigenvectors of A are not computed;
- * = 'V': right eigenvectors of A are computed.
- * If SENSE = 'E' or 'B', JOBVR must = 'V'.
- *
- * SENSE (input) CHARACTER*1
- * Determines which reciprocal condition numbers are computed.
- * = 'N': None are computed;
- * = 'E': Computed for eigenvalues only;
- * = 'V': Computed for right eigenvectors only;
- * = 'B': Computed for eigenvalues and right eigenvectors.
- *
- * If SENSE = 'E' or 'B', both left and right eigenvectors
- * must also be computed (JOBVL = 'V' and JOBVR = 'V').
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N matrix A.
- * On exit, A has been overwritten. If JOBVL = 'V' or
- * JOBVR = 'V', A contains the real Schur form of the balanced
- * version of the input matrix A.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * WR (output) DOUBLE PRECISION array, dimension (N)
- * WI (output) DOUBLE PRECISION array, dimension (N)
- * WR and WI contain the real and imaginary parts,
- * respectively, of the computed eigenvalues. Complex
- * conjugate pairs of eigenvalues will appear consecutively
- * with the eigenvalue having the positive imaginary part
- * first.
- *
- * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
- * If JOBVL = 'V', the left eigenvectors u(j) are stored one
- * after another in the columns of VL, in the same order
- * as their eigenvalues.
- * If JOBVL = 'N', VL is not referenced.
- * If the j-th eigenvalue is real, then u(j) = VL(:,j),
- * the j-th column of VL.
- * If the j-th and (j+1)-st eigenvalues form a complex
- * conjugate pair, then u(j) = VL(:,j) + i*VL(:,j+1) and
- * u(j+1) = VL(:,j) - i*VL(:,j+1).
- *
- * LDVL (input) INTEGER
- * The leading dimension of the array VL. LDVL >= 1; if
- * JOBVL = 'V', LDVL >= N.
- *
- * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
- * If JOBVR = 'V', the right eigenvectors v(j) are stored one
- * after another in the columns of VR, in the same order
- * as their eigenvalues.
- * If JOBVR = 'N', VR is not referenced.
- * If the j-th eigenvalue is real, then v(j) = VR(:,j),
- * the j-th column of VR.
- * If the j-th and (j+1)-st eigenvalues form a complex
- * conjugate pair, then v(j) = VR(:,j) + i*VR(:,j+1) and
- * v(j+1) = VR(:,j) - i*VR(:,j+1).
- *
- * LDVR (input) INTEGER
- * The leading dimension of the array VR. LDVR >= 1, and if
- * JOBVR = 'V', LDVR >= N.
- *
- * ILO (output) INTEGER
- * IHI (output) INTEGER
- * ILO and IHI are integer values determined when A was
- * balanced. The balanced A(i,j) = 0 if I > J and
- * J = 1,...,ILO-1 or I = IHI+1,...,N.
- *
- * SCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied
- * when balancing A. If P(j) is the index of the row and column
- * interchanged with row and column j, and D(j) is the scaling
- * factor applied to row and column j, then
- * SCALE(J) = P(J), for J = 1,...,ILO-1
- * = D(J), for J = ILO,...,IHI
- * = P(J) for J = IHI+1,...,N.
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * ABNRM (output) DOUBLE PRECISION
- * The one-norm of the balanced matrix (the maximum
- * of the sum of absolute values of elements of any column).
- *
- * RCONDE (output) DOUBLE PRECISION array, dimension (N)
- * RCONDE(j) is the reciprocal condition number of the j-th
- * eigenvalue.
- *
- * RCONDV (output) DOUBLE PRECISION array, dimension (N)
- * RCONDV(j) is the reciprocal condition number of the j-th
- * right eigenvector.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. If SENSE = 'N' or 'E',
- * LWORK >= max(1,2*N), and if JOBVL = 'V' or JOBVR = 'V',
- * LWORK >= 3*N. If SENSE = 'V' or 'B', LWORK >= N*(N+6).
- * For good performance, LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * IWORK (workspace) INTEGER array, dimension (2*N-2)
- * If SENSE = 'N' or 'E', not referenced.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, the QR algorithm failed to compute all the
- * eigenvalues, and no eigenvectors or condition numbers
- * have been computed; elements 1:ILO-1 and i+1:N of WR
- * and WI contain eigenvalues which have converged.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEEVX(char balanc, char jobvl, char jobvr, char sense, int n, double* a, int lda, double* wr, double* wi, double* vl, int ldvl, double* vr, int ldvr, int* ilo, int* ihi, double* scale, double* abnrm, double* rconde, double* rcondv, double* work, int lwork, int* iwork)
- {
- int info;
- ::F_DGEEVX(&balanc, &jobvl, &jobvr, &sense, &n, a, &lda, wr, wi, vl, &ldvl, vr, &ldvr, ilo, ihi, scale, abnrm, rconde, rcondv, work, &lwork, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * This routine is deprecated and has been replaced by routine DGGES.
- *
- * DGEGS computes the eigenvalues, real Schur form, and, optionally,
- * left and or/right Schur vectors of a real matrix pair (A,B).
- * Given two square matrices A and B, the generalized real Schur
- * factorization has the form
- *
- * A = Q*S*Z**T, B = Q*T*Z**T
- *
- * where Q and Z are orthogonal matrices, T is upper triangular, and S
- * is an upper quasi-triangular matrix with 1-by-1 and 2-by-2 diagonal
- * blocks, the 2-by-2 blocks corresponding to complex conjugate pairs
- * of eigenvalues of (A,B). The columns of Q are the left Schur vectors
- * and the columns of Z are the right Schur vectors.
- *
- * If only the eigenvalues of (A,B) are needed, the driver routine
- * DGEGV should be used instead. See DGEGV for a description of the
- * eigenvalues of the generalized nonsymmetric eigenvalue problem
- * (GNEP).
- *
- * Arguments
- * =========
- *
- * JOBVSL (input) CHARACTER*1
- * = 'N': do not compute the left Schur vectors;
- * = 'V': compute the left Schur vectors (returned in VSL).
- *
- * JOBVSR (input) CHARACTER*1
- * = 'N': do not compute the right Schur vectors;
- * = 'V': compute the right Schur vectors (returned in VSR).
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VSL, and VSR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the matrix A.
- * On exit, the upper quasi-triangular matrix S from the
- * generalized real Schur factorization.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the matrix B.
- * On exit, the upper triangular matrix T from the generalized
- * real Schur factorization.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * The real parts of each scalar alpha defining an eigenvalue
- * of GNEP.
- *
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * The imaginary parts of each scalar alpha defining an
- * eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
- * eigenvalue is real; if positive, then the j-th and (j+1)-st
- * eigenvalues are a complex conjugate pair, with
- * ALPHAI(j+1) = -ALPHAI(j).
- *
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * The scalars beta that define the eigenvalues of GNEP.
- * Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
- * beta = BETA(j) represent the j-th eigenvalue of the matrix
- * pair (A,B), in one of the forms lambda = alpha/beta or
- * mu = beta/alpha. Since either lambda or mu may overflow,
- * they should not, in general, be computed.
- *
- * VSL (output) DOUBLE PRECISION array, dimension (LDVSL,N)
- * If JOBVSL = 'V', the matrix of left Schur vectors Q.
- * Not referenced if JOBVSL = 'N'.
- *
- * LDVSL (input) INTEGER
- * The leading dimension of the matrix VSL. LDVSL >=1, and
- * if JOBVSL = 'V', LDVSL >= N.
- *
- * VSR (output) DOUBLE PRECISION array, dimension (LDVSR,N)
- * If JOBVSR = 'V', the matrix of right Schur vectors Z.
- * Not referenced if JOBVSR = 'N'.
- *
- * LDVSR (input) INTEGER
- * The leading dimension of the matrix VSR. LDVSR >= 1, and
- * if JOBVSR = 'V', LDVSR >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,4*N).
- * For good performance, LWORK must generally be larger.
- * To compute the optimal value of LWORK, call ILAENV to get
- * blocksizes (for DGEQRF, DORMQR, and DORGQR.) Then compute:
- * NB -- MAX of the blocksizes for DGEQRF, DORMQR, and DORGQR
- * The optimal LWORK is 2*N + N*(NB+1).
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. (A,B) are not in Schur
- * form, but ALPHAR(j), ALPHAI(j), and BETA(j) should
- * be correct for j=INFO+1,...,N.
- * > N: errors that usually indicate LAPACK problems:
- * =N+1: error return from DGGBAL
- * =N+2: error return from DGEQRF
- * =N+3: error return from DORMQR
- * =N+4: error return from DORGQR
- * =N+5: error return from DGGHRD
- * =N+6: error return from DHGEQZ (other than failed
- * iteration)
- * =N+7: error return from DGGBAK (computing VSL)
- * =N+8: error return from DGGBAK (computing VSR)
- * =N+9: error return from DLASCL (various places)
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEGS(char jobvsl, char jobvsr, int n, double* a, int lda, double* b, int ldb, double* alphar, double* alphai, double* beta, double* vsl, int ldvsl, double* vsr, int ldvsr, double* work, int lwork)
- {
- int info;
- ::F_DGEGS(&jobvsl, &jobvsr, &n, a, &lda, b, &ldb, alphar, alphai, beta, vsl, &ldvsl, vsr, &ldvsr, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * This routine is deprecated and has been replaced by routine DGGEV.
- *
- * DGEGV computes the eigenvalues and, optionally, the left and/or right
- * eigenvectors of a real matrix pair (A,B).
- * Given two square matrices A and B,
- * the generalized nonsymmetric eigenvalue problem (GNEP) is to find the
- * eigenvalues lambda and corresponding (non-zero) eigenvectors x such
- * that
- *
- * A*x = lambda*B*x.
- *
- * An alternate form is to find the eigenvalues mu and corresponding
- * eigenvectors y such that
- *
- * mu*A*y = B*y.
- *
- * These two forms are equivalent with mu = 1/lambda and x = y if
- * neither lambda nor mu is zero. In order to deal with the case that
- * lambda or mu is zero or small, two values alpha and beta are returned
- * for each eigenvalue, such that lambda = alpha/beta and
- * mu = beta/alpha.
- *
- * The vectors x and y in the above equations are right eigenvectors of
- * the matrix pair (A,B). Vectors u and v satisfying
- *
- * u**H*A = lambda*u**H*B or mu*v**H*A = v**H*B
- *
- * are left eigenvectors of (A,B).
- *
- * Note: this routine performs "full balancing" on A and B -- see
- * "Further Details", below.
- *
- * Arguments
- * =========
- *
- * JOBVL (input) CHARACTER*1
- * = 'N': do not compute the left generalized eigenvectors;
- * = 'V': compute the left generalized eigenvectors (returned
- * in VL).
- *
- * JOBVR (input) CHARACTER*1
- * = 'N': do not compute the right generalized eigenvectors;
- * = 'V': compute the right generalized eigenvectors (returned
- * in VR).
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VL, and VR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the matrix A.
- * If JOBVL = 'V' or JOBVR = 'V', then on exit A
- * contains the real Schur form of A from the generalized Schur
- * factorization of the pair (A,B) after balancing.
- * If no eigenvectors were computed, then only the diagonal
- * blocks from the Schur form will be correct. See DGGHRD and
- * DHGEQZ for details.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the matrix B.
- * If JOBVL = 'V' or JOBVR = 'V', then on exit B contains the
- * upper triangular matrix obtained from B in the generalized
- * Schur factorization of the pair (A,B) after balancing.
- * If no eigenvectors were computed, then only those elements of
- * B corresponding to the diagonal blocks from the Schur form of
- * A will be correct. See DGGHRD and DHGEQZ for details.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * The real parts of each scalar alpha defining an eigenvalue of
- * GNEP.
- *
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * The imaginary parts of each scalar alpha defining an
- * eigenvalue of GNEP. If ALPHAI(j) is zero, then the j-th
- * eigenvalue is real; if positive, then the j-th and
- * (j+1)-st eigenvalues are a complex conjugate pair, with
- * ALPHAI(j+1) = -ALPHAI(j).
- *
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * The scalars beta that define the eigenvalues of GNEP.
- *
- * Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
- * beta = BETA(j) represent the j-th eigenvalue of the matrix
- * pair (A,B), in one of the forms lambda = alpha/beta or
- * mu = beta/alpha. Since either lambda or mu may overflow,
- * they should not, in general, be computed.
- *
- * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
- * If JOBVL = 'V', the left eigenvectors u(j) are stored
- * in the columns of VL, in the same order as their eigenvalues.
- * If the j-th eigenvalue is real, then u(j) = VL(:,j).
- * If the j-th and (j+1)-st eigenvalues form a complex conjugate
- * pair, then
- * u(j) = VL(:,j) + i*VL(:,j+1)
- * and
- * u(j+1) = VL(:,j) - i*VL(:,j+1).
- *
- * Each eigenvector is scaled so that its largest component has
- * abs(real part) + abs(imag. part) = 1, except for eigenvectors
- * corresponding to an eigenvalue with alpha = beta = 0, which
- * are set to zero.
- * Not referenced if JOBVL = 'N'.
- *
- * LDVL (input) INTEGER
- * The leading dimension of the matrix VL. LDVL >= 1, and
- * if JOBVL = 'V', LDVL >= N.
- *
- * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
- * If JOBVR = 'V', the right eigenvectors x(j) are stored
- * in the columns of VR, in the same order as their eigenvalues.
- * If the j-th eigenvalue is real, then x(j) = VR(:,j).
- * If the j-th and (j+1)-st eigenvalues form a complex conjugate
- * pair, then
- * x(j) = VR(:,j) + i*VR(:,j+1)
- * and
- * x(j+1) = VR(:,j) - i*VR(:,j+1).
- *
- * Each eigenvector is scaled so that its largest component has
- * abs(real part) + abs(imag. part) = 1, except for eigenvalues
- * corresponding to an eigenvalue with alpha = beta = 0, which
- * are set to zero.
- * Not referenced if JOBVR = 'N'.
- *
- * LDVR (input) INTEGER
- * The leading dimension of the matrix VR. LDVR >= 1, and
- * if JOBVR = 'V', LDVR >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,8*N).
- * For good performance, LWORK must generally be larger.
- * To compute the optimal value of LWORK, call ILAENV to get
- * blocksizes (for DGEQRF, DORMQR, and DORGQR.) Then compute:
- * NB -- MAX of the blocksizes for DGEQRF, DORMQR, and DORGQR;
- * The optimal LWORK is:
- * 2*N + MAX( 6*N, N*(NB+1) ).
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. No eigenvectors have been
- * calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
- * should be correct for j=INFO+1,...,N.
- * > N: errors that usually indicate LAPACK problems:
- * =N+1: error return from DGGBAL
- * =N+2: error return from DGEQRF
- * =N+3: error return from DORMQR
- * =N+4: error return from DORGQR
- * =N+5: error return from DGGHRD
- * =N+6: error return from DHGEQZ (other than failed
- * iteration)
- * =N+7: error return from DTGEVC
- * =N+8: error return from DGGBAK (computing VL)
- * =N+9: error return from DGGBAK (computing VR)
- * =N+10: error return from DLASCL (various calls)
- *
- * Further Details
- * ===============
- *
- * Balancing
- * ---------
- *
- * This driver calls DGGBAL to both permute and scale rows and columns
- * of A and B. The permutations PL and PR are chosen so that PL*A*PR
- * and PL*B*R will be upper triangular except for the diagonal blocks
- * A(i:j,i:j) and B(i:j,i:j), with i and j as close together as
- * possible. The diagonal scaling matrices DL and DR are chosen so
- * that the pair DL*PL*A*PR*DR, DL*PL*B*PR*DR have elements close to
- * one (except for the elements that start out zero.)
- *
- * After the eigenvalues and eigenvectors of the balanced matrices
- * have been computed, DGGBAK transforms the eigenvectors back to what
- * they would have been (in perfect arithmetic) if they had not been
- * balanced.
- *
- * Contents of A and B on Exit
- * -------- -- - --- - -- ----
- *
- * If any eigenvectors are computed (either JOBVL='V' or JOBVR='V' or
- * both), then on exit the arrays A and B will contain the real Schur
- * form[*] of the "balanced" versions of A and B. If no eigenvectors
- * are computed, then only the diagonal blocks will be correct.
- *
- * [*] See DHGEQZ, DGEGS, or read the book "Matrix Computations",
- * by Golub & van Loan, pub. by Johns Hopkins U. Press.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEGV(char jobvl, char jobvr, int n, double* a, int lda, double* b, int ldb, double* alphar, double* alphai, double* beta, double* vl, int ldvl, double* vr, int ldvr, double* work, int lwork)
- {
- int info;
- ::F_DGEGV(&jobvl, &jobvr, &n, a, &lda, b, &ldb, alphar, alphai, beta, vl, &ldvl, vr, &ldvr, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEHRD reduces a real general matrix A to upper Hessenberg form H by
- * an orthogonal similarity transformation: Q' * A * Q = H .
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * It is assumed that A is already upper triangular in rows
- * and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally
- * set by a previous call to DGEBAL; otherwise they should be
- * set to 1 and N respectively. See Further Details.
- * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N general matrix to be reduced.
- * On exit, the upper triangle and the first subdiagonal of A
- * are overwritten with the upper Hessenberg matrix H, and the
- * elements below the first subdiagonal, with the array TAU,
- * represent the orthogonal matrix Q as a product of elementary
- * reflectors. See Further Details.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * TAU (output) DOUBLE PRECISION array, dimension (N-1)
- * The scalar factors of the elementary reflectors (see Further
- * Details). Elements 1:ILO-1 and IHI:N-1 of TAU are set to
- * zero.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The length of the array WORK. LWORK >= max(1,N).
- * For optimum performance LWORK >= N*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of (ihi-ilo) elementary
- * reflectors
- *
- * Q = H(ilo) H(ilo+1) . . . H(ihi-1).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on
- * exit in A(i+2:ihi,i), and tau in TAU(i).
- *
- * The contents of A are illustrated by the following example, with
- * n = 7, ilo = 2 and ihi = 6:
- *
- * on entry, on exit,
- *
- * ( a a a a a a a ) ( a a h h h h a )
- * ( a a a a a a ) ( a h h h h a )
- * ( a a a a a a ) ( h h h h h h )
- * ( a a a a a a ) ( v2 h h h h h )
- * ( a a a a a a ) ( v2 v3 h h h h )
- * ( a a a a a a ) ( v2 v3 v4 h h h )
- * ( a ) ( a )
- *
- * where a denotes an element of the original matrix A, h denotes a
- * modified element of the upper Hessenberg matrix H, and vi denotes an
- * element of the vector defining H(i).
- *
- * This file is a slight modification of LAPACK-3.0's DGEHRD
- * subroutine incorporating improvements proposed by Quintana-Orti and
- * Van de Geijn (2006). (See DLAHR2.)
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEHRD(int n, int ilo, int ihi, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGEHRD(&n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGELQF computes an LQ factorization of a real M-by-N matrix A:
- * A = L * Q.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the elements on and below the diagonal of the array
- * contain the m-by-min(m,n) lower trapezoidal matrix L (L is
- * lower triangular if m <= n); the elements above the diagonal,
- * with the array TAU, represent the orthogonal matrix Q as a
- * product of elementary reflectors (see Further Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors (see Further
- * Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,M).
- * For optimum performance LWORK >= M*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(k) . . . H(2) H(1), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i,i+1:n),
- * and tau in TAU(i).
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGELQF(int m, int n, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGELQF(&m, &n, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGELS solves overdetermined or underdetermined real linear systems
- * involving an M-by-N matrix A, or its transpose, using a QR or LQ
- * factorization of A. It is assumed that A has full rank.
- *
- * The following options are provided:
- *
- * 1. If TRANS = 'N' and m >= n: find the least squares solution of
- * an overdetermined system, i.e., solve the least squares problem
- * minimize || B - A*X ||.
- *
- * 2. If TRANS = 'N' and m < n: find the minimum norm solution of
- * an underdetermined system A * X = B.
- *
- * 3. If TRANS = 'T' and m >= n: find the minimum norm solution of
- * an undetermined system A**T * X = B.
- *
- * 4. If TRANS = 'T' and m < n: find the least squares solution of
- * an overdetermined system, i.e., solve the least squares problem
- * minimize || B - A**T * X ||.
- *
- * Several right hand side vectors b and solution vectors x can be
- * handled in a single call; they are stored as the columns of the
- * M-by-NRHS right hand side matrix B and the N-by-NRHS solution
- * matrix X.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * = 'N': the linear system involves A;
- * = 'T': the linear system involves A**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of
- * columns of the matrices B and X. NRHS >=0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit,
- * if M >= N, A is overwritten by details of its QR
- * factorization as returned by DGEQRF;
- * if M < N, A is overwritten by details of its LQ
- * factorization as returned by DGELQF.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the matrix B of right hand side vectors, stored
- * columnwise; B is M-by-NRHS if TRANS = 'N', or N-by-NRHS
- * if TRANS = 'T'.
- * On exit, if INFO = 0, B is overwritten by the solution
- * vectors, stored columnwise:
- * if TRANS = 'N' and m >= n, rows 1 to n of B contain the least
- * squares solution vectors; the residual sum of squares for the
- * solution in each column is given by the sum of squares of
- * elements N+1 to M in that column;
- * if TRANS = 'N' and m < n, rows 1 to N of B contain the
- * minimum norm solution vectors;
- * if TRANS = 'T' and m >= n, rows 1 to M of B contain the
- * minimum norm solution vectors;
- * if TRANS = 'T' and m < n, rows 1 to M of B contain the
- * least squares solution vectors; the residual sum of squares
- * for the solution in each column is given by the sum of
- * squares of elements M+1 to N in that column.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= MAX(1,M,N).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * LWORK >= max( 1, MN + max( MN, NRHS ) ).
- * For optimal performance,
- * LWORK >= max( 1, MN + max( MN, NRHS )*NB ).
- * where MN = min(M,N) and NB is the optimum block size.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the i-th diagonal element of the
- * triangular factor of A is zero, so that A does not have
- * full rank; the least squares solution could not be
- * computed.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGELS(char trans, int m, int n, int nrhs, double* a, int lda, double* b, int ldb, double* work, int lwork)
- {
- int info;
- ::F_DGELS(&trans, &m, &n, &nrhs, a, &lda, b, &ldb, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGELSD computes the minimum-norm solution to a real linear least
- * squares problem:
- * minimize 2-norm(| b - A*x |)
- * using the singular value decomposition (SVD) of A. A is an M-by-N
- * matrix which may be rank-deficient.
- *
- * Several right hand side vectors b and solution vectors x can be
- * handled in a single call; they are stored as the columns of the
- * M-by-NRHS right hand side matrix B and the N-by-NRHS solution
- * matrix X.
- *
- * The problem is solved in three steps:
- * (1) Reduce the coefficient matrix A to bidiagonal form with
- * Householder transformations, reducing the original problem
- * into a "bidiagonal least squares problem" (BLS)
- * (2) Solve the BLS using a divide and conquer approach.
- * (3) Apply back all the Householder tranformations to solve
- * the original least squares problem.
- *
- * The effective rank of A is determined by treating as zero those
- * singular values which are less than RCOND times the largest singular
- * value.
- *
- * The divide and conquer algorithm makes very mild assumptions about
- * floating point arithmetic. It will work on machines with a guard
- * digit in add/subtract, or on those binary machines without guard
- * digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
- * Cray-2. It could conceivably fail on hexadecimal or decimal machines
- * without guard digits, but we know of none.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, A has been destroyed.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the M-by-NRHS right hand side matrix B.
- * On exit, B is overwritten by the N-by-NRHS solution
- * matrix X. If m >= n and RANK = n, the residual
- * sum-of-squares for the solution in the i-th column is given
- * by the sum of squares of elements n+1:m in that column.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,max(M,N)).
- *
- * S (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The singular values of A in decreasing order.
- * The condition number of A in the 2-norm = S(1)/S(min(m,n)).
- *
- * RCOND (input) DOUBLE PRECISION
- * RCOND is used to determine the effective rank of A.
- * Singular values S(i) <= RCOND*S(1) are treated as zero.
- * If RCOND < 0, machine precision is used instead.
- *
- * RANK (output) INTEGER
- * The effective rank of A, i.e., the number of singular values
- * which are greater than RCOND*S(1).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK must be at least 1.
- * The exact minimum amount of workspace needed depends on M,
- * N and NRHS. As long as LWORK is at least
- * 12*N + 2*N*SMLSIZ + 8*N*NLVL + N*NRHS + (SMLSIZ+1)**2,
- * if M is greater than or equal to N or
- * 12*M + 2*M*SMLSIZ + 8*M*NLVL + M*NRHS + (SMLSIZ+1)**2,
- * if M is less than N, the code will execute correctly.
- * SMLSIZ is returned by ILAENV and is equal to the maximum
- * size of the subproblems at the bottom of the computation
- * tree (usually about 25), and
- * NLVL = MAX( 0, INT( LOG_2( MIN( M,N )/(SMLSIZ+1) ) ) + 1 )
- * For good performance, LWORK should generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * IWORK (workspace) INTEGER array, dimension (MAX(1,LIWORK))
- * LIWORK >= max(1, 3 * MINMN * NLVL + 11 * MINMN),
- * where MINMN = MIN( M,N ).
- * On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: the algorithm for computing the SVD failed to converge;
- * if INFO = i, i off-diagonal elements of an intermediate
- * bidiagonal form did not converge to zero.
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * Ming Gu and Ren-Cang Li, Computer Science Division, University of
- * California at Berkeley, USA
- * Osni Marques, LBNL/NERSC, USA
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGELSD(int m, int n, int nrhs, double* a, int lda, double* b, int ldb, double* s, double rcond, int* rank, double* work, int lwork, int* iwork)
- {
- int info;
- ::F_DGELSD(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGELSS computes the minimum norm solution to a real linear least
- * squares problem:
- *
- * Minimize 2-norm(| b - A*x |).
- *
- * using the singular value decomposition (SVD) of A. A is an M-by-N
- * matrix which may be rank-deficient.
- *
- * Several right hand side vectors b and solution vectors x can be
- * handled in a single call; they are stored as the columns of the
- * M-by-NRHS right hand side matrix B and the N-by-NRHS solution matrix
- * X.
- *
- * The effective rank of A is determined by treating as zero those
- * singular values which are less than RCOND times the largest singular
- * value.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the first min(m,n) rows of A are overwritten with
- * its right singular vectors, stored rowwise.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the M-by-NRHS right hand side matrix B.
- * On exit, B is overwritten by the N-by-NRHS solution
- * matrix X. If m >= n and RANK = n, the residual
- * sum-of-squares for the solution in the i-th column is given
- * by the sum of squares of elements n+1:m in that column.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,max(M,N)).
- *
- * S (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The singular values of A in decreasing order.
- * The condition number of A in the 2-norm = S(1)/S(min(m,n)).
- *
- * RCOND (input) DOUBLE PRECISION
- * RCOND is used to determine the effective rank of A.
- * Singular values S(i) <= RCOND*S(1) are treated as zero.
- * If RCOND < 0, machine precision is used instead.
- *
- * RANK (output) INTEGER
- * The effective rank of A, i.e., the number of singular values
- * which are greater than RCOND*S(1).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= 1, and also:
- * LWORK >= 3*min(M,N) + max( 2*min(M,N), max(M,N), NRHS )
- * For good performance, LWORK should generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: the algorithm for computing the SVD failed to converge;
- * if INFO = i, i off-diagonal elements of an intermediate
- * bidiagonal form did not converge to zero.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGELSS(int m, int n, int nrhs, double* a, int lda, double* b, int ldb, double* s, double rcond, int* rank, double* work, int lwork)
- {
- int info;
- ::F_DGELSS(&m, &n, &nrhs, a, &lda, b, &ldb, s, &rcond, rank, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * This routine is deprecated and has been replaced by routine DGELSY.
- *
- * DGELSX computes the minimum-norm solution to a real linear least
- * squares problem:
- * minimize || A * X - B ||
- * using a complete orthogonal factorization of A. A is an M-by-N
- * matrix which may be rank-deficient.
- *
- * Several right hand side vectors b and solution vectors x can be
- * handled in a single call; they are stored as the columns of the
- * M-by-NRHS right hand side matrix B and the N-by-NRHS solution
- * matrix X.
- *
- * The routine first computes a QR factorization with column pivoting:
- * A * P = Q * [ R11 R12 ]
- * [ 0 R22 ]
- * with R11 defined as the largest leading submatrix whose estimated
- * condition number is less than 1/RCOND. The order of R11, RANK,
- * is the effective rank of A.
- *
- * Then, R22 is considered to be negligible, and R12 is annihilated
- * by orthogonal transformations from the right, arriving at the
- * complete orthogonal factorization:
- * A * P = Q * [ T11 0 ] * Z
- * [ 0 0 ]
- * The minimum-norm solution is then
- * X = P * Z' [ inv(T11)*Q1'*B ]
- * [ 0 ]
- * where Q1 consists of the first RANK columns of Q.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of
- * columns of matrices B and X. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, A has been overwritten by details of its
- * complete orthogonal factorization.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the M-by-NRHS right hand side matrix B.
- * On exit, the N-by-NRHS solution matrix X.
- * If m >= n and RANK = n, the residual sum-of-squares for
- * the solution in the i-th column is given by the sum of
- * squares of elements N+1:M in that column.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,M,N).
- *
- * JPVT (input/output) INTEGER array, dimension (N)
- * On entry, if JPVT(i) .ne. 0, the i-th column of A is an
- * initial column, otherwise it is a free column. Before
- * the QR factorization of A, all initial columns are
- * permuted to the leading positions; only the remaining
- * free columns are moved as a result of column pivoting
- * during the factorization.
- * On exit, if JPVT(i) = k, then the i-th column of A*P
- * was the k-th column of A.
- *
- * RCOND (input) DOUBLE PRECISION
- * RCOND is used to determine the effective rank of A, which
- * is defined as the order of the largest leading triangular
- * submatrix R11 in the QR factorization with pivoting of A,
- * whose estimated condition number < 1/RCOND.
- *
- * RANK (output) INTEGER
- * The effective rank of A, i.e., the order of the submatrix
- * R11. This is the same as the order of the submatrix T11
- * in the complete orthogonal factorization of A.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension
- * (max( min(M,N)+3*N, 2*min(M,N)+NRHS )),
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGELSX(int m, int n, int nrhs, double* a, int lda, double* b, int ldb, int* jpvt, double rcond, int* rank, double* work)
- {
- int info;
- ::F_DGELSX(&m, &n, &nrhs, a, &lda, b, &ldb, jpvt, &rcond, rank, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGELSY computes the minimum-norm solution to a real linear least
- * squares problem:
- * minimize || A * X - B ||
- * using a complete orthogonal factorization of A. A is an M-by-N
- * matrix which may be rank-deficient.
- *
- * Several right hand side vectors b and solution vectors x can be
- * handled in a single call; they are stored as the columns of the
- * M-by-NRHS right hand side matrix B and the N-by-NRHS solution
- * matrix X.
- *
- * The routine first computes a QR factorization with column pivoting:
- * A * P = Q * [ R11 R12 ]
- * [ 0 R22 ]
- * with R11 defined as the largest leading submatrix whose estimated
- * condition number is less than 1/RCOND. The order of R11, RANK,
- * is the effective rank of A.
- *
- * Then, R22 is considered to be negligible, and R12 is annihilated
- * by orthogonal transformations from the right, arriving at the
- * complete orthogonal factorization:
- * A * P = Q * [ T11 0 ] * Z
- * [ 0 0 ]
- * The minimum-norm solution is then
- * X = P * Z' [ inv(T11)*Q1'*B ]
- * [ 0 ]
- * where Q1 consists of the first RANK columns of Q.
- *
- * This routine is basically identical to the original xGELSX except
- * three differences:
- * o The call to the subroutine xGEQPF has been substituted by the
- * the call to the subroutine xGEQP3. This subroutine is a Blas-3
- * version of the QR factorization with column pivoting.
- * o Matrix B (the right hand side) is updated with Blas-3.
- * o The permutation of matrix B (the right hand side) is faster and
- * more simple.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of
- * columns of matrices B and X. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, A has been overwritten by details of its
- * complete orthogonal factorization.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the M-by-NRHS right hand side matrix B.
- * On exit, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,M,N).
- *
- * JPVT (input/output) INTEGER array, dimension (N)
- * On entry, if JPVT(i) .ne. 0, the i-th column of A is permuted
- * to the front of AP, otherwise column i is a free column.
- * On exit, if JPVT(i) = k, then the i-th column of AP
- * was the k-th column of A.
- *
- * RCOND (input) DOUBLE PRECISION
- * RCOND is used to determine the effective rank of A, which
- * is defined as the order of the largest leading triangular
- * submatrix R11 in the QR factorization with pivoting of A,
- * whose estimated condition number < 1/RCOND.
- *
- * RANK (output) INTEGER
- * The effective rank of A, i.e., the order of the submatrix
- * R11. This is the same as the order of the submatrix T11
- * in the complete orthogonal factorization of A.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * The unblocked strategy requires that:
- * LWORK >= MAX( MN+3*N+1, 2*MN+NRHS ),
- * where MN = min( M, N ).
- * The block algorithm requires that:
- * LWORK >= MAX( MN+2*N+NB*(N+1), 2*MN+NB*NRHS ),
- * where NB is an upper bound on the blocksize returned
- * by ILAENV for the routines DGEQP3, DTZRZF, STZRQF, DORMQR,
- * and DORMRZ.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: If INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
- * E. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- * G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGELSY(int m, int n, int nrhs, double* a, int lda, double* b, int ldb, int* jpvt, double rcond, int* rank, double* work, int lwork)
- {
- int info;
- ::F_DGELSY(&m, &n, &nrhs, a, &lda, b, &ldb, jpvt, &rcond, rank, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEQLF computes a QL factorization of a real M-by-N matrix A:
- * A = Q * L.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit,
- * if m >= n, the lower triangle of the subarray
- * A(m-n+1:m,1:n) contains the N-by-N lower triangular matrix L;
- * if m <= n, the elements on and below the (n-m)-th
- * superdiagonal contain the M-by-N lower trapezoidal matrix L;
- * the remaining elements, with the array TAU, represent the
- * orthogonal matrix Q as a product of elementary reflectors
- * (see Further Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors (see Further
- * Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- * For optimum performance LWORK >= N*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(k) . . . H(2) H(1), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in
- * A(1:m-k+i-1,n-k+i), and tau in TAU(i).
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGEQLF(int m, int n, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGEQLF(&m, &n, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEQP3 computes a QR factorization with column pivoting of a
- * matrix A: A*P = Q*R using Level 3 BLAS.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the upper triangle of the array contains the
- * min(M,N)-by-N upper trapezoidal matrix R; the elements below
- * the diagonal, together with the array TAU, represent the
- * orthogonal matrix Q as a product of min(M,N) elementary
- * reflectors.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * JPVT (input/output) INTEGER array, dimension (N)
- * On entry, if JPVT(J).ne.0, the J-th column of A is permuted
- * to the front of A*P (a leading column); if JPVT(J)=0,
- * the J-th column of A is a free column.
- * On exit, if JPVT(J)=K, then the J-th column of A*P was the
- * the K-th column of A.
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO=0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= 3*N+1.
- * For optimal performance LWORK >= 2*N+( N+1 )*NB, where NB
- * is the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real/complex scalar, and v is a real/complex vector
- * with v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in
- * A(i+1:m,i), and tau in TAU(i).
- *
- * Based on contributions by
- * G. Quintana-Orti, Depto. de Informatica, Universidad Jaime I, Spain
- * X. Sun, Computer Science Dept., Duke University, USA
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEQP3(int m, int n, double* a, int lda, int* jpvt, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGEQP3(&m, &n, a, &lda, jpvt, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * This routine is deprecated and has been replaced by routine DGEQP3.
- *
- * DGEQPF computes a QR factorization with column pivoting of a
- * real M-by-N matrix A: A*P = Q*R.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the upper triangle of the array contains the
- * min(M,N)-by-N upper triangular matrix R; the elements
- * below the diagonal, together with the array TAU,
- * represent the orthogonal matrix Q as a product of
- * min(m,n) elementary reflectors.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * JPVT (input/output) INTEGER array, dimension (N)
- * On entry, if JPVT(i) .ne. 0, the i-th column of A is permuted
- * to the front of A*P (a leading column); if JPVT(i) = 0,
- * the i-th column of A is a free column.
- * On exit, if JPVT(i) = k, then the i-th column of A*P
- * was the k-th column of A.
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(n)
- *
- * Each H(i) has the form
- *
- * H = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i).
- *
- * The matrix P is represented in jpvt as follows: If
- * jpvt(j) = i
- * then the jth column of P is the ith canonical unit vector.
- *
- * Partial column norm updating strategy modified by
- * Z. Drmac and Z. Bujanovic, Dept. of Mathematics,
- * University of Zagreb, Croatia.
- * June 2010
- * For more details see LAPACK Working Note 176.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGEQPF(int m, int n, double* a, int lda, int* jpvt, double* tau, double* work)
- {
- int info;
- ::F_DGEQPF(&m, &n, a, &lda, jpvt, tau, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGEQRF computes a QR factorization of a real M-by-N matrix A:
- * A = Q * R.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the elements on and above the diagonal of the array
- * contain the min(M,N)-by-N upper trapezoidal matrix R (R is
- * upper triangular if m >= n); the elements below the diagonal,
- * with the array TAU, represent the orthogonal matrix Q as a
- * product of min(m,n) elementary reflectors (see Further
- * Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors (see Further
- * Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- * For optimum performance LWORK >= N*NB, where NB is
- * the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(1:i-1) = 0 and v(i) = 1; v(i+1:m) is stored on exit in A(i+1:m,i),
- * and tau in TAU(i).
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGEQRF(int m, int n, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGEQRF(&m, &n, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGERFS improves the computed solution to a system of linear
- * equations and provides error bounds and backward error estimates for
- * the solution.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The original N-by-N matrix A.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
- * The factors L and U from the factorization A = P*L*U
- * as computed by DGETRF.
- *
- * LDAF (input) INTEGER
- * The leading dimension of the array AF. LDAF >= max(1,N).
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices from DGETRF; for 1<=i<=N, row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DGETRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGERFS(char trans, int n, int nrhs, double* a, int lda, double* af, int ldaf, int* ipiv, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DGERFS(&trans, &n, &nrhs, a, &lda, af, &ldaf, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGERQF computes an RQ factorization of a real M-by-N matrix A:
- * A = R * Q.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit,
- * if m <= n, the upper triangle of the subarray
- * A(1:m,n-m+1:n) contains the M-by-M upper triangular matrix R;
- * if m >= n, the elements on and above the (m-n)-th subdiagonal
- * contain the M-by-N upper trapezoidal matrix R;
- * the remaining elements, with the array TAU, represent the
- * orthogonal matrix Q as a product of min(m,n) elementary
- * reflectors (see Further Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAU (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors (see Further
- * Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,M).
- * For optimum performance LWORK >= M*NB, where NB is
- * the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - tau * v * v'
- *
- * where tau is a real scalar, and v is a real vector with
- * v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in
- * A(m-k+i,1:n-k+i-1), and tau in TAU(i).
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGERQF(int m, int n, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DGERQF(&m, &n, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGESDD computes the singular value decomposition (SVD) of a real
- * M-by-N matrix A, optionally computing the left and right singular
- * vectors. If singular vectors are desired, it uses a
- * divide-and-conquer algorithm.
- *
- * The SVD is written
- *
- * A = U * SIGMA * transpose(V)
- *
- * where SIGMA is an M-by-N matrix which is zero except for its
- * min(m,n) diagonal elements, U is an M-by-M orthogonal matrix, and
- * V is an N-by-N orthogonal matrix. The diagonal elements of SIGMA
- * are the singular values of A; they are real and non-negative, and
- * are returned in descending order. The first min(m,n) columns of
- * U and V are the left and right singular vectors of A.
- *
- * Note that the routine returns VT = V**T, not V.
- *
- * The divide and conquer algorithm makes very mild assumptions about
- * floating point arithmetic. It will work on machines with a guard
- * digit in add/subtract, or on those binary machines without guard
- * digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
- * Cray-2. It could conceivably fail on hexadecimal or decimal machines
- * without guard digits, but we know of none.
- *
- * Arguments
- * =========
- *
- * JOBZ (input) CHARACTER*1
- * Specifies options for computing all or part of the matrix U:
- * = 'A': all M columns of U and all N rows of V**T are
- * returned in the arrays U and VT;
- * = 'S': the first min(M,N) columns of U and the first
- * min(M,N) rows of V**T are returned in the arrays U
- * and VT;
- * = 'O': If M >= N, the first N columns of U are overwritten
- * on the array A and all rows of V**T are returned in
- * the array VT;
- * otherwise, all columns of U are returned in the
- * array U and the first M rows of V**T are overwritten
- * in the array A;
- * = 'N': no columns of U or rows of V**T are computed.
- *
- * M (input) INTEGER
- * The number of rows of the input matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the input matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit,
- * if JOBZ = 'O', A is overwritten with the first N columns
- * of U (the left singular vectors, stored
- * columnwise) if M >= N;
- * A is overwritten with the first M rows
- * of V**T (the right singular vectors, stored
- * rowwise) otherwise.
- * if JOBZ .ne. 'O', the contents of A are destroyed.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * S (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The singular values of A, sorted so that S(i) >= S(i+1).
- *
- * U (output) DOUBLE PRECISION array, dimension (LDU,UCOL)
- * UCOL = M if JOBZ = 'A' or JOBZ = 'O' and M < N;
- * UCOL = min(M,N) if JOBZ = 'S'.
- * If JOBZ = 'A' or JOBZ = 'O' and M < N, U contains the M-by-M
- * orthogonal matrix U;
- * if JOBZ = 'S', U contains the first min(M,N) columns of U
- * (the left singular vectors, stored columnwise);
- * if JOBZ = 'O' and M >= N, or JOBZ = 'N', U is not referenced.
- *
- * LDU (input) INTEGER
- * The leading dimension of the array U. LDU >= 1; if
- * JOBZ = 'S' or 'A' or JOBZ = 'O' and M < N, LDU >= M.
- *
- * VT (output) DOUBLE PRECISION array, dimension (LDVT,N)
- * If JOBZ = 'A' or JOBZ = 'O' and M >= N, VT contains the
- * N-by-N orthogonal matrix V**T;
- * if JOBZ = 'S', VT contains the first min(M,N) rows of
- * V**T (the right singular vectors, stored rowwise);
- * if JOBZ = 'O' and M < N, or JOBZ = 'N', VT is not referenced.
- *
- * LDVT (input) INTEGER
- * The leading dimension of the array VT. LDVT >= 1; if
- * JOBZ = 'A' or JOBZ = 'O' and M >= N, LDVT >= N;
- * if JOBZ = 'S', LDVT >= min(M,N).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK;
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= 1.
- * If JOBZ = 'N',
- * LWORK >= 3*min(M,N) + max(max(M,N),7*min(M,N)).
- * If JOBZ = 'O',
- * LWORK >= 3*min(M,N) +
- * max(max(M,N),5*min(M,N)*min(M,N)+4*min(M,N)).
- * If JOBZ = 'S' or 'A'
- * LWORK >= 3*min(M,N) +
- * max(max(M,N),4*min(M,N)*min(M,N)+4*min(M,N)).
- * For good performance, LWORK should generally be larger.
- * If LWORK = -1 but other input arguments are legal, WORK(1)
- * returns the optimal LWORK.
- *
- * IWORK (workspace) INTEGER array, dimension (8*min(M,N))
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: DBDSDC did not converge, updating process failed.
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * Ming Gu and Huan Ren, Computer Science Division, University of
- * California at Berkeley, USA
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGESDD(char jobz, int m, int n, double* a, int lda, double* s, double* u, int ldu, double* vt, int ldvt, double* work, int lwork, int* iwork)
- {
- int info;
- ::F_DGESDD(&jobz, &m, &n, a, &lda, s, u, &ldu, vt, &ldvt, work, &lwork, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGESV computes the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
- *
- * The LU decomposition with partial pivoting and row interchanges is
- * used to factor A as
- * A = P * L * U,
- * where P is a permutation matrix, L is unit lower triangular, and U is
- * upper triangular. The factored form of A is then used to solve the
- * system of equations A * X = B.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N coefficient matrix A.
- * On exit, the factors L and U from the factorization
- * A = P*L*U; the unit diagonal elements of L are not stored.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * IPIV (output) INTEGER array, dimension (N)
- * The pivot indices that define the permutation matrix P;
- * row i of the matrix was interchanged with row IPIV(i).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS matrix of right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, so the solution could not be computed.
- *
- * =====================================================================
- *
- * .. External Subroutines ..
- **/
- int C_DGESV(int n, int nrhs, double* a, int lda, int* ipiv, double* b, int ldb)
- {
- int info;
- ::F_DGESV(&n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGESVX uses the LU factorization to compute the solution to a real
- * system of linear equations
- * A * X = B,
- * where A is an N-by-N matrix and X and B are N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'E', real scaling factors are computed to equilibrate
- * the system:
- * TRANS = 'N': diag(R)*A*diag(C) *inv(diag(C))*X = diag(R)*B
- * TRANS = 'T': (diag(R)*A*diag(C))**T *inv(diag(R))*X = diag(C)*B
- * TRANS = 'C': (diag(R)*A*diag(C))**H *inv(diag(R))*X = diag(C)*B
- * Whether or not the system will be equilibrated depends on the
- * scaling of the matrix A, but if equilibration is used, A is
- * overwritten by diag(R)*A*diag(C) and B by diag(R)*B (if TRANS='N')
- * or diag(C)*B (if TRANS = 'T' or 'C').
- *
- * 2. If FACT = 'N' or 'E', the LU decomposition is used to factor the
- * matrix A (after equilibration if FACT = 'E') as
- * A = P * L * U,
- * where P is a permutation matrix, L is a unit lower triangular
- * matrix, and U is upper triangular.
- *
- * 3. If some U(i,i)=0, so that U is exactly singular, then the routine
- * returns with INFO = i. Otherwise, the factored form of A is used
- * to estimate the condition number of the matrix A. If the
- * reciprocal of the condition number is less than machine precision,
- * C++ Return value: INFO (output) INTEGER
- * to solve for X and compute error bounds as described below.
- *
- * 4. The system of equations is solved for X using the factored form
- * of A.
- *
- * 5. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * 6. If equilibration was used, the matrix X is premultiplied by
- * diag(C) (if TRANS = 'N') or diag(R) (if TRANS = 'T' or 'C') so
- * that it solves the original system before equilibration.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of the matrix A is
- * supplied on entry, and if not, whether the matrix A should be
- * equilibrated before it is factored.
- * = 'F': On entry, AF and IPIV contain the factored form of A.
- * If EQUED is not 'N', the matrix A has been
- * equilibrated with scaling factors given by R and C.
- * A, AF, and IPIV are not modified.
- * = 'N': The matrix A will be copied to AF and factored.
- * = 'E': The matrix A will be equilibrated if necessary, then
- * copied to AF and factored.
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Transpose)
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the N-by-N matrix A. If FACT = 'F' and EQUED is
- * not 'N', then A must have been equilibrated by the scaling
- * factors in R and/or C. A is not modified if FACT = 'F' or
- * 'N', or if FACT = 'E' and EQUED = 'N' on exit.
- *
- * On exit, if EQUED .ne. 'N', A is scaled as follows:
- * EQUED = 'R': A := diag(R) * A
- * EQUED = 'C': A := A * diag(C)
- * EQUED = 'B': A := diag(R) * A * diag(C).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * AF (input or output) DOUBLE PRECISION array, dimension (LDAF,N)
- * If FACT = 'F', then AF is an input argument and on entry
- * contains the factors L and U from the factorization
- * A = P*L*U as computed by DGETRF. If EQUED .ne. 'N', then
- * AF is the factored form of the equilibrated matrix A.
- *
- * If FACT = 'N', then AF is an output argument and on exit
- * returns the factors L and U from the factorization A = P*L*U
- * of the original matrix A.
- *
- * If FACT = 'E', then AF is an output argument and on exit
- * returns the factors L and U from the factorization A = P*L*U
- * of the equilibrated matrix A (see the description of A for
- * the form of the equilibrated matrix).
- *
- * LDAF (input) INTEGER
- * The leading dimension of the array AF. LDAF >= max(1,N).
- *
- * IPIV (input or output) INTEGER array, dimension (N)
- * If FACT = 'F', then IPIV is an input argument and on entry
- * contains the pivot indices from the factorization A = P*L*U
- * as computed by DGETRF; row i of the matrix was interchanged
- * with row IPIV(i).
- *
- * If FACT = 'N', then IPIV is an output argument and on exit
- * contains the pivot indices from the factorization A = P*L*U
- * of the original matrix A.
- *
- * If FACT = 'E', then IPIV is an output argument and on exit
- * contains the pivot indices from the factorization A = P*L*U
- * of the equilibrated matrix A.
- *
- * EQUED (input or output) CHARACTER*1
- * Specifies the form of equilibration that was done.
- * = 'N': No equilibration (always true if FACT = 'N').
- * = 'R': Row equilibration, i.e., A has been premultiplied by
- * diag(R).
- * = 'C': Column equilibration, i.e., A has been postmultiplied
- * by diag(C).
- * = 'B': Both row and column equilibration, i.e., A has been
- * replaced by diag(R) * A * diag(C).
- * EQUED is an input argument if FACT = 'F'; otherwise, it is an
- * output argument.
- *
- * R (input or output) DOUBLE PRECISION array, dimension (N)
- * The row scale factors for A. If EQUED = 'R' or 'B', A is
- * multiplied on the left by diag(R); if EQUED = 'N' or 'C', R
- * is not accessed. R is an input argument if FACT = 'F';
- * otherwise, R is an output argument. If FACT = 'F' and
- * EQUED = 'R' or 'B', each element of R must be positive.
- *
- * C (input or output) DOUBLE PRECISION array, dimension (N)
- * The column scale factors for A. If EQUED = 'C' or 'B', A is
- * multiplied on the right by diag(C); if EQUED = 'N' or 'R', C
- * is not accessed. C is an input argument if FACT = 'F';
- * otherwise, C is an output argument. If FACT = 'F' and
- * EQUED = 'C' or 'B', each element of C must be positive.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit,
- * if EQUED = 'N', B is not modified;
- * if TRANS = 'N' and EQUED = 'R' or 'B', B is overwritten by
- * diag(R)*B;
- * if TRANS = 'T' or 'C' and EQUED = 'C' or 'B', B is
- * overwritten by diag(C)*B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X
- * to the original system of equations. Note that A and B are
- * modified on exit if EQUED .ne. 'N', and the solution to the
- * equilibrated system is inv(diag(C))*X if TRANS = 'N' and
- * EQUED = 'C' or 'B', or inv(diag(R))*X if TRANS = 'T' or 'C'
- * and EQUED = 'R' or 'B'.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A after equilibration (if done). If RCOND is less than the
- * machine precision (in particular, if RCOND = 0), the matrix
- * is singular to working precision. This condition is
- * indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (4*N)
- * On exit, WORK(1) contains the reciprocal pivot growth
- * factor norm(A)/norm(U). The "max absolute element" norm is
- * used. If WORK(1) is much less than 1, then the stability
- * of the LU factorization of the (equilibrated) matrix A
- * could be poor. This also means that the solution X, condition
- * estimator RCOND, and forward error bound FERR could be
- * unreliable. If factorization fails with 0<INFO<=N, then
- * WORK(1) contains the reciprocal pivot growth factor for the
- * leading INFO columns of A.
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: U(i,i) is exactly zero. The factorization has
- * been completed, but the factor U is exactly
- * singular, so the solution and error bounds
- * could not be computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGESVX(char fact, char trans, int n, int nrhs, double* a, int lda, double* af, int ldaf, int* ipiv, char equed, double* r, double* c, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DGESVX(&fact, &trans, &n, &nrhs, a, &lda, af, &ldaf, ipiv, &equed, r, c, b, &ldb, x, &ldx, rcond, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGETRF computes an LU factorization of a general M-by-N matrix A
- * using partial pivoting with row interchanges.
- *
- * The factorization has the form
- * A = P * L * U
- * where P is a permutation matrix, L is lower triangular with unit
- * diagonal elements (lower trapezoidal if m > n), and U is upper
- * triangular (upper trapezoidal if m < n).
- *
- * This is the right-looking Level 3 BLAS version of the algorithm.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix to be factored.
- * On exit, the factors L and U from the factorization
- * A = P*L*U; the unit diagonal elements of L are not stored.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * IPIV (output) INTEGER array, dimension (min(M,N))
- * The pivot indices; for 1 <= i <= min(M,N), row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, U(i,i) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, and division by zero will occur if it is used
- * to solve a system of equations.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGETRF(int m, int n, double* a, int lda, int* ipiv)
- {
- int info;
- ::F_DGETRF(&m, &n, a, &lda, ipiv, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGETRI computes the inverse of a matrix using the LU factorization
- * computed by DGETRF.
- *
- * This method inverts U and then computes inv(A) by solving the system
- * inv(A)*L = inv(U) for inv(A).
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the factors L and U from the factorization
- * A = P*L*U as computed by DGETRF.
- * On exit, if INFO = 0, the inverse of the original matrix A.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices from DGETRF; for 1<=i<=N, row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO=0, then WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- * For optimal performance LWORK >= N*NB, where NB is
- * the optimal blocksize returned by ILAENV.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, U(i,i) is exactly zero; the matrix is
- * singular and its inverse could not be computed.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGETRI(int n, double* a, int lda, int* ipiv, double* work, int lwork)
- {
- int info;
- ::F_DGETRI(&n, a, &lda, ipiv, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGETRS solves a system of linear equations
- * A * X = B or A' * X = B
- * with a general N-by-N matrix A using the LU factorization computed
- * by DGETRF.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A'* X = B (Transpose)
- * = 'C': A'* X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The factors L and U from the factorization A = P*L*U
- * as computed by DGETRF.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices from DGETRF; for 1<=i<=N, row i of the
- * matrix was interchanged with row IPIV(i).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit, the solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGETRS(char trans, int n, int nrhs, double* a, int lda, int* ipiv, double* b, int ldb)
- {
- int info;
- ::F_DGETRS(&trans, &n, &nrhs, a, &lda, ipiv, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGBAK forms the right or left eigenvectors of a real generalized
- * eigenvalue problem A*x = lambda*B*x, by backward transformation on
- * the computed eigenvectors of the balanced pair of matrices output by
- * DGGBAL.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * Specifies the type of backward transformation required:
- * = 'N': do nothing, return immediately;
- * = 'P': do backward transformation for permutation only;
- * = 'S': do backward transformation for scaling only;
- * = 'B': do backward transformations for both permutation and
- * scaling.
- * JOB must be the same as the argument JOB supplied to DGGBAL.
- *
- * SIDE (input) CHARACTER*1
- * = 'R': V contains right eigenvectors;
- * = 'L': V contains left eigenvectors.
- *
- * N (input) INTEGER
- * The number of rows of the matrix V. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * The integers ILO and IHI determined by DGGBAL.
- * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
- *
- * LSCALE (input) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and/or scaling factors applied
- * to the left side of A and B, as returned by DGGBAL.
- *
- * RSCALE (input) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and/or scaling factors applied
- * to the right side of A and B, as returned by DGGBAL.
- *
- * M (input) INTEGER
- * The number of columns of the matrix V. M >= 0.
- *
- * V (input/output) DOUBLE PRECISION array, dimension (LDV,M)
- * On entry, the matrix of right or left eigenvectors to be
- * transformed, as returned by DTGEVC.
- * On exit, V is overwritten by the transformed eigenvectors.
- *
- * LDV (input) INTEGER
- * The leading dimension of the matrix V. LDV >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * See R.C. Ward, Balancing the generalized eigenvalue problem,
- * SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGGBAK(char job, char side, int n, int ilo, int ihi, double* lscale, double* rscale, int m, double* v, int ldv)
- {
- int info;
- ::F_DGGBAK(&job, &side, &n, &ilo, &ihi, lscale, rscale, &m, v, &ldv, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGBAL balances a pair of general real matrices (A,B). This
- * involves, first, permuting A and B by similarity transformations to
- * isolate eigenvalues in the first 1 to ILO$-$1 and last IHI+1 to N
- * elements on the diagonal; and second, applying a diagonal similarity
- * transformation to rows and columns ILO to IHI to make the rows
- * and columns as close in norm as possible. Both steps are optional.
- *
- * Balancing may reduce the 1-norm of the matrices, and improve the
- * accuracy of the computed eigenvalues and/or eigenvectors in the
- * generalized eigenvalue problem A*x = lambda*B*x.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * Specifies the operations to be performed on A and B:
- * = 'N': none: simply set ILO = 1, IHI = N, LSCALE(I) = 1.0
- * and RSCALE(I) = 1.0 for i = 1,...,N.
- * = 'P': permute only;
- * = 'S': scale only;
- * = 'B': both permute and scale.
- *
- * N (input) INTEGER
- * The order of the matrices A and B. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the input matrix A.
- * On exit, A is overwritten by the balanced matrix.
- * If JOB = 'N', A is not referenced.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,N)
- * On entry, the input matrix B.
- * On exit, B is overwritten by the balanced matrix.
- * If JOB = 'N', B is not referenced.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * ILO (output) INTEGER
- * IHI (output) INTEGER
- * ILO and IHI are set to integers such that on exit
- * A(i,j) = 0 and B(i,j) = 0 if i > j and
- * j = 1,...,ILO-1 or i = IHI+1,...,N.
- * If JOB = 'N' or 'S', ILO = 1 and IHI = N.
- *
- * LSCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied
- * to the left side of A and B. If P(j) is the index of the
- * row interchanged with row j, and D(j)
- * is the scaling factor applied to row j, then
- * LSCALE(j) = P(j) for J = 1,...,ILO-1
- * = D(j) for J = ILO,...,IHI
- * = P(j) for J = IHI+1,...,N.
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * RSCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied
- * to the right side of A and B. If P(j) is the index of the
- * column interchanged with column j, and D(j)
- * is the scaling factor applied to column j, then
- * LSCALE(j) = P(j) for J = 1,...,ILO-1
- * = D(j) for J = ILO,...,IHI
- * = P(j) for J = IHI+1,...,N.
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (lwork)
- * lwork must be at least max(1,6*N) when JOB = 'S' or 'B', and
- * at least 1 when JOB = 'N' or 'P'.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * See R.C. WARD, Balancing the generalized eigenvalue problem,
- * SIAM J. Sci. Stat. Comp. 2 (1981), 141-152.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGBAL(char job, int n, double* a, int lda, double* b, int ldb, int* ilo, int* ihi, double* lscale, double* rscale, double* work)
- {
- int info;
- ::F_DGGBAL(&job, &n, a, &lda, b, &ldb, ilo, ihi, lscale, rscale, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGES computes for a pair of N-by-N real nonsymmetric matrices (A,B),
- * the generalized eigenvalues, the generalized real Schur form (S,T),
- * optionally, the left and/or right matrices of Schur vectors (VSL and
- * VSR). This gives the generalized Schur factorization
- *
- * (A,B) = ( (VSL)*S*(VSR)**T, (VSL)*T*(VSR)**T )
- *
- * Optionally, it also orders the eigenvalues so that a selected cluster
- * of eigenvalues appears in the leading diagonal blocks of the upper
- * quasi-triangular matrix S and the upper triangular matrix T.The
- * leading columns of VSL and VSR then form an orthonormal basis for the
- * corresponding left and right eigenspaces (deflating subspaces).
- *
- * (If only the generalized eigenvalues are needed, use the driver
- * DGGEV instead, which is faster.)
- *
- * A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
- * or a ratio alpha/beta = w, such that A - w*B is singular. It is
- * usually represented as the pair (alpha,beta), as there is a
- * reasonable interpretation for beta=0 or both being zero.
- *
- * A pair of matrices (S,T) is in generalized real Schur form if T is
- * upper triangular with non-negative diagonal and S is block upper
- * triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
- * to real generalized eigenvalues, while 2-by-2 blocks of S will be
- * "standardized" by making the corresponding elements of T have the
- * form:
- * [ a 0 ]
- * [ 0 b ]
- *
- * and the pair of corresponding 2-by-2 blocks in S and T will have a
- * complex conjugate pair of generalized eigenvalues.
- *
- *
- * Arguments
- * =========
- *
- * JOBVSL (input) CHARACTER*1
- * = 'N': do not compute the left Schur vectors;
- * = 'V': compute the left Schur vectors.
- *
- * JOBVSR (input) CHARACTER*1
- * = 'N': do not compute the right Schur vectors;
- * = 'V': compute the right Schur vectors.
- *
- * SORT (input) CHARACTER*1
- * Specifies whether or not to order the eigenvalues on the
- * diagonal of the generalized Schur form.
- * = 'N': Eigenvalues are not ordered;
- * = 'S': Eigenvalues are ordered (see SELCTG);
- *
- * SELCTG (external procedure) LOGICAL FUNCTION of three DOUBLE PRECISION arguments
- * SELCTG must be declared EXTERNAL in the calling subroutine.
- * If SORT = 'N', SELCTG is not referenced.
- * If SORT = 'S', SELCTG is used to select eigenvalues to sort
- * to the top left of the Schur form.
- * An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if
- * SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either
- * one of a complex conjugate pair of eigenvalues is selected,
- * then both complex eigenvalues are selected.
- *
- * Note that in the ill-conditioned case, a selected complex
- * eigenvalue may no longer satisfy SELCTG(ALPHAR(j),ALPHAI(j),
- * BETA(j)) = .TRUE. after ordering. INFO is to be set to N+2
- * in this case.
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VSL, and VSR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the first of the pair of matrices.
- * On exit, A has been overwritten by its generalized Schur
- * form S.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the second of the pair of matrices.
- * On exit, B has been overwritten by its generalized Schur
- * form T.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * SDIM (output) INTEGER
- * If SORT = 'N', SDIM = 0.
- * If SORT = 'S', SDIM = number of eigenvalues (after sorting)
- * for which SELCTG is true. (Complex conjugate pairs for which
- * SELCTG is true for either eigenvalue count as 2.)
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
- * be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i,
- * and BETA(j),j=1,...,N are the diagonals of the complex Schur
- * form (S,T) that would result if the 2-by-2 diagonal blocks of
- * the real Schur form of (A,B) were further reduced to
- * triangular form using 2-by-2 complex unitary transformations.
- * If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
- * positive, then the j-th and (j+1)-st eigenvalues are a
- * complex conjugate pair, with ALPHAI(j+1) negative.
- *
- * Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
- * may easily over- or underflow, and BETA(j) may even be zero.
- * Thus, the user should avoid naively computing the ratio.
- * However, ALPHAR and ALPHAI will be always less than and
- * usually comparable with norm(A) in magnitude, and BETA always
- * less than and usually comparable with norm(B).
- *
- * VSL (output) DOUBLE PRECISION array, dimension (LDVSL,N)
- * If JOBVSL = 'V', VSL will contain the left Schur vectors.
- * Not referenced if JOBVSL = 'N'.
- *
- * LDVSL (input) INTEGER
- * The leading dimension of the matrix VSL. LDVSL >=1, and
- * if JOBVSL = 'V', LDVSL >= N.
- *
- * VSR (output) DOUBLE PRECISION array, dimension (LDVSR,N)
- * If JOBVSR = 'V', VSR will contain the right Schur vectors.
- * Not referenced if JOBVSR = 'N'.
- *
- * LDVSR (input) INTEGER
- * The leading dimension of the matrix VSR. LDVSR >= 1, and
- * if JOBVSR = 'V', LDVSR >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If N = 0, LWORK >= 1, else LWORK >= 8*N+16.
- * For good performance , LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * BWORK (workspace) LOGICAL array, dimension (N)
- * Not referenced if SORT = 'N'.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. (A,B) are not in Schur
- * form, but ALPHAR(j), ALPHAI(j), and BETA(j) should
- * be correct for j=INFO+1,...,N.
- * > N: =N+1: other than QZ iteration failed in DHGEQZ.
- * =N+2: after reordering, roundoff changed values of
- * some complex eigenvalues so that leading
- * eigenvalues in the Generalized Schur form no
- * longer satisfy SELCTG=.TRUE. This could also
- * be caused due to scaling.
- * =N+3: reordering failed in DTGSEN.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGES(char jobvsl, char jobvsr, char sort, int n, double* a, int lda, double* b, int ldb, int* sdim, double* alphar, double* alphai, double* beta, double* vsl, int ldvsl, double* vsr, int ldvsr, double* work, int lwork)
- {
- int info;
- ::F_DGGES(&jobvsl, &jobvsr, &sort, &n, a, &lda, b, &ldb, sdim, alphar, alphai, beta, vsl, &ldvsl, vsr, &ldvsr, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGESX computes for a pair of N-by-N real nonsymmetric matrices
- * (A,B), the generalized eigenvalues, the real Schur form (S,T), and,
- * optionally, the left and/or right matrices of Schur vectors (VSL and
- * VSR). This gives the generalized Schur factorization
- *
- * (A,B) = ( (VSL) S (VSR)**T, (VSL) T (VSR)**T )
- *
- * Optionally, it also orders the eigenvalues so that a selected cluster
- * of eigenvalues appears in the leading diagonal blocks of the upper
- * quasi-triangular matrix S and the upper triangular matrix T; computes
- * a reciprocal condition number for the average of the selected
- * eigenvalues (RCONDE); and computes a reciprocal condition number for
- * the right and left deflating subspaces corresponding to the selected
- * eigenvalues (RCONDV). The leading columns of VSL and VSR then form
- * an orthonormal basis for the corresponding left and right eigenspaces
- * (deflating subspaces).
- *
- * A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
- * or a ratio alpha/beta = w, such that A - w*B is singular. It is
- * usually represented as the pair (alpha,beta), as there is a
- * reasonable interpretation for beta=0 or for both being zero.
- *
- * A pair of matrices (S,T) is in generalized real Schur form if T is
- * upper triangular with non-negative diagonal and S is block upper
- * triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
- * to real generalized eigenvalues, while 2-by-2 blocks of S will be
- * "standardized" by making the corresponding elements of T have the
- * form:
- * [ a 0 ]
- * [ 0 b ]
- *
- * and the pair of corresponding 2-by-2 blocks in S and T will have a
- * complex conjugate pair of generalized eigenvalues.
- *
- *
- * Arguments
- * =========
- *
- * JOBVSL (input) CHARACTER*1
- * = 'N': do not compute the left Schur vectors;
- * = 'V': compute the left Schur vectors.
- *
- * JOBVSR (input) CHARACTER*1
- * = 'N': do not compute the right Schur vectors;
- * = 'V': compute the right Schur vectors.
- *
- * SORT (input) CHARACTER*1
- * Specifies whether or not to order the eigenvalues on the
- * diagonal of the generalized Schur form.
- * = 'N': Eigenvalues are not ordered;
- * = 'S': Eigenvalues are ordered (see SELCTG).
- *
- * SELCTG (external procedure) LOGICAL FUNCTION of three DOUBLE PRECISION arguments
- * SELCTG must be declared EXTERNAL in the calling subroutine.
- * If SORT = 'N', SELCTG is not referenced.
- * If SORT = 'S', SELCTG is used to select eigenvalues to sort
- * to the top left of the Schur form.
- * An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if
- * SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either
- * one of a complex conjugate pair of eigenvalues is selected,
- * then both complex eigenvalues are selected.
- * Note that a selected complex eigenvalue may no longer satisfy
- * SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) = .TRUE. after ordering,
- * since ordering may change the value of complex eigenvalues
- * (especially if the eigenvalue is ill-conditioned), in this
- * case INFO is set to N+3.
- *
- * SENSE (input) CHARACTER*1
- * Determines which reciprocal condition numbers are computed.
- * = 'N' : None are computed;
- * = 'E' : Computed for average of selected eigenvalues only;
- * = 'V' : Computed for selected deflating subspaces only;
- * = 'B' : Computed for both.
- * If SENSE = 'E', 'V', or 'B', SORT must equal 'S'.
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VSL, and VSR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the first of the pair of matrices.
- * On exit, A has been overwritten by its generalized Schur
- * form S.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the second of the pair of matrices.
- * On exit, B has been overwritten by its generalized Schur
- * form T.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * SDIM (output) INTEGER
- * If SORT = 'N', SDIM = 0.
- * If SORT = 'S', SDIM = number of eigenvalues (after sorting)
- * for which SELCTG is true. (Complex conjugate pairs for which
- * SELCTG is true for either eigenvalue count as 2.)
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
- * be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i
- * and BETA(j),j=1,...,N are the diagonals of the complex Schur
- * form (S,T) that would result if the 2-by-2 diagonal blocks of
- * the real Schur form of (A,B) were further reduced to
- * triangular form using 2-by-2 complex unitary transformations.
- * If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
- * positive, then the j-th and (j+1)-st eigenvalues are a
- * complex conjugate pair, with ALPHAI(j+1) negative.
- *
- * Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
- * may easily over- or underflow, and BETA(j) may even be zero.
- * Thus, the user should avoid naively computing the ratio.
- * However, ALPHAR and ALPHAI will be always less than and
- * usually comparable with norm(A) in magnitude, and BETA always
- * less than and usually comparable with norm(B).
- *
- * VSL (output) DOUBLE PRECISION array, dimension (LDVSL,N)
- * If JOBVSL = 'V', VSL will contain the left Schur vectors.
- * Not referenced if JOBVSL = 'N'.
- *
- * LDVSL (input) INTEGER
- * The leading dimension of the matrix VSL. LDVSL >=1, and
- * if JOBVSL = 'V', LDVSL >= N.
- *
- * VSR (output) DOUBLE PRECISION array, dimension (LDVSR,N)
- * If JOBVSR = 'V', VSR will contain the right Schur vectors.
- * Not referenced if JOBVSR = 'N'.
- *
- * LDVSR (input) INTEGER
- * The leading dimension of the matrix VSR. LDVSR >= 1, and
- * if JOBVSR = 'V', LDVSR >= N.
- *
- * RCONDE (output) DOUBLE PRECISION array, dimension ( 2 )
- * If SENSE = 'E' or 'B', RCONDE(1) and RCONDE(2) contain the
- * reciprocal condition numbers for the average of the selected
- * eigenvalues.
- * Not referenced if SENSE = 'N' or 'V'.
- *
- * RCONDV (output) DOUBLE PRECISION array, dimension ( 2 )
- * If SENSE = 'V' or 'B', RCONDV(1) and RCONDV(2) contain the
- * reciprocal condition numbers for the selected deflating
- * subspaces.
- * Not referenced if SENSE = 'N' or 'E'.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If N = 0, LWORK >= 1, else if SENSE = 'E', 'V', or 'B',
- * LWORK >= max( 8*N, 6*N+16, 2*SDIM*(N-SDIM) ), else
- * LWORK >= max( 8*N, 6*N+16 ).
- * Note that 2*SDIM*(N-SDIM) <= N*N/2.
- * Note also that an error is only returned if
- * LWORK < max( 8*N, 6*N+16), but if SENSE = 'E' or 'V' or 'B'
- * this may not be large enough.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the bound on the optimal size of the WORK
- * array and the minimum size of the IWORK array, returns these
- * values as the first entries of the WORK and IWORK arrays, and
- * no error message related to LWORK or LIWORK is issued by
- * XERBLA.
- *
- * IWORK (workspace) INTEGER array, dimension (MAX(1,LIWORK))
- * On exit, if INFO = 0, IWORK(1) returns the minimum LIWORK.
- *
- * LIWORK (input) INTEGER
- * The dimension of the array IWORK.
- * If SENSE = 'N' or N = 0, LIWORK >= 1, otherwise
- * LIWORK >= N+6.
- *
- * If LIWORK = -1, then a workspace query is assumed; the
- * routine only calculates the bound on the optimal size of the
- * WORK array and the minimum size of the IWORK array, returns
- * these values as the first entries of the WORK and IWORK
- * arrays, and no error message related to LWORK or LIWORK is
- * issued by XERBLA.
- *
- * BWORK (workspace) LOGICAL array, dimension (N)
- * Not referenced if SORT = 'N'.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. (A,B) are not in Schur
- * form, but ALPHAR(j), ALPHAI(j), and BETA(j) should
- * be correct for j=INFO+1,...,N.
- * > N: =N+1: other than QZ iteration failed in DHGEQZ
- * =N+2: after reordering, roundoff changed values of
- * some complex eigenvalues so that leading
- * eigenvalues in the Generalized Schur form no
- * longer satisfy SELCTG=.TRUE. This could also
- * be caused due to scaling.
- * =N+3: reordering failed in DTGSEN.
- *
- * Further Details
- * ===============
- *
- * An approximate (asymptotic) bound on the average absolute error of
- * the selected eigenvalues is
- *
- * EPS * norm((A, B)) / RCONDE( 1 ).
- *
- * An approximate (asymptotic) bound on the maximum angular error in
- * the computed deflating subspaces is
- *
- * EPS * norm((A, B)) / RCONDV( 2 ).
- *
- * See LAPACK User's Guide, section 4.11 for more information.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGESX(char jobvsl, char jobvsr, char sort, char sense, int n, double* a, int lda, double* b, int ldb, int* sdim, double* alphar, double* alphai, double* beta, double* vsl, int ldvsl, double* vsr, int ldvsr, double* rconde, double* rcondv, double* work, int lwork, int* iwork, int liwork)
- {
- int info;
- ::F_DGGESX(&jobvsl, &jobvsr, &sort, &sense, &n, a, &lda, b, &ldb, sdim, alphar, alphai, beta, vsl, &ldvsl, vsr, &ldvsr, rconde, rcondv, work, &lwork, iwork, &liwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGEV computes for a pair of N-by-N real nonsymmetric matrices (A,B)
- * the generalized eigenvalues, and optionally, the left and/or right
- * generalized eigenvectors.
- *
- * A generalized eigenvalue for a pair of matrices (A,B) is a scalar
- * lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
- * singular. It is usually represented as the pair (alpha,beta), as
- * there is a reasonable interpretation for beta=0, and even for both
- * being zero.
- *
- * The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
- * of (A,B) satisfies
- *
- * A * v(j) = lambda(j) * B * v(j).
- *
- * The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
- * of (A,B) satisfies
- *
- * u(j)**H * A = lambda(j) * u(j)**H * B .
- *
- * where u(j)**H is the conjugate-transpose of u(j).
- *
- *
- * Arguments
- * =========
- *
- * JOBVL (input) CHARACTER*1
- * = 'N': do not compute the left generalized eigenvectors;
- * = 'V': compute the left generalized eigenvectors.
- *
- * JOBVR (input) CHARACTER*1
- * = 'N': do not compute the right generalized eigenvectors;
- * = 'V': compute the right generalized eigenvectors.
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VL, and VR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the matrix A in the pair (A,B).
- * On exit, A has been overwritten.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the matrix B in the pair (A,B).
- * On exit, B has been overwritten.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
- * be the generalized eigenvalues. If ALPHAI(j) is zero, then
- * the j-th eigenvalue is real; if positive, then the j-th and
- * (j+1)-st eigenvalues are a complex conjugate pair, with
- * ALPHAI(j+1) negative.
- *
- * Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
- * may easily over- or underflow, and BETA(j) may even be zero.
- * Thus, the user should avoid naively computing the ratio
- * alpha/beta. However, ALPHAR and ALPHAI will be always less
- * than and usually comparable with norm(A) in magnitude, and
- * BETA always less than and usually comparable with norm(B).
- *
- * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
- * If JOBVL = 'V', the left eigenvectors u(j) are stored one
- * after another in the columns of VL, in the same order as
- * their eigenvalues. If the j-th eigenvalue is real, then
- * u(j) = VL(:,j), the j-th column of VL. If the j-th and
- * (j+1)-th eigenvalues form a complex conjugate pair, then
- * u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1).
- * Each eigenvector is scaled so the largest component has
- * abs(real part)+abs(imag. part)=1.
- * Not referenced if JOBVL = 'N'.
- *
- * LDVL (input) INTEGER
- * The leading dimension of the matrix VL. LDVL >= 1, and
- * if JOBVL = 'V', LDVL >= N.
- *
- * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
- * If JOBVR = 'V', the right eigenvectors v(j) are stored one
- * after another in the columns of VR, in the same order as
- * their eigenvalues. If the j-th eigenvalue is real, then
- * v(j) = VR(:,j), the j-th column of VR. If the j-th and
- * (j+1)-th eigenvalues form a complex conjugate pair, then
- * v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1).
- * Each eigenvector is scaled so the largest component has
- * abs(real part)+abs(imag. part)=1.
- * Not referenced if JOBVR = 'N'.
- *
- * LDVR (input) INTEGER
- * The leading dimension of the matrix VR. LDVR >= 1, and
- * if JOBVR = 'V', LDVR >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,8*N).
- * For good performance, LWORK must generally be larger.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. No eigenvectors have been
- * calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
- * should be correct for j=INFO+1,...,N.
- * > N: =N+1: other than QZ iteration failed in DHGEQZ.
- * =N+2: error return from DTGEVC.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGEV(char jobvl, char jobvr, int n, double* a, int lda, double* b, int ldb, double* alphar, double* alphai, double* beta, double* vl, int ldvl, double* vr, int ldvr, double* work, int lwork)
- {
- int info;
- ::F_DGGEV(&jobvl, &jobvr, &n, a, &lda, b, &ldb, alphar, alphai, beta, vl, &ldvl, vr, &ldvr, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGEVX computes for a pair of N-by-N real nonsymmetric matrices (A,B)
- * the generalized eigenvalues, and optionally, the left and/or right
- * generalized eigenvectors.
- *
- * Optionally also, it computes a balancing transformation to improve
- * the conditioning of the eigenvalues and eigenvectors (ILO, IHI,
- * LSCALE, RSCALE, ABNRM, and BBNRM), reciprocal condition numbers for
- * the eigenvalues (RCONDE), and reciprocal condition numbers for the
- * right eigenvectors (RCONDV).
- *
- * A generalized eigenvalue for a pair of matrices (A,B) is a scalar
- * lambda or a ratio alpha/beta = lambda, such that A - lambda*B is
- * singular. It is usually represented as the pair (alpha,beta), as
- * there is a reasonable interpretation for beta=0, and even for both
- * being zero.
- *
- * The right eigenvector v(j) corresponding to the eigenvalue lambda(j)
- * of (A,B) satisfies
- *
- * A * v(j) = lambda(j) * B * v(j) .
- *
- * The left eigenvector u(j) corresponding to the eigenvalue lambda(j)
- * of (A,B) satisfies
- *
- * u(j)**H * A = lambda(j) * u(j)**H * B.
- *
- * where u(j)**H is the conjugate-transpose of u(j).
- *
- *
- * Arguments
- * =========
- *
- * BALANC (input) CHARACTER*1
- * Specifies the balance option to be performed.
- * = 'N': do not diagonally scale or permute;
- * = 'P': permute only;
- * = 'S': scale only;
- * = 'B': both permute and scale.
- * Computed reciprocal condition numbers will be for the
- * matrices after permuting and/or balancing. Permuting does
- * not change condition numbers (in exact arithmetic), but
- * balancing does.
- *
- * JOBVL (input) CHARACTER*1
- * = 'N': do not compute the left generalized eigenvectors;
- * = 'V': compute the left generalized eigenvectors.
- *
- * JOBVR (input) CHARACTER*1
- * = 'N': do not compute the right generalized eigenvectors;
- * = 'V': compute the right generalized eigenvectors.
- *
- * SENSE (input) CHARACTER*1
- * Determines which reciprocal condition numbers are computed.
- * = 'N': none are computed;
- * = 'E': computed for eigenvalues only;
- * = 'V': computed for eigenvectors only;
- * = 'B': computed for eigenvalues and eigenvectors.
- *
- * N (input) INTEGER
- * The order of the matrices A, B, VL, and VR. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the matrix A in the pair (A,B).
- * On exit, A has been overwritten. If JOBVL='V' or JOBVR='V'
- * or both, then A contains the first part of the real Schur
- * form of the "balanced" versions of the input A and B.
- *
- * LDA (input) INTEGER
- * The leading dimension of A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the matrix B in the pair (A,B).
- * On exit, B has been overwritten. If JOBVL='V' or JOBVR='V'
- * or both, then B contains the second part of the real Schur
- * form of the "balanced" versions of the input A and B.
- *
- * LDB (input) INTEGER
- * The leading dimension of B. LDB >= max(1,N).
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
- * be the generalized eigenvalues. If ALPHAI(j) is zero, then
- * the j-th eigenvalue is real; if positive, then the j-th and
- * (j+1)-st eigenvalues are a complex conjugate pair, with
- * ALPHAI(j+1) negative.
- *
- * Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
- * may easily over- or underflow, and BETA(j) may even be zero.
- * Thus, the user should avoid naively computing the ratio
- * ALPHA/BETA. However, ALPHAR and ALPHAI will be always less
- * than and usually comparable with norm(A) in magnitude, and
- * BETA always less than and usually comparable with norm(B).
- *
- * VL (output) DOUBLE PRECISION array, dimension (LDVL,N)
- * If JOBVL = 'V', the left eigenvectors u(j) are stored one
- * after another in the columns of VL, in the same order as
- * their eigenvalues. If the j-th eigenvalue is real, then
- * u(j) = VL(:,j), the j-th column of VL. If the j-th and
- * (j+1)-th eigenvalues form a complex conjugate pair, then
- * u(j) = VL(:,j)+i*VL(:,j+1) and u(j+1) = VL(:,j)-i*VL(:,j+1).
- * Each eigenvector will be scaled so the largest component have
- * abs(real part) + abs(imag. part) = 1.
- * Not referenced if JOBVL = 'N'.
- *
- * LDVL (input) INTEGER
- * The leading dimension of the matrix VL. LDVL >= 1, and
- * if JOBVL = 'V', LDVL >= N.
- *
- * VR (output) DOUBLE PRECISION array, dimension (LDVR,N)
- * If JOBVR = 'V', the right eigenvectors v(j) are stored one
- * after another in the columns of VR, in the same order as
- * their eigenvalues. If the j-th eigenvalue is real, then
- * v(j) = VR(:,j), the j-th column of VR. If the j-th and
- * (j+1)-th eigenvalues form a complex conjugate pair, then
- * v(j) = VR(:,j)+i*VR(:,j+1) and v(j+1) = VR(:,j)-i*VR(:,j+1).
- * Each eigenvector will be scaled so the largest component have
- * abs(real part) + abs(imag. part) = 1.
- * Not referenced if JOBVR = 'N'.
- *
- * LDVR (input) INTEGER
- * The leading dimension of the matrix VR. LDVR >= 1, and
- * if JOBVR = 'V', LDVR >= N.
- *
- * ILO (output) INTEGER
- * IHI (output) INTEGER
- * ILO and IHI are integer values such that on exit
- * A(i,j) = 0 and B(i,j) = 0 if i > j and
- * j = 1,...,ILO-1 or i = IHI+1,...,N.
- * If BALANC = 'N' or 'S', ILO = 1 and IHI = N.
- *
- * LSCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied
- * to the left side of A and B. If PL(j) is the index of the
- * row interchanged with row j, and DL(j) is the scaling
- * factor applied to row j, then
- * LSCALE(j) = PL(j) for j = 1,...,ILO-1
- * = DL(j) for j = ILO,...,IHI
- * = PL(j) for j = IHI+1,...,N.
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * RSCALE (output) DOUBLE PRECISION array, dimension (N)
- * Details of the permutations and scaling factors applied
- * to the right side of A and B. If PR(j) is the index of the
- * column interchanged with column j, and DR(j) is the scaling
- * factor applied to column j, then
- * RSCALE(j) = PR(j) for j = 1,...,ILO-1
- * = DR(j) for j = ILO,...,IHI
- * = PR(j) for j = IHI+1,...,N
- * The order in which the interchanges are made is N to IHI+1,
- * then 1 to ILO-1.
- *
- * ABNRM (output) DOUBLE PRECISION
- * The one-norm of the balanced matrix A.
- *
- * BBNRM (output) DOUBLE PRECISION
- * The one-norm of the balanced matrix B.
- *
- * RCONDE (output) DOUBLE PRECISION array, dimension (N)
- * If SENSE = 'E' or 'B', the reciprocal condition numbers of
- * the eigenvalues, stored in consecutive elements of the array.
- * For a complex conjugate pair of eigenvalues two consecutive
- * elements of RCONDE are set to the same value. Thus RCONDE(j),
- * RCONDV(j), and the j-th columns of VL and VR all correspond
- * to the j-th eigenpair.
- * If SENSE = 'N or 'V', RCONDE is not referenced.
- *
- * RCONDV (output) DOUBLE PRECISION array, dimension (N)
- * If SENSE = 'V' or 'B', the estimated reciprocal condition
- * numbers of the eigenvectors, stored in consecutive elements
- * of the array. For a complex eigenvector two consecutive
- * elements of RCONDV are set to the same value. If the
- * eigenvalues cannot be reordered to compute RCONDV(j),
- * RCONDV(j) is set to 0; this can only occur when the true
- * value would be very small anyway.
- * If SENSE = 'N' or 'E', RCONDV is not referenced.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,2*N).
- * If BALANC = 'S' or 'B', or JOBVL = 'V', or JOBVR = 'V',
- * LWORK >= max(1,6*N).
- * If SENSE = 'E' or 'B', LWORK >= max(1,10*N).
- * If SENSE = 'V' or 'B', LWORK >= 2*N*N+8*N+16.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * IWORK (workspace) INTEGER array, dimension (N+6)
- * If SENSE = 'E', IWORK is not referenced.
- *
- * BWORK (workspace) LOGICAL array, dimension (N)
- * If SENSE = 'N', BWORK is not referenced.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1,...,N:
- * The QZ iteration failed. No eigenvectors have been
- * calculated, but ALPHAR(j), ALPHAI(j), and BETA(j)
- * should be correct for j=INFO+1,...,N.
- * > N: =N+1: other than QZ iteration failed in DHGEQZ.
- * =N+2: error return from DTGEVC.
- *
- * Further Details
- * ===============
- *
- * Balancing a matrix pair (A,B) includes, first, permuting rows and
- * columns to isolate eigenvalues, second, applying diagonal similarity
- * transformation to the rows and columns to make the rows and columns
- * as close in norm as possible. The computed reciprocal condition
- * numbers correspond to the balanced matrix. Permuting rows and columns
- * will not change the condition numbers (in exact arithmetic) but
- * diagonal scaling will. For further explanation of balancing, see
- * section 4.11.1.2 of LAPACK Users' Guide.
- *
- * An approximate error bound on the chordal distance between the i-th
- * computed generalized eigenvalue w and the corresponding exact
- * eigenvalue lambda is
- *
- * chord(w, lambda) <= EPS * norm(ABNRM, BBNRM) / RCONDE(I)
- *
- * An approximate error bound for the angle between the i-th computed
- * eigenvector VL(i) or VR(i) is given by
- *
- * EPS * norm(ABNRM, BBNRM) / DIF(i).
- *
- * For further explanation of the reciprocal condition numbers RCONDE
- * and RCONDV, see section 4.11 of LAPACK User's Guide.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGEVX(char balanc, char jobvl, char jobvr, char sense, int n, double* a, int lda, double* b, int ldb, double* alphar, double* alphai, double* beta, double* vl, int ldvl, double* vr, int ldvr, int* ilo, int* ihi, double* lscale, double* rscale, double* abnrm, double* bbnrm, double* rconde, double* rcondv, double* work, int lwork, int* iwork)
- {
- int info;
- ::F_DGGEVX(&balanc, &jobvl, &jobvr, &sense, &n, a, &lda, b, &ldb, alphar, alphai, beta, vl, &ldvl, vr, &ldvr, ilo, ihi, lscale, rscale, abnrm, bbnrm, rconde, rcondv, work, &lwork, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGGLM solves a general Gauss-Markov linear model (GLM) problem:
- *
- * minimize || y ||_2 subject to d = A*x + B*y
- * x
- *
- * where A is an N-by-M matrix, B is an N-by-P matrix, and d is a
- * given N-vector. It is assumed that M <= N <= M+P, and
- *
- * rank(A) = M and rank( A B ) = N.
- *
- * Under these assumptions, the constrained equation is always
- * consistent, and there is a unique solution x and a minimal 2-norm
- * solution y, which is obtained using a generalized QR factorization
- * of the matrices (A, B) given by
- *
- * A = Q*(R), B = Q*T*Z.
- * (0)
- *
- * In particular, if matrix B is square nonsingular, then the problem
- * GLM is equivalent to the following weighted linear least squares
- * problem
- *
- * minimize || inv(B)*(d-A*x) ||_2
- * x
- *
- * where inv(B) denotes the inverse of B.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The number of rows of the matrices A and B. N >= 0.
- *
- * M (input) INTEGER
- * The number of columns of the matrix A. 0 <= M <= N.
- *
- * P (input) INTEGER
- * The number of columns of the matrix B. P >= N-M.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,M)
- * On entry, the N-by-M matrix A.
- * On exit, the upper triangular part of the array A contains
- * the M-by-M upper triangular matrix R.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,P)
- * On entry, the N-by-P matrix B.
- * On exit, if N <= P, the upper triangle of the subarray
- * B(1:N,P-N+1:P) contains the N-by-N upper triangular matrix T;
- * if N > P, the elements on and above the (N-P)th subdiagonal
- * contain the N-by-P upper trapezoidal matrix T.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, D is the left hand side of the GLM equation.
- * On exit, D is destroyed.
- *
- * X (output) DOUBLE PRECISION array, dimension (M)
- * Y (output) DOUBLE PRECISION array, dimension (P)
- * On exit, X and Y are the solutions of the GLM problem.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N+M+P).
- * For optimum performance, LWORK >= M+min(N,P)+max(N,P)*NB,
- * where NB is an upper bound for the optimal blocksizes for
- * DGEQRF, SGERQF, DORMQR and SORMRQ.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1: the upper triangular factor R associated with A in the
- * generalized QR factorization of the pair (A, B) is
- * singular, so that rank(A) < M; the least squares
- * solution could not be computed.
- * = 2: the bottom (N-M) by (N-M) part of the upper trapezoidal
- * factor T associated with B in the generalized QR
- * factorization of the pair (A, B) is singular, so that
- * rank( A B ) < N; the least squares solution could not
- * be computed.
- *
- * ===================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGGLM(int n, int m, int p, double* a, int lda, double* b, int ldb, double* d, double* x, double* y, double* work, int lwork)
- {
- int info;
- ::F_DGGGLM(&n, &m, &p, a, &lda, b, &ldb, d, x, y, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGHRD reduces a pair of real matrices (A,B) to generalized upper
- * Hessenberg form using orthogonal transformations, where A is a
- * general matrix and B is upper triangular. The form of the
- * generalized eigenvalue problem is
- * A*x = lambda*B*x,
- * and B is typically made upper triangular by computing its QR
- * factorization and moving the orthogonal matrix Q to the left side
- * of the equation.
- *
- * This subroutine simultaneously reduces A to a Hessenberg matrix H:
- * Q**T*A*Z = H
- * and transforms B to another upper triangular matrix T:
- * Q**T*B*Z = T
- * in order to reduce the problem to its standard form
- * H*y = lambda*T*y
- * where y = Z**T*x.
- *
- * The orthogonal matrices Q and Z are determined as products of Givens
- * rotations. They may either be formed explicitly, or they may be
- * postmultiplied into input matrices Q1 and Z1, so that
- *
- * Q1 * A * Z1**T = (Q1*Q) * H * (Z1*Z)**T
- *
- * Q1 * B * Z1**T = (Q1*Q) * T * (Z1*Z)**T
- *
- * If Q1 is the orthogonal matrix from the QR factorization of B in the
- * original equation A*x = lambda*B*x, then DGGHRD reduces the original
- * problem to generalized Hessenberg form.
- *
- * Arguments
- * =========
- *
- * COMPQ (input) CHARACTER*1
- * = 'N': do not compute Q;
- * = 'I': Q is initialized to the unit matrix, and the
- * orthogonal matrix Q is returned;
- * = 'V': Q must contain an orthogonal matrix Q1 on entry,
- * and the product Q1*Q is returned.
- *
- * COMPZ (input) CHARACTER*1
- * = 'N': do not compute Z;
- * = 'I': Z is initialized to the unit matrix, and the
- * orthogonal matrix Z is returned;
- * = 'V': Z must contain an orthogonal matrix Z1 on entry,
- * and the product Z1*Z is returned.
- *
- * N (input) INTEGER
- * The order of the matrices A and B. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * ILO and IHI mark the rows and columns of A which are to be
- * reduced. It is assumed that A is already upper triangular
- * in rows and columns 1:ILO-1 and IHI+1:N. ILO and IHI are
- * normally set by a previous call to SGGBAL; otherwise they
- * should be set to 1 and N respectively.
- * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA, N)
- * On entry, the N-by-N general matrix to be reduced.
- * On exit, the upper triangle and the first subdiagonal of A
- * are overwritten with the upper Hessenberg matrix H, and the
- * rest is set to zero.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB, N)
- * On entry, the N-by-N upper triangular matrix B.
- * On exit, the upper triangular matrix T = Q**T B Z. The
- * elements below the diagonal are set to zero.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
- * On entry, if COMPQ = 'V', the orthogonal matrix Q1,
- * typically from the QR factorization of B.
- * On exit, if COMPQ='I', the orthogonal matrix Q, and if
- * COMPQ = 'V', the product Q1*Q.
- * Not referenced if COMPQ='N'.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q.
- * LDQ >= N if COMPQ='V' or 'I'; LDQ >= 1 otherwise.
- *
- * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
- * On entry, if COMPZ = 'V', the orthogonal matrix Z1.
- * On exit, if COMPZ='I', the orthogonal matrix Z, and if
- * COMPZ = 'V', the product Z1*Z.
- * Not referenced if COMPZ='N'.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z.
- * LDZ >= N if COMPZ='V' or 'I'; LDZ >= 1 otherwise.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * This routine reduces A to Hessenberg and B to triangular form by
- * an unblocked reduction, as described in _Matrix_Computations_,
- * by Golub and Van Loan (Johns Hopkins Press.)
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGHRD(char compq, char compz, int n, int ilo, int ihi, double* a, int lda, double* b, int ldb, double* q, int ldq, double* z, int ldz)
- {
- int info;
- ::F_DGGHRD(&compq, &compz, &n, &ilo, &ihi, a, &lda, b, &ldb, q, &ldq, z, &ldz, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGLSE solves the linear equality-constrained least squares (LSE)
- * problem:
- *
- * minimize || c - A*x ||_2 subject to B*x = d
- *
- * where A is an M-by-N matrix, B is a P-by-N matrix, c is a given
- * M-vector, and d is a given P-vector. It is assumed that
- * P <= N <= M+P, and
- *
- * rank(B) = P and rank( (A) ) = N.
- * ( (B) )
- *
- * These conditions ensure that the LSE problem has a unique solution,
- * which is obtained using a generalized RQ factorization of the
- * matrices (B, A) given by
- *
- * B = (0 R)*Q, A = Z*T*Q.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrices A and B. N >= 0.
- *
- * P (input) INTEGER
- * The number of rows of the matrix B. 0 <= P <= N <= M+P.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, the elements on and above the diagonal of the array
- * contain the min(M,N)-by-N upper trapezoidal matrix T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,N)
- * On entry, the P-by-N matrix B.
- * On exit, the upper triangle of the subarray B(1:P,N-P+1:N)
- * contains the P-by-P upper triangular matrix R.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,P).
- *
- * C (input/output) DOUBLE PRECISION array, dimension (M)
- * On entry, C contains the right hand side vector for the
- * least squares part of the LSE problem.
- * On exit, the residual sum of squares for the solution
- * is given by the sum of squares of elements N-P+1 to M of
- * vector C.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (P)
- * On entry, D contains the right hand side vector for the
- * constrained equation.
- * On exit, D is destroyed.
- *
- * X (output) DOUBLE PRECISION array, dimension (N)
- * On exit, X is the solution of the LSE problem.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,M+N+P).
- * For optimum performance LWORK >= P+min(M,N)+max(M,N)*NB,
- * where NB is an upper bound for the optimal blocksizes for
- * DGEQRF, SGERQF, DORMQR and SORMRQ.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * = 1: the upper triangular factor R associated with B in the
- * generalized RQ factorization of the pair (B, A) is
- * singular, so that rank(B) < P; the least squares
- * solution could not be computed.
- * = 2: the (N-P) by (N-P) part of the upper trapezoidal factor
- * T associated with A in the generalized RQ factorization
- * of the pair (B, A) is singular, so that
- * rank( (A) ) < N; the least squares solution could not
- * ( (B) )
- * be computed.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGLSE(int m, int n, int p, double* a, int lda, double* b, int ldb, double* c, double* d, double* x, double* work, int lwork)
- {
- int info;
- ::F_DGGLSE(&m, &n, &p, a, &lda, b, &ldb, c, d, x, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGQRF computes a generalized QR factorization of an N-by-M matrix A
- * and an N-by-P matrix B:
- *
- * A = Q*R, B = Q*T*Z,
- *
- * where Q is an N-by-N orthogonal matrix, Z is a P-by-P orthogonal
- * matrix, and R and T assume one of the forms:
- *
- * if N >= M, R = ( R11 ) M , or if N < M, R = ( R11 R12 ) N,
- * ( 0 ) N-M N M-N
- * M
- *
- * where R11 is upper triangular, and
- *
- * if N <= P, T = ( 0 T12 ) N, or if N > P, T = ( T11 ) N-P,
- * P-N N ( T21 ) P
- * P
- *
- * where T12 or T21 is upper triangular.
- *
- * In particular, if B is square and nonsingular, the GQR factorization
- * of A and B implicitly gives the QR factorization of inv(B)*A:
- *
- * inv(B)*A = Z'*(inv(T)*R)
- *
- * where inv(B) denotes the inverse of the matrix B, and Z' denotes the
- * transpose of the matrix Z.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The number of rows of the matrices A and B. N >= 0.
- *
- * M (input) INTEGER
- * The number of columns of the matrix A. M >= 0.
- *
- * P (input) INTEGER
- * The number of columns of the matrix B. P >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,M)
- * On entry, the N-by-M matrix A.
- * On exit, the elements on and above the diagonal of the array
- * contain the min(N,M)-by-M upper trapezoidal matrix R (R is
- * upper triangular if N >= M); the elements below the diagonal,
- * with the array TAUA, represent the orthogonal matrix Q as a
- * product of min(N,M) elementary reflectors (see Further
- * Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * TAUA (output) DOUBLE PRECISION array, dimension (min(N,M))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix Q (see Further Details).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,P)
- * On entry, the N-by-P matrix B.
- * On exit, if N <= P, the upper triangle of the subarray
- * B(1:N,P-N+1:P) contains the N-by-N upper triangular matrix T;
- * if N > P, the elements on and above the (N-P)-th subdiagonal
- * contain the N-by-P upper trapezoidal matrix T; the remaining
- * elements, with the array TAUB, represent the orthogonal
- * matrix Z as a product of elementary reflectors (see Further
- * Details).
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * TAUB (output) DOUBLE PRECISION array, dimension (min(N,P))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix Z (see Further Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N,M,P).
- * For optimum performance LWORK >= max(N,M,P)*max(NB1,NB2,NB3),
- * where NB1 is the optimal blocksize for the QR factorization
- * of an N-by-M matrix, NB2 is the optimal blocksize for the
- * RQ factorization of an N-by-P matrix, and NB3 is the optimal
- * blocksize for a call of DORMQR.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k), where k = min(n,m).
- *
- * Each H(i) has the form
- *
- * H(i) = I - taua * v * v'
- *
- * where taua is a real scalar, and v is a real vector with
- * v(1:i-1) = 0 and v(i) = 1; v(i+1:n) is stored on exit in A(i+1:n,i),
- * and taua in TAUA(i).
- * To form Q explicitly, use LAPACK subroutine DORGQR.
- * To use Q to update another matrix, use LAPACK subroutine DORMQR.
- *
- * The matrix Z is represented as a product of elementary reflectors
- *
- * Z = H(1) H(2) . . . H(k), where k = min(n,p).
- *
- * Each H(i) has the form
- *
- * H(i) = I - taub * v * v'
- *
- * where taub is a real scalar, and v is a real vector with
- * v(p-k+i+1:p) = 0 and v(p-k+i) = 1; v(1:p-k+i-1) is stored on exit in
- * B(n-k+i,1:p-k+i-1), and taub in TAUB(i).
- * To form Z explicitly, use LAPACK subroutine DORGRQ.
- * To use Z to update another matrix, use LAPACK subroutine DORMRQ.
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGGQRF(int n, int m, int p, double* a, int lda, double* taua, double* b, int ldb, double* taub, double* work, int lwork)
- {
- int info;
- ::F_DGGQRF(&n, &m, &p, a, &lda, taua, b, &ldb, taub, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGRQF computes a generalized RQ factorization of an M-by-N matrix A
- * and a P-by-N matrix B:
- *
- * A = R*Q, B = Z*T*Q,
- *
- * where Q is an N-by-N orthogonal matrix, Z is a P-by-P orthogonal
- * matrix, and R and T assume one of the forms:
- *
- * if M <= N, R = ( 0 R12 ) M, or if M > N, R = ( R11 ) M-N,
- * N-M M ( R21 ) N
- * N
- *
- * where R12 or R21 is upper triangular, and
- *
- * if P >= N, T = ( T11 ) N , or if P < N, T = ( T11 T12 ) P,
- * ( 0 ) P-N P N-P
- * N
- *
- * where T11 is upper triangular.
- *
- * In particular, if B is square and nonsingular, the GRQ factorization
- * of A and B implicitly gives the RQ factorization of A*inv(B):
- *
- * A*inv(B) = (R*inv(T))*Z'
- *
- * where inv(B) denotes the inverse of the matrix B, and Z' denotes the
- * transpose of the matrix Z.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * P (input) INTEGER
- * The number of rows of the matrix B. P >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrices A and B. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, if M <= N, the upper triangle of the subarray
- * A(1:M,N-M+1:N) contains the M-by-M upper triangular matrix R;
- * if M > N, the elements on and above the (M-N)-th subdiagonal
- * contain the M-by-N upper trapezoidal matrix R; the remaining
- * elements, with the array TAUA, represent the orthogonal
- * matrix Q as a product of elementary reflectors (see Further
- * Details).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAUA (output) DOUBLE PRECISION array, dimension (min(M,N))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix Q (see Further Details).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,N)
- * On entry, the P-by-N matrix B.
- * On exit, the elements on and above the diagonal of the array
- * contain the min(P,N)-by-N upper trapezoidal matrix T (T is
- * upper triangular if P >= N); the elements below the diagonal,
- * with the array TAUB, represent the orthogonal matrix Z as a
- * product of elementary reflectors (see Further Details).
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,P).
- *
- * TAUB (output) DOUBLE PRECISION array, dimension (min(P,N))
- * The scalar factors of the elementary reflectors which
- * represent the orthogonal matrix Z (see Further Details).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N,M,P).
- * For optimum performance LWORK >= max(N,M,P)*max(NB1,NB2,NB3),
- * where NB1 is the optimal blocksize for the RQ factorization
- * of an M-by-N matrix, NB2 is the optimal blocksize for the
- * QR factorization of a P-by-N matrix, and NB3 is the optimal
- * blocksize for a call of DORMRQ.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INF0= -i, the i-th argument had an illegal value.
- *
- * Further Details
- * ===============
- *
- * The matrix Q is represented as a product of elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k), where k = min(m,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - taua * v * v'
- *
- * where taua is a real scalar, and v is a real vector with
- * v(n-k+i+1:n) = 0 and v(n-k+i) = 1; v(1:n-k+i-1) is stored on exit in
- * A(m-k+i,1:n-k+i-1), and taua in TAUA(i).
- * To form Q explicitly, use LAPACK subroutine DORGRQ.
- * To use Q to update another matrix, use LAPACK subroutine DORMRQ.
- *
- * The matrix Z is represented as a product of elementary reflectors
- *
- * Z = H(1) H(2) . . . H(k), where k = min(p,n).
- *
- * Each H(i) has the form
- *
- * H(i) = I - taub * v * v'
- *
- * where taub is a real scalar, and v is a real vector with
- * v(1:i-1) = 0 and v(i) = 1; v(i+1:p) is stored on exit in B(i+1:p,i),
- * and taub in TAUB(i).
- * To form Z explicitly, use LAPACK subroutine DORGQR.
- * To use Z to update another matrix, use LAPACK subroutine DORMQR.
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGGRQF(int m, int p, int n, double* a, int lda, double* taua, double* b, int ldb, double* taub, double* work, int lwork)
- {
- int info;
- ::F_DGGRQF(&m, &p, &n, a, &lda, taua, b, &ldb, taub, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGSVD computes the generalized singular value decomposition (GSVD)
- * of an M-by-N real matrix A and P-by-N real matrix B:
- *
- * U'*A*Q = D1*( 0 R ), V'*B*Q = D2*( 0 R )
- *
- * where U, V and Q are orthogonal matrices, and Z' is the transpose
- * of Z. Let K+L = the effective numerical rank of the matrix (A',B')',
- * then R is a K+L-by-K+L nonsingular upper triangular matrix, D1 and
- * D2 are M-by-(K+L) and P-by-(K+L) "diagonal" matrices and of the
- * following structures, respectively:
- *
- * If M-K-L >= 0,
- *
- * K L
- * D1 = K ( I 0 )
- * L ( 0 C )
- * M-K-L ( 0 0 )
- *
- * K L
- * D2 = L ( 0 S )
- * P-L ( 0 0 )
- *
- * N-K-L K L
- * ( 0 R ) = K ( 0 R11 R12 )
- * L ( 0 0 R22 )
- *
- * where
- *
- * C = diag( ALPHA(K+1), ... , ALPHA(K+L) ),
- * S = diag( BETA(K+1), ... , BETA(K+L) ),
- * C**2 + S**2 = I.
- *
- * R is stored in A(1:K+L,N-K-L+1:N) on exit.
- *
- * If M-K-L < 0,
- *
- * K M-K K+L-M
- * D1 = K ( I 0 0 )
- * M-K ( 0 C 0 )
- *
- * K M-K K+L-M
- * D2 = M-K ( 0 S 0 )
- * K+L-M ( 0 0 I )
- * P-L ( 0 0 0 )
- *
- * N-K-L K M-K K+L-M
- * ( 0 R ) = K ( 0 R11 R12 R13 )
- * M-K ( 0 0 R22 R23 )
- * K+L-M ( 0 0 0 R33 )
- *
- * where
- *
- * C = diag( ALPHA(K+1), ... , ALPHA(M) ),
- * S = diag( BETA(K+1), ... , BETA(M) ),
- * C**2 + S**2 = I.
- *
- * (R11 R12 R13 ) is stored in A(1:M, N-K-L+1:N), and R33 is stored
- * ( 0 R22 R23 )
- * in B(M-K+1:L,N+M-K-L+1:N) on exit.
- *
- * The routine computes C, S, R, and optionally the orthogonal
- * transformation matrices U, V and Q.
- *
- * In particular, if B is an N-by-N nonsingular matrix, then the GSVD of
- * A and B implicitly gives the SVD of A*inv(B):
- * A*inv(B) = U*(D1*inv(D2))*V'.
- * If ( A',B')' has orthonormal columns, then the GSVD of A and B is
- * also equal to the CS decomposition of A and B. Furthermore, the GSVD
- * can be used to derive the solution of the eigenvalue problem:
- * A'*A x = lambda* B'*B x.
- * In some literature, the GSVD of A and B is presented in the form
- * U'*A*X = ( 0 D1 ), V'*B*X = ( 0 D2 )
- * where U and V are orthogonal and X is nonsingular, D1 and D2 are
- * ``diagonal''. The former GSVD form can be converted to the latter
- * form by taking the nonsingular matrix X as
- *
- * X = Q*( I 0 )
- * ( 0 inv(R) ).
- *
- * Arguments
- * =========
- *
- * JOBU (input) CHARACTER*1
- * = 'U': Orthogonal matrix U is computed;
- * = 'N': U is not computed.
- *
- * JOBV (input) CHARACTER*1
- * = 'V': Orthogonal matrix V is computed;
- * = 'N': V is not computed.
- *
- * JOBQ (input) CHARACTER*1
- * = 'Q': Orthogonal matrix Q is computed;
- * = 'N': Q is not computed.
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrices A and B. N >= 0.
- *
- * P (input) INTEGER
- * The number of rows of the matrix B. P >= 0.
- *
- * K (output) INTEGER
- * L (output) INTEGER
- * On exit, K and L specify the dimension of the subblocks
- * described in the Purpose section.
- * K + L = effective numerical rank of (A',B')'.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, A contains the triangular matrix R, or part of R.
- * See Purpose for details.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,N)
- * On entry, the P-by-N matrix B.
- * On exit, B contains the triangular matrix R if M-K-L < 0.
- * See Purpose for details.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,P).
- *
- * ALPHA (output) DOUBLE PRECISION array, dimension (N)
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * On exit, ALPHA and BETA contain the generalized singular
- * value pairs of A and B;
- * ALPHA(1:K) = 1,
- * BETA(1:K) = 0,
- * and if M-K-L >= 0,
- * ALPHA(K+1:K+L) = C,
- * BETA(K+1:K+L) = S,
- * or if M-K-L < 0,
- * ALPHA(K+1:M)=C, ALPHA(M+1:K+L)=0
- * BETA(K+1:M) =S, BETA(M+1:K+L) =1
- * and
- * ALPHA(K+L+1:N) = 0
- * BETA(K+L+1:N) = 0
- *
- * U (output) DOUBLE PRECISION array, dimension (LDU,M)
- * If JOBU = 'U', U contains the M-by-M orthogonal matrix U.
- * If JOBU = 'N', U is not referenced.
- *
- * LDU (input) INTEGER
- * The leading dimension of the array U. LDU >= max(1,M) if
- * JOBU = 'U'; LDU >= 1 otherwise.
- *
- * V (output) DOUBLE PRECISION array, dimension (LDV,P)
- * If JOBV = 'V', V contains the P-by-P orthogonal matrix V.
- * If JOBV = 'N', V is not referenced.
- *
- * LDV (input) INTEGER
- * The leading dimension of the array V. LDV >= max(1,P) if
- * JOBV = 'V'; LDV >= 1 otherwise.
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ,N)
- * If JOBQ = 'Q', Q contains the N-by-N orthogonal matrix Q.
- * If JOBQ = 'N', Q is not referenced.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q. LDQ >= max(1,N) if
- * JOBQ = 'Q'; LDQ >= 1 otherwise.
- *
- * WORK (workspace) DOUBLE PRECISION array,
- * dimension (max(3*N,M,P)+N)
- *
- * IWORK (workspace/output) INTEGER array, dimension (N)
- * On exit, IWORK stores the sorting information. More
- * precisely, the following loop will sort ALPHA
- * for I = K+1, min(M,K+L)
- * swap ALPHA(I) and ALPHA(IWORK(I))
- * endfor
- * such that ALPHA(1) >= ALPHA(2) >= ... >= ALPHA(N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = 1, the Jacobi-type procedure failed to
- * converge. For further details, see subroutine DTGSJA.
- *
- * Internal Parameters
- * ===================
- *
- * TOLA DOUBLE PRECISION
- * TOLB DOUBLE PRECISION
- * TOLA and TOLB are the thresholds to determine the effective
- * rank of (A',B')'. Generally, they are set to
- * TOLA = MAX(M,N)*norm(A)*MAZHEPS,
- * TOLB = MAX(P,N)*norm(B)*MAZHEPS.
- * The size of TOLA and TOLB may affect the size of backward
- * errors of the decomposition.
- *
- * Further Details
- * ===============
- *
- * 2-96 Based on modifications by
- * Ming Gu and Huan Ren, Computer Science Division, University of
- * California at Berkeley, USA
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGGSVD(char jobu, char jobv, char jobq, int m, int n, int p, int* k, int* l, double* a, int lda, double* b, int ldb, double* alpha, double* beta, double* u, int ldu, double* v, int ldv, double* q, int ldq, double* work, int* iwork)
- {
- int info;
- ::F_DGGSVD(&jobu, &jobv, &jobq, &m, &n, &p, k, l, a, &lda, b, &ldb, alpha, beta, u, &ldu, v, &ldv, q, &ldq, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGGSVP computes orthogonal matrices U, V and Q such that
- *
- * N-K-L K L
- * U'*A*Q = K ( 0 A12 A13 ) if M-K-L >= 0;
- * L ( 0 0 A23 )
- * M-K-L ( 0 0 0 )
- *
- * N-K-L K L
- * = K ( 0 A12 A13 ) if M-K-L < 0;
- * M-K ( 0 0 A23 )
- *
- * N-K-L K L
- * V'*B*Q = L ( 0 0 B13 )
- * P-L ( 0 0 0 )
- *
- * where the K-by-K matrix A12 and L-by-L matrix B13 are nonsingular
- * upper triangular; A23 is L-by-L upper triangular if M-K-L >= 0,
- * otherwise A23 is (M-K)-by-L upper trapezoidal. K+L = the effective
- * numerical rank of the (M+P)-by-N matrix (A',B')'. Z' denotes the
- * transpose of Z.
- *
- * This decomposition is the preprocessing step for computing the
- * Generalized Singular Value Decomposition (GSVD), see subroutine
- * DGGSVD.
- *
- * Arguments
- * =========
- *
- * JOBU (input) CHARACTER*1
- * = 'U': Orthogonal matrix U is computed;
- * = 'N': U is not computed.
- *
- * JOBV (input) CHARACTER*1
- * = 'V': Orthogonal matrix V is computed;
- * = 'N': V is not computed.
- *
- * JOBQ (input) CHARACTER*1
- * = 'Q': Orthogonal matrix Q is computed;
- * = 'N': Q is not computed.
- *
- * M (input) INTEGER
- * The number of rows of the matrix A. M >= 0.
- *
- * P (input) INTEGER
- * The number of rows of the matrix B. P >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrices A and B. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the M-by-N matrix A.
- * On exit, A contains the triangular (or trapezoidal) matrix
- * described in the Purpose section.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,N)
- * On entry, the P-by-N matrix B.
- * On exit, B contains the triangular matrix described in
- * the Purpose section.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,P).
- *
- * TOLA (input) DOUBLE PRECISION
- * TOLB (input) DOUBLE PRECISION
- * TOLA and TOLB are the thresholds to determine the effective
- * numerical rank of matrix B and a subblock of A. Generally,
- * they are set to
- * TOLA = MAX(M,N)*norm(A)*MAZHEPS,
- * TOLB = MAX(P,N)*norm(B)*MAZHEPS.
- * The size of TOLA and TOLB may affect the size of backward
- * errors of the decomposition.
- *
- * K (output) INTEGER
- * L (output) INTEGER
- * On exit, K and L specify the dimension of the subblocks
- * described in Purpose.
- * K + L = effective numerical rank of (A',B')'.
- *
- * U (output) DOUBLE PRECISION array, dimension (LDU,M)
- * If JOBU = 'U', U contains the orthogonal matrix U.
- * If JOBU = 'N', U is not referenced.
- *
- * LDU (input) INTEGER
- * The leading dimension of the array U. LDU >= max(1,M) if
- * JOBU = 'U'; LDU >= 1 otherwise.
- *
- * V (output) DOUBLE PRECISION array, dimension (LDV,P)
- * If JOBV = 'V', V contains the orthogonal matrix V.
- * If JOBV = 'N', V is not referenced.
- *
- * LDV (input) INTEGER
- * The leading dimension of the array V. LDV >= max(1,P) if
- * JOBV = 'V'; LDV >= 1 otherwise.
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ,N)
- * If JOBQ = 'Q', Q contains the orthogonal matrix Q.
- * If JOBQ = 'N', Q is not referenced.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q. LDQ >= max(1,N) if
- * JOBQ = 'Q'; LDQ >= 1 otherwise.
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * TAU (workspace) DOUBLE PRECISION array, dimension (N)
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (max(3*N,M,P))
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- *
- * Further Details
- * ===============
- *
- * The subroutine uses LAPACK subroutine DGEQPF for the QR factorization
- * with column pivoting to detect the effective numerical rank of the
- * a matrix. It may be replaced by a better rank determination strategy.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGGSVP(char jobu, char jobv, char jobq, int m, int p, int n, double* a, int lda, double* b, int ldb, double tola, double tolb, int* k, int* l, double* u, int ldu, double* v, int ldv, double* q, int ldq, int* iwork, double* tau, double* work)
- {
- int info;
- ::F_DGGSVP(&jobu, &jobv, &jobq, &m, &p, &n, a, &lda, b, &ldb, &tola, &tolb, k, l, u, &ldu, v, &ldv, q, &ldq, iwork, tau, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTCON estimates the reciprocal of the condition number of a real
- * tridiagonal matrix A using the LU factorization as computed by
- * DGTTRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
- *
- * Arguments
- * =========
- *
- * NORM (input) CHARACTER*1
- * Specifies whether the 1-norm condition number or the
- * infinity-norm condition number is required:
- * = '1' or 'O': 1-norm;
- * = 'I': Infinity-norm.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * DL (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) multipliers that define the matrix L from the
- * LU factorization of A as computed by DGTTRF.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the upper triangular matrix U from
- * the LU factorization of A.
- *
- * DU (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) elements of the first superdiagonal of U.
- *
- * DU2 (input) DOUBLE PRECISION array, dimension (N-2)
- * The (n-2) elements of the second superdiagonal of U.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= n, row i of the matrix was
- * interchanged with row IPIV(i). IPIV(i) will always be either
- * i or i+1; IPIV(i) = i indicates a row interchange was not
- * required.
- *
- * ANORM (input) DOUBLE PRECISION
- * If NORM = '1' or 'O', the 1-norm of the original matrix A.
- * If NORM = 'I', the infinity-norm of the original matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
- * estimate of the 1-norm of inv(A) computed in this routine.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (2*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGTCON(char norm, int n, double* dl, double* d, double* du, double* du2, int* ipiv, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DGTCON(&norm, &n, dl, d, du, du2, ipiv, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTRFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is tridiagonal, and provides
- * error bounds and backward error estimates for the solution.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * DL (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of A.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The diagonal elements of A.
- *
- * DU (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) superdiagonal elements of A.
- *
- * DLF (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) multipliers that define the matrix L from the
- * LU factorization of A as computed by DGTTRF.
- *
- * DF (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the upper triangular matrix U from
- * the LU factorization of A.
- *
- * DUF (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) elements of the first superdiagonal of U.
- *
- * DU2 (input) DOUBLE PRECISION array, dimension (N-2)
- * The (n-2) elements of the second superdiagonal of U.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= n, row i of the matrix was
- * interchanged with row IPIV(i). IPIV(i) will always be either
- * i or i+1; IPIV(i) = i indicates a row interchange was not
- * required.
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DGTTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGTRFS(char trans, int n, int nrhs, double* dl, double* d, double* du, double* dlf, double* df, double* duf, double* du2, int* ipiv, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DGTRFS(&trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTSV solves the equation
- *
- * A*X = B,
- *
- * where A is an n by n tridiagonal matrix, by Gaussian elimination with
- * partial pivoting.
- *
- * Note that the equation A'*X = B may be solved by interchanging the
- * order of the arguments DU and DL.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * DL (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, DL must contain the (n-1) sub-diagonal elements of
- * A.
- *
- * On exit, DL is overwritten by the (n-2) elements of the
- * second super-diagonal of the upper triangular matrix U from
- * the LU factorization of A, in DL(1), ..., DL(n-2).
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, D must contain the diagonal elements of A.
- *
- * On exit, D is overwritten by the n diagonal elements of U.
- *
- * DU (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, DU must contain the (n-1) super-diagonal elements
- * of A.
- *
- * On exit, DU is overwritten by the (n-1) elements of the first
- * super-diagonal of U.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N by NRHS matrix of right hand side matrix B.
- * On exit, if INFO = 0, the N by NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, U(i,i) is exactly zero, and the solution
- * has not been computed. The factorization has not been
- * completed unless i = N.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGTSV(int n, int nrhs, double* dl, double* d, double* du, double* b, int ldb)
- {
- int info;
- ::F_DGTSV(&n, &nrhs, dl, d, du, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTSVX uses the LU factorization to compute the solution to a real
- * system of linear equations A * X = B or A**T * X = B,
- * where A is a tridiagonal matrix of order N and X and B are N-by-NRHS
- * matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'N', the LU decomposition is used to factor the matrix A
- * as A = L * U, where L is a product of permutation and unit lower
- * bidiagonal matrices and U is upper triangular with nonzeros in
- * only the main diagonal and first two superdiagonals.
- *
- * 2. If some U(i,i)=0, so that U is exactly singular, then the routine
- * returns with INFO = i. Otherwise, the factored form of A is used
- * to estimate the condition number of the matrix A. If the
- * reciprocal of the condition number is less than machine precision,
- * C++ Return value: INFO (output) INTEGER
- * to solve for X and compute error bounds as described below.
- *
- * 3. The system of equations is solved for X using the factored form
- * of A.
- *
- * 4. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of A has been
- * supplied on entry.
- * = 'F': DLF, DF, DUF, DU2, and IPIV contain the factored
- * form of A; DL, D, DU, DLF, DF, DUF, DU2 and IPIV
- * will not be modified.
- * = 'N': The matrix will be copied to DLF, DF, and DUF
- * and factored.
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations:
- * = 'N': A * X = B (No transpose)
- * = 'T': A**T * X = B (Transpose)
- * = 'C': A**H * X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * DL (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of A.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of A.
- *
- * DU (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) superdiagonal elements of A.
- *
- * DLF (input or output) DOUBLE PRECISION array, dimension (N-1)
- * If FACT = 'F', then DLF is an input argument and on entry
- * contains the (n-1) multipliers that define the matrix L from
- * the LU factorization of A as computed by DGTTRF.
- *
- * If FACT = 'N', then DLF is an output argument and on exit
- * contains the (n-1) multipliers that define the matrix L from
- * the LU factorization of A.
- *
- * DF (input or output) DOUBLE PRECISION array, dimension (N)
- * If FACT = 'F', then DF is an input argument and on entry
- * contains the n diagonal elements of the upper triangular
- * matrix U from the LU factorization of A.
- *
- * If FACT = 'N', then DF is an output argument and on exit
- * contains the n diagonal elements of the upper triangular
- * matrix U from the LU factorization of A.
- *
- * DUF (input or output) DOUBLE PRECISION array, dimension (N-1)
- * If FACT = 'F', then DUF is an input argument and on entry
- * contains the (n-1) elements of the first superdiagonal of U.
- *
- * If FACT = 'N', then DUF is an output argument and on exit
- * contains the (n-1) elements of the first superdiagonal of U.
- *
- * DU2 (input or output) DOUBLE PRECISION array, dimension (N-2)
- * If FACT = 'F', then DU2 is an input argument and on entry
- * contains the (n-2) elements of the second superdiagonal of
- * U.
- *
- * If FACT = 'N', then DU2 is an output argument and on exit
- * contains the (n-2) elements of the second superdiagonal of
- * U.
- *
- * IPIV (input or output) INTEGER array, dimension (N)
- * If FACT = 'F', then IPIV is an input argument and on entry
- * contains the pivot indices from the LU factorization of A as
- * computed by DGTTRF.
- *
- * If FACT = 'N', then IPIV is an output argument and on exit
- * contains the pivot indices from the LU factorization of A;
- * row i of the matrix was interchanged with row IPIV(i).
- * IPIV(i) will always be either i or i+1; IPIV(i) = i indicates
- * a row interchange was not required.
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The N-by-NRHS right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A. If RCOND is less than the machine precision (in
- * particular, if RCOND = 0), the matrix is singular to working
- * precision. This condition is indicated by a return code of
- * C++ Return value: INFO (output) INTEGER
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: U(i,i) is exactly zero. The factorization
- * has not been completed unless i = N, but the
- * factor U is exactly singular, so the solution
- * and error bounds could not be computed.
- * RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGTSVX(char fact, char trans, int n, int nrhs, double* dl, double* d, double* du, double* dlf, double* df, double* duf, double* du2, int* ipiv, double* b, int ldb, double* x, int ldx, double* rcond)
- {
- int info;
- ::F_DGTSVX(&fact, &trans, &n, &nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b, &ldb, x, &ldx, rcond, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTTRF computes an LU factorization of a real tridiagonal matrix A
- * using elimination with partial pivoting and row interchanges.
- *
- * The factorization has the form
- * A = L * U
- * where L is a product of permutation and unit lower bidiagonal
- * matrices and U is upper triangular with nonzeros in only the main
- * diagonal and first two superdiagonals.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A.
- *
- * DL (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, DL must contain the (n-1) sub-diagonal elements of
- * A.
- *
- * On exit, DL is overwritten by the (n-1) multipliers that
- * define the matrix L from the LU factorization of A.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, D must contain the diagonal elements of A.
- *
- * On exit, D is overwritten by the n diagonal elements of the
- * upper triangular matrix U from the LU factorization of A.
- *
- * DU (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, DU must contain the (n-1) super-diagonal elements
- * of A.
- *
- * On exit, DU is overwritten by the (n-1) elements of the first
- * super-diagonal of U.
- *
- * DU2 (output) DOUBLE PRECISION array, dimension (N-2)
- * On exit, DU2 is overwritten by the (n-2) elements of the
- * second super-diagonal of U.
- *
- * IPIV (output) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= n, row i of the matrix was
- * interchanged with row IPIV(i). IPIV(i) will always be either
- * i or i+1; IPIV(i) = i indicates a row interchange was not
- * required.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -k, the k-th argument had an illegal value
- * > 0: if INFO = k, U(k,k) is exactly zero. The factorization
- * has been completed, but the factor U is exactly
- * singular, and division by zero will occur if it is used
- * to solve a system of equations.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DGTTRF(int n, double* dl, double* d, double* du, double* du2, int* ipiv)
- {
- int info;
- ::F_DGTTRF(&n, dl, d, du, du2, ipiv, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DGTTRS solves one of the systems of equations
- * A*X = B or A'*X = B,
- * with a tridiagonal matrix A using the LU factorization computed
- * by DGTTRF.
- *
- * Arguments
- * =========
- *
- * TRANS (input) CHARACTER*1
- * Specifies the form of the system of equations.
- * = 'N': A * X = B (No transpose)
- * = 'T': A'* X = B (Transpose)
- * = 'C': A'* X = B (Conjugate transpose = Transpose)
- *
- * N (input) INTEGER
- * The order of the matrix A.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * DL (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) multipliers that define the matrix L from the
- * LU factorization of A.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the upper triangular matrix U from
- * the LU factorization of A.
- *
- * DU (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) elements of the first super-diagonal of U.
- *
- * DU2 (input) DOUBLE PRECISION array, dimension (N-2)
- * The (n-2) elements of the second super-diagonal of U.
- *
- * IPIV (input) INTEGER array, dimension (N)
- * The pivot indices; for 1 <= i <= n, row i of the matrix was
- * interchanged with row IPIV(i). IPIV(i) will always be either
- * i or i+1; IPIV(i) = i indicates a row interchange was not
- * required.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the matrix of right hand side vectors B.
- * On exit, B is overwritten by the solution vectors X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DGTTRS(char trans, int n, int nrhs, double* dl, double* d, double* du, double* du2, int* ipiv, double* b, int ldb)
- {
- int info;
- ::F_DGTTRS(&trans, &n, &nrhs, dl, d, du, du2, ipiv, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DHGEQZ computes the eigenvalues of a real matrix pair (H,T),
- * where H is an upper Hessenberg matrix and T is upper triangular,
- * using the double-shift QZ method.
- * Matrix pairs of this type are produced by the reduction to
- * generalized upper Hessenberg form of a real matrix pair (A,B):
- *
- * A = Q1*H*Z1**T, B = Q1*T*Z1**T,
- *
- * as computed by DGGHRD.
- *
- * If JOB='S', then the Hessenberg-triangular pair (H,T) is
- * also reduced to generalized Schur form,
- *
- * H = Q*S*Z**T, T = Q*P*Z**T,
- *
- * where Q and Z are orthogonal matrices, P is an upper triangular
- * matrix, and S is a quasi-triangular matrix with 1-by-1 and 2-by-2
- * diagonal blocks.
- *
- * The 1-by-1 blocks correspond to real eigenvalues of the matrix pair
- * (H,T) and the 2-by-2 blocks correspond to complex conjugate pairs of
- * eigenvalues.
- *
- * Additionally, the 2-by-2 upper triangular diagonal blocks of P
- * corresponding to 2-by-2 blocks of S are reduced to positive diagonal
- * form, i.e., if S(j+1,j) is non-zero, then P(j+1,j) = P(j,j+1) = 0,
- * P(j,j) > 0, and P(j+1,j+1) > 0.
- *
- * Optionally, the orthogonal matrix Q from the generalized Schur
- * factorization may be postmultiplied into an input matrix Q1, and the
- * orthogonal matrix Z may be postmultiplied into an input matrix Z1.
- * If Q1 and Z1 are the orthogonal matrices from DGGHRD that reduced
- * the matrix pair (A,B) to generalized upper Hessenberg form, then the
- * output matrices Q1*Q and Z1*Z are the orthogonal factors from the
- * generalized Schur factorization of (A,B):
- *
- * A = (Q1*Q)*S*(Z1*Z)**T, B = (Q1*Q)*P*(Z1*Z)**T.
- *
- * To avoid overflow, eigenvalues of the matrix pair (H,T) (equivalently,
- * of (A,B)) are computed as a pair of values (alpha,beta), where alpha is
- * complex and beta real.
- * If beta is nonzero, lambda = alpha / beta is an eigenvalue of the
- * generalized nonsymmetric eigenvalue problem (GNEP)
- * A*x = lambda*B*x
- * and if alpha is nonzero, mu = beta / alpha is an eigenvalue of the
- * alternate form of the GNEP
- * mu*A*y = B*y.
- * Real eigenvalues can be read directly from the generalized Schur
- * form:
- * alpha = S(i,i), beta = P(i,i).
- *
- * Ref: C.B. Moler & G.W. Stewart, "An Algorithm for Generalized Matrix
- * Eigenvalue Problems", SIAM J. Numer. Anal., 10(1973),
- * pp. 241--256.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * = 'E': Compute eigenvalues only;
- * = 'S': Compute eigenvalues and the Schur form.
- *
- * COMPQ (input) CHARACTER*1
- * = 'N': Left Schur vectors (Q) are not computed;
- * = 'I': Q is initialized to the unit matrix and the matrix Q
- * of left Schur vectors of (H,T) is returned;
- * = 'V': Q must contain an orthogonal matrix Q1 on entry and
- * the product Q1*Q is returned.
- *
- * COMPZ (input) CHARACTER*1
- * = 'N': Right Schur vectors (Z) are not computed;
- * = 'I': Z is initialized to the unit matrix and the matrix Z
- * of right Schur vectors of (H,T) is returned;
- * = 'V': Z must contain an orthogonal matrix Z1 on entry and
- * the product Z1*Z is returned.
- *
- * N (input) INTEGER
- * The order of the matrices H, T, Q, and Z. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * ILO and IHI mark the rows and columns of H which are in
- * Hessenberg form. It is assumed that A is already upper
- * triangular in rows and columns 1:ILO-1 and IHI+1:N.
- * If N > 0, 1 <= ILO <= IHI <= N; if N = 0, ILO=1 and IHI=0.
- *
- * H (input/output) DOUBLE PRECISION array, dimension (LDH, N)
- * On entry, the N-by-N upper Hessenberg matrix H.
- * On exit, if JOB = 'S', H contains the upper quasi-triangular
- * matrix S from the generalized Schur factorization;
- * 2-by-2 diagonal blocks (corresponding to complex conjugate
- * pairs of eigenvalues) are returned in standard form, with
- * H(i,i) = H(i+1,i+1) and H(i+1,i)*H(i,i+1) < 0.
- * If JOB = 'E', the diagonal blocks of H match those of S, but
- * the rest of H is unspecified.
- *
- * LDH (input) INTEGER
- * The leading dimension of the array H. LDH >= max( 1, N ).
- *
- * T (input/output) DOUBLE PRECISION array, dimension (LDT, N)
- * On entry, the N-by-N upper triangular matrix T.
- * On exit, if JOB = 'S', T contains the upper triangular
- * matrix P from the generalized Schur factorization;
- * 2-by-2 diagonal blocks of P corresponding to 2-by-2 blocks of S
- * are reduced to positive diagonal form, i.e., if H(j+1,j) is
- * non-zero, then T(j+1,j) = T(j,j+1) = 0, T(j,j) > 0, and
- * T(j+1,j+1) > 0.
- * If JOB = 'E', the diagonal blocks of T match those of P, but
- * the rest of T is unspecified.
- *
- * LDT (input) INTEGER
- * The leading dimension of the array T. LDT >= max( 1, N ).
- *
- * ALPHAR (output) DOUBLE PRECISION array, dimension (N)
- * The real parts of each scalar alpha defining an eigenvalue
- * of GNEP.
- *
- * ALPHAI (output) DOUBLE PRECISION array, dimension (N)
- * The imaginary parts of each scalar alpha defining an
- * eigenvalue of GNEP.
- * If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
- * positive, then the j-th and (j+1)-st eigenvalues are a
- * complex conjugate pair, with ALPHAI(j+1) = -ALPHAI(j).
- *
- * BETA (output) DOUBLE PRECISION array, dimension (N)
- * The scalars beta that define the eigenvalues of GNEP.
- * Together, the quantities alpha = (ALPHAR(j),ALPHAI(j)) and
- * beta = BETA(j) represent the j-th eigenvalue of the matrix
- * pair (A,B), in one of the forms lambda = alpha/beta or
- * mu = beta/alpha. Since either lambda or mu may overflow,
- * they should not, in general, be computed.
- *
- * Q (input/output) DOUBLE PRECISION array, dimension (LDQ, N)
- * On entry, if COMPZ = 'V', the orthogonal matrix Q1 used in
- * the reduction of (A,B) to generalized Hessenberg form.
- * On exit, if COMPZ = 'I', the orthogonal matrix of left Schur
- * vectors of (H,T), and if COMPZ = 'V', the orthogonal matrix
- * of left Schur vectors of (A,B).
- * Not referenced if COMPZ = 'N'.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q. LDQ >= 1.
- * If COMPQ='V' or 'I', then LDQ >= N.
- *
- * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
- * On entry, if COMPZ = 'V', the orthogonal matrix Z1 used in
- * the reduction of (A,B) to generalized Hessenberg form.
- * On exit, if COMPZ = 'I', the orthogonal matrix of
- * right Schur vectors of (H,T), and if COMPZ = 'V', the
- * orthogonal matrix of right Schur vectors of (A,B).
- * Not referenced if COMPZ = 'N'.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1.
- * If COMPZ='V' or 'I', then LDZ >= N.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO >= 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * = 1,...,N: the QZ iteration did not converge. (H,T) is not
- * in Schur form, but ALPHAR(i), ALPHAI(i), and
- * BETA(i), i=INFO+1,...,N should be correct.
- * = N+1,...,2*N: the shift calculation failed. (H,T) is not
- * in Schur form, but ALPHAR(i), ALPHAI(i), and
- * BETA(i), i=INFO-N+1,...,N should be correct.
- *
- * Further Details
- * ===============
- *
- * Iteration counters:
- *
- * JITER -- counts iterations.
- * IITER -- counts iterations run since ILAST was last
- * changed. This is therefore reset only when a 1-by-1 or
- * 2-by-2 block deflates off the bottom.
- *
- * =====================================================================
- *
- * .. Parameters ..
- * $ SAFETY = 1.0E+0 )
- **/
- int C_DHGEQZ(char job, char compq, char compz, int n, int ilo, int ihi, double* h, int ldh, double* t, int ldt, double* alphar, double* alphai, double* beta, double* q, int ldq, double* z, int ldz, double* work, int lwork)
- {
- int info;
- ::F_DHGEQZ(&job, &compq, &compz, &n, &ilo, &ihi, h, &ldh, t, &ldt, alphar, alphai, beta, q, &ldq, z, &ldz, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DHSEIN uses inverse iteration to find specified right and/or left
- * eigenvectors of a real upper Hessenberg matrix H.
- *
- * The right eigenvector x and the left eigenvector y of the matrix H
- * corresponding to an eigenvalue w are defined by:
- *
- * H * x = w * x, y**h * H = w * y**h
- *
- * where y**h denotes the conjugate transpose of the vector y.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'R': compute right eigenvectors only;
- * = 'L': compute left eigenvectors only;
- * = 'B': compute both right and left eigenvectors.
- *
- * EIGSRC (input) CHARACTER*1
- * Specifies the source of eigenvalues supplied in (WR,WI):
- * = 'Q': the eigenvalues were found using DHSEQR; thus, if
- * H has zero subdiagonal elements, and so is
- * block-triangular, then the j-th eigenvalue can be
- * assumed to be an eigenvalue of the block containing
- * the j-th row/column. This property allows DHSEIN to
- * perform inverse iteration on just one diagonal block.
- * = 'N': no assumptions are made on the correspondence
- * between eigenvalues and diagonal blocks. In this
- * case, DHSEIN must always perform inverse iteration
- * using the whole matrix H.
- *
- * INITV (input) CHARACTER*1
- * = 'N': no initial vectors are supplied;
- * = 'U': user-supplied initial vectors are stored in the arrays
- * VL and/or VR.
- *
- * SELECT (input/output) LOGICAL array, dimension (N)
- * Specifies the eigenvectors to be computed. To select the
- * real eigenvector corresponding to a real eigenvalue WR(j),
- * SELECT(j) must be set to .TRUE.. To select the complex
- * eigenvector corresponding to a complex eigenvalue
- * (WR(j),WI(j)), with complex conjugate (WR(j+1),WI(j+1)),
- * either SELECT(j) or SELECT(j+1) or both must be set to
- * .TRUE.; then on exit SELECT(j) is .TRUE. and SELECT(j+1) is
- * .FALSE..
- *
- * N (input) INTEGER
- * The order of the matrix H. N >= 0.
- *
- * H (input) DOUBLE PRECISION array, dimension (LDH,N)
- * The upper Hessenberg matrix H.
- *
- * LDH (input) INTEGER
- * The leading dimension of the array H. LDH >= max(1,N).
- *
- * WR (input/output) DOUBLE PRECISION array, dimension (N)
- * WI (input) DOUBLE PRECISION array, dimension (N)
- * On entry, the real and imaginary parts of the eigenvalues of
- * H; a complex conjugate pair of eigenvalues must be stored in
- * consecutive elements of WR and WI.
- * On exit, WR may have been altered since close eigenvalues
- * are perturbed slightly in searching for independent
- * eigenvectors.
- *
- * VL (input/output) DOUBLE PRECISION array, dimension (LDVL,MM)
- * On entry, if INITV = 'U' and SIDE = 'L' or 'B', VL must
- * contain starting vectors for the inverse iteration for the
- * left eigenvectors; the starting vector for each eigenvector
- * must be in the same column(s) in which the eigenvector will
- * be stored.
- * On exit, if SIDE = 'L' or 'B', the left eigenvectors
- * specified by SELECT will be stored consecutively in the
- * columns of VL, in the same order as their eigenvalues. A
- * complex eigenvector corresponding to a complex eigenvalue is
- * stored in two consecutive columns, the first holding the real
- * part and the second the imaginary part.
- * If SIDE = 'R', VL is not referenced.
- *
- * LDVL (input) INTEGER
- * The leading dimension of the array VL.
- * LDVL >= max(1,N) if SIDE = 'L' or 'B'; LDVL >= 1 otherwise.
- *
- * VR (input/output) DOUBLE PRECISION array, dimension (LDVR,MM)
- * On entry, if INITV = 'U' and SIDE = 'R' or 'B', VR must
- * contain starting vectors for the inverse iteration for the
- * right eigenvectors; the starting vector for each eigenvector
- * must be in the same column(s) in which the eigenvector will
- * be stored.
- * On exit, if SIDE = 'R' or 'B', the right eigenvectors
- * specified by SELECT will be stored consecutively in the
- * columns of VR, in the same order as their eigenvalues. A
- * complex eigenvector corresponding to a complex eigenvalue is
- * stored in two consecutive columns, the first holding the real
- * part and the second the imaginary part.
- * If SIDE = 'L', VR is not referenced.
- *
- * LDVR (input) INTEGER
- * The leading dimension of the array VR.
- * LDVR >= max(1,N) if SIDE = 'R' or 'B'; LDVR >= 1 otherwise.
- *
- * MM (input) INTEGER
- * The number of columns in the arrays VL and/or VR. MM >= M.
- *
- * M (output) INTEGER
- * The number of columns in the arrays VL and/or VR required to
- * store the eigenvectors; each selected real eigenvector
- * occupies one column and each selected complex eigenvector
- * occupies two columns.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension ((N+2)*N)
- *
- * IFAILL (output) INTEGER array, dimension (MM)
- * If SIDE = 'L' or 'B', IFAILL(i) = j > 0 if the left
- * eigenvector in the i-th column of VL (corresponding to the
- * eigenvalue w(j)) failed to converge; IFAILL(i) = 0 if the
- * eigenvector converged satisfactorily. If the i-th and (i+1)th
- * columns of VL hold a complex eigenvector, then IFAILL(i) and
- * IFAILL(i+1) are set to the same value.
- * If SIDE = 'R', IFAILL is not referenced.
- *
- * IFAILR (output) INTEGER array, dimension (MM)
- * If SIDE = 'R' or 'B', IFAILR(i) = j > 0 if the right
- * eigenvector in the i-th column of VR (corresponding to the
- * eigenvalue w(j)) failed to converge; IFAILR(i) = 0 if the
- * eigenvector converged satisfactorily. If the i-th and (i+1)th
- * columns of VR hold a complex eigenvector, then IFAILR(i) and
- * IFAILR(i+1) are set to the same value.
- * If SIDE = 'L', IFAILR is not referenced.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, i is the number of eigenvectors which
- * failed to converge; see IFAILL and IFAILR for further
- * details.
- *
- * Further Details
- * ===============
- *
- * Each eigenvector is normalized so that the element of largest
- * magnitude has magnitude 1; here the magnitude of a complex number
- * (x,y) is taken to be |x|+|y|.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DHSEIN(char side, char eigsrc, char initv, int n, double* h, int ldh, double* wr, double* wi, double* vl, int ldvl, double* vr, int ldvr, int mm, int* m, double* work, int* ifaill, int* ifailr)
- {
- int info;
- ::F_DHSEIN(&side, &eigsrc, &initv, &n, h, &ldh, wr, wi, vl, &ldvl, vr, &ldvr, &mm, m, work, ifaill, ifailr, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DHSEQR computes the eigenvalues of a Hessenberg matrix H
- * and, optionally, the matrices T and Z from the Schur decomposition
- * H = Z T Z**T, where T is an upper quasi-triangular matrix (the
- * Schur form), and Z is the orthogonal matrix of Schur vectors.
- *
- * Optionally Z may be postmultiplied into an input orthogonal
- * matrix Q so that this routine can give the Schur factorization
- * of a matrix A which has been reduced to the Hessenberg form H
- * by the orthogonal matrix Q: A = Q*H*Q**T = (QZ)*T*(QZ)**T.
- *
- * Arguments
- * =========
- *
- * JOB (input) CHARACTER*1
- * = 'E': compute eigenvalues only;
- * = 'S': compute eigenvalues and the Schur form T.
- *
- * COMPZ (input) CHARACTER*1
- * = 'N': no Schur vectors are computed;
- * = 'I': Z is initialized to the unit matrix and the matrix Z
- * of Schur vectors of H is returned;
- * = 'V': Z must contain an orthogonal matrix Q on entry, and
- * the product Q*Z is returned.
- *
- * N (input) INTEGER
- * The order of the matrix H. N .GE. 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * It is assumed that H is already upper triangular in rows
- * and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally
- * set by a previous call to DGEBAL, and then passed to DGEHRD
- * when the matrix output by DGEBAL is reduced to Hessenberg
- * form. Otherwise ILO and IHI should be set to 1 and N
- * respectively. If N.GT.0, then 1.LE.ILO.LE.IHI.LE.N.
- * If N = 0, then ILO = 1 and IHI = 0.
- *
- * H (input/output) DOUBLE PRECISION array, dimension (LDH,N)
- * On entry, the upper Hessenberg matrix H.
- * On exit, if INFO = 0 and JOB = 'S', then H contains the
- * upper quasi-triangular matrix T from the Schur decomposition
- * (the Schur form); 2-by-2 diagonal blocks (corresponding to
- * complex conjugate pairs of eigenvalues) are returned in
- * standard form, with H(i,i) = H(i+1,i+1) and
- * H(i+1,i)*H(i,i+1).LT.0. If INFO = 0 and JOB = 'E', the
- * contents of H are unspecified on exit. (The output value of
- * H when INFO.GT.0 is given under the description of INFO
- * below.)
- *
- * Unlike earlier versions of DHSEQR, this subroutine may
- * explicitly H(i,j) = 0 for i.GT.j and j = 1, 2, ... ILO-1
- * or j = IHI+1, IHI+2, ... N.
- *
- * LDH (input) INTEGER
- * The leading dimension of the array H. LDH .GE. max(1,N).
- *
- * WR (output) DOUBLE PRECISION array, dimension (N)
- * WI (output) DOUBLE PRECISION array, dimension (N)
- * The real and imaginary parts, respectively, of the computed
- * eigenvalues. If two eigenvalues are computed as a complex
- * conjugate pair, they are stored in consecutive elements of
- * WR and WI, say the i-th and (i+1)th, with WI(i) .GT. 0 and
- * WI(i+1) .LT. 0. If JOB = 'S', the eigenvalues are stored in
- * the same order as on the diagonal of the Schur form returned
- * in H, with WR(i) = H(i,i) and, if H(i:i+1,i:i+1) is a 2-by-2
- * diagonal block, WI(i) = sqrt(-H(i+1,i)*H(i,i+1)) and
- * WI(i+1) = -WI(i).
- *
- * Z (input/output) DOUBLE PRECISION array, dimension (LDZ,N)
- * If COMPZ = 'N', Z is not referenced.
- * If COMPZ = 'I', on entry Z need not be set and on exit,
- * if INFO = 0, Z contains the orthogonal matrix Z of the Schur
- * vectors of H. If COMPZ = 'V', on entry Z must contain an
- * N-by-N matrix Q, which is assumed to be equal to the unit
- * matrix except for the submatrix Z(ILO:IHI,ILO:IHI). On exit,
- * if INFO = 0, Z contains Q*Z.
- * Normally Q is the orthogonal matrix generated by DORGHR
- * after the call to DGEHRD which formed the Hessenberg matrix
- * H. (The output value of Z when INFO.GT.0 is given under
- * the description of INFO below.)
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. if COMPZ = 'I' or
- * COMPZ = 'V', then LDZ.GE.MAX(1,N). Otherwize, LDZ.GE.1.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (LWORK)
- * On exit, if INFO = 0, WORK(1) returns an estimate of
- * the optimal value for LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK .GE. max(1,N)
- * is sufficient and delivers very good and sometimes
- * optimal performance. However, LWORK as large as 11*N
- * may be required for optimal performance. A workspace
- * query is recommended to determine the optimal workspace
- * size.
- *
- * If LWORK = -1, then DHSEQR does a workspace query.
- * In this case, DHSEQR checks the input parameters and
- * estimates the optimal workspace size for the given
- * values of N, ILO and IHI. The estimate is returned
- * in WORK(1). No error message related to LWORK is
- * issued by XERBLA. Neither H nor Z are accessed.
- *
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * .LT. 0: if INFO = -i, the i-th argument had an illegal
- * value
- * .GT. 0: if INFO = i, DHSEQR failed to compute all of
- * the eigenvalues. Elements 1:ilo-1 and i+1:n of WR
- * and WI contain those eigenvalues which have been
- * successfully computed. (Failures are rare.)
- *
- * If INFO .GT. 0 and JOB = 'E', then on exit, the
- * remaining unconverged eigenvalues are the eigen-
- * values of the upper Hessenberg matrix rows and
- * columns ILO through INFO of the final, output
- * value of H.
- *
- * If INFO .GT. 0 and JOB = 'S', then on exit
- *
- * (*) (initial value of H)*U = U*(final value of H)
- *
- * where U is an orthogonal matrix. The final
- * value of H is upper Hessenberg and quasi-triangular
- * in rows and columns INFO+1 through IHI.
- *
- * If INFO .GT. 0 and COMPZ = 'V', then on exit
- *
- * (final value of Z) = (initial value of Z)*U
- *
- * where U is the orthogonal matrix in (*) (regard-
- * less of the value of JOB.)
- *
- * If INFO .GT. 0 and COMPZ = 'I', then on exit
- * (final value of Z) = U
- * where U is the orthogonal matrix in (*) (regard-
- * less of the value of JOB.)
- *
- * If INFO .GT. 0 and COMPZ = 'N', then Z is not
- * accessed.
- *
- * ================================================================
- * Default values supplied by
- * ILAENV(ISPEC,'DHSEQR',JOB(:1)//COMPZ(:1),N,ILO,IHI,LWORK).
- * It is suggested that these defaults be adjusted in order
- * to attain best performance in each particular
- * computational environment.
- *
- * ISPEC=12: The DLAHQR vs DLAQR0 crossover point.
- * Default: 75. (Must be at least 11.)
- *
- * ISPEC=13: Recommended deflation window size.
- * This depends on ILO, IHI and NS. NS is the
- * number of simultaneous shifts returned
- * by ILAENV(ISPEC=15). (See ISPEC=15 below.)
- * The default for (IHI-ILO+1).LE.500 is NS.
- * The default for (IHI-ILO+1).GT.500 is 3*NS/2.
- *
- * ISPEC=14: Nibble crossover point. (See IPARMQ for
- * details.) Default: 14% of deflation window
- * size.
- *
- * ISPEC=15: Number of simultaneous shifts in a multishift
- * QR iteration.
- *
- * If IHI-ILO+1 is ...
- *
- * greater than ...but less ... the
- * or equal to ... than default is
- *
- * 1 30 NS = 2(+)
- * 30 60 NS = 4(+)
- * 60 150 NS = 10(+)
- * 150 590 NS = **
- * 590 3000 NS = 64
- * 3000 6000 NS = 128
- * 6000 infinity NS = 256
- *
- * (+) By default some or all matrices of this order
- * are passed to the implicit double shift routine
- * DLAHQR and this parameter is ignored. See
- * ISPEC=12 above and comments in IPARMQ for
- * details.
- *
- * (**) The asterisks (**) indicate an ad-hoc
- * function of N increasing from 10 to 64.
- *
- * ISPEC=16: Select structured matrix multiply.
- * If the number of simultaneous shifts (specified
- * by ISPEC=15) is less than 14, then the default
- * for ISPEC=16 is 0. Otherwise the default for
- * ISPEC=16 is 2.
- *
- * ================================================================
- * Based on contributions by
- * Karen Braman and Ralph Byers, Department of Mathematics,
- * University of Kansas, USA
- *
- * ================================================================
- * References:
- * K. Braman, R. Byers and R. Mathias, The Multi-Shift QR
- * Algorithm Part I: Maintaining Well Focused Shifts, and Level 3
- * Performance, SIAM Journal of Matrix Analysis, volume 23, pages
- * 929--947, 2002.
- *
- * K. Braman, R. Byers and R. Mathias, The Multi-Shift QR
- * Algorithm Part II: Aggressive Early Deflation, SIAM Journal
- * of Matrix Analysis, volume 23, pages 948--973, 2002.
- *
- * ================================================================
- * .. Parameters ..
- *
- * ==== Matrices of order NTINY or smaller must be processed by
- * . DLAHQR because of insufficient subdiagonal scratch space.
- * . (This is a hard limit.) ====
- **/
- int C_DHSEQR(char job, char compz, int n, int ilo, int ihi, double* h, int ldh, double* wr, double* wi, double* z, int ldz, double* work, int lwork)
- {
- int info;
- ::F_DHSEQR(&job, &compz, &n, &ilo, &ihi, h, &ldh, wr, wi, z, &ldz, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DOPGTR generates a real orthogonal matrix Q which is defined as the
- * product of n-1 elementary reflectors H(i) of order n, as returned by
- * DSPTRD using packed storage:
- *
- * if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
- *
- * if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular packed storage used in previous
- * call to DSPTRD;
- * = 'L': Lower triangular packed storage used in previous
- * call to DSPTRD.
- *
- * N (input) INTEGER
- * The order of the matrix Q. N >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The vectors which define the elementary reflectors, as
- * returned by DSPTRD.
- *
- * TAU (input) DOUBLE PRECISION array, dimension (N-1)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DSPTRD.
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ,N)
- * The N-by-N orthogonal matrix Q.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q. LDQ >= max(1,N).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (N-1)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DOPGTR(char uplo, int n, double* ap, double* tau, double* q, int ldq, double* work)
- {
- int info;
- ::F_DOPGTR(&uplo, &n, ap, tau, q, &ldq, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DOPMTR overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix of order nq, with nq = m if
- * SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
- * nq-1 elementary reflectors, as returned by DSPTRD using packed
- * storage:
- *
- * if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
- *
- * if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular packed storage used in previous
- * call to DSPTRD;
- * = 'L': Lower triangular packed storage used in previous
- * call to DSPTRD.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension
- * (M*(M+1)/2) if SIDE = 'L'
- * (N*(N+1)/2) if SIDE = 'R'
- * The vectors which define the elementary reflectors, as
- * returned by DSPTRD. AP is modified by the routine but
- * restored on exit.
- *
- * TAU (input) DOUBLE PRECISION array, dimension (M-1) if SIDE = 'L'
- * or (N-1) if SIDE = 'R'
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DSPTRD.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension
- * (N) if SIDE = 'L'
- * (M) if SIDE = 'R'
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DOPMTR(char side, char uplo, char trans, int m, int n, double* ap, double* tau, double* c, int ldc, double* work)
- {
- int info;
- ::F_DOPMTR(&side, &uplo, &trans, &m, &n, ap, tau, c, &ldc, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGBR generates one of the real orthogonal matrices Q or P**T
- * determined by DGEBRD when reducing a real matrix A to bidiagonal
- * form: A = Q * B * P**T. Q and P**T are defined as products of
- * elementary reflectors H(i) or G(i) respectively.
- *
- * If VECT = 'Q', A is assumed to have been an M-by-K matrix, and Q
- * is of order M:
- * if m >= k, Q = H(1) H(2) . . . H(k) and DORGBR returns the first n
- * columns of Q, where m >= n >= k;
- * if m < k, Q = H(1) H(2) . . . H(m-1) and DORGBR returns Q as an
- * M-by-M matrix.
- *
- * If VECT = 'P', A is assumed to have been a K-by-N matrix, and P**T
- * is of order N:
- * if k < n, P**T = G(k) . . . G(2) G(1) and DORGBR returns the first m
- * rows of P**T, where n >= m >= k;
- * if k >= n, P**T = G(n-1) . . . G(2) G(1) and DORGBR returns P**T as
- * an N-by-N matrix.
- *
- * Arguments
- * =========
- *
- * VECT (input) CHARACTER*1
- * Specifies whether the matrix Q or the matrix P**T is
- * required, as defined in the transformation applied by DGEBRD:
- * = 'Q': generate Q;
- * = 'P': generate P**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix Q or P**T to be returned.
- * M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix Q or P**T to be returned.
- * N >= 0.
- * If VECT = 'Q', M >= N >= min(M,K);
- * if VECT = 'P', N >= M >= min(N,K).
- *
- * K (input) INTEGER
- * If VECT = 'Q', the number of columns in the original M-by-K
- * matrix reduced by DGEBRD.
- * If VECT = 'P', the number of rows in the original K-by-N
- * matrix reduced by DGEBRD.
- * K >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the vectors which define the elementary reflectors,
- * as returned by DGEBRD.
- * On exit, the M-by-N matrix Q or P**T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,M).
- *
- * TAU (input) DOUBLE PRECISION array, dimension
- * (min(M,K)) if VECT = 'Q'
- * (min(N,K)) if VECT = 'P'
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i) or G(i), which determines Q or P**T, as
- * returned by DGEBRD in its array argument TAUQ or TAUP.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,min(M,N)).
- * For optimum performance LWORK >= min(M,N)*NB, where NB
- * is the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGBR(char vect, int m, int n, int k, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGBR(&vect, &m, &n, &k, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGHR generates a real orthogonal matrix Q which is defined as the
- * product of IHI-ILO elementary reflectors of order N, as returned by
- * DGEHRD:
- *
- * Q = H(ilo) H(ilo+1) . . . H(ihi-1).
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix Q. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * ILO and IHI must have the same values as in the previous call
- * of DGEHRD. Q is equal to the unit matrix except in the
- * submatrix Q(ilo+1:ihi,ilo+1:ihi).
- * 1 <= ILO <= IHI <= N, if N > 0; ILO=1 and IHI=0, if N=0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the vectors which define the elementary reflectors,
- * as returned by DGEHRD.
- * On exit, the N-by-N orthogonal matrix Q.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (N-1)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEHRD.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= IHI-ILO.
- * For optimum performance LWORK >= (IHI-ILO)*NB, where NB is
- * the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGHR(int n, int ilo, int ihi, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGHR(&n, &ilo, &ihi, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGLQ generates an M-by-N real matrix Q with orthonormal rows,
- * which is defined as the first M rows of a product of K elementary
- * reflectors of order N
- *
- * Q = H(k) . . . H(2) H(1)
- *
- * as returned by DGELQF.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix Q. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix Q. N >= M.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines the
- * matrix Q. M >= K >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the i-th row must contain the vector which defines
- * the elementary reflector H(i), for i = 1,2,...,k, as returned
- * by DGELQF in the first k rows of its array argument A.
- * On exit, the M-by-N matrix Q.
- *
- * LDA (input) INTEGER
- * The first dimension of the array A. LDA >= max(1,M).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGELQF.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,M).
- * For optimum performance LWORK >= M*NB, where NB is
- * the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument has an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGLQ(int m, int n, int k, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGLQ(&m, &n, &k, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGQL generates an M-by-N real matrix Q with orthonormal columns,
- * which is defined as the last N columns of a product of K elementary
- * reflectors of order M
- *
- * Q = H(k) . . . H(2) H(1)
- *
- * as returned by DGEQLF.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix Q. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix Q. M >= N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines the
- * matrix Q. N >= K >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the (n-k+i)-th column must contain the vector which
- * defines the elementary reflector H(i), for i = 1,2,...,k, as
- * returned by DGEQLF in the last k columns of its array
- * argument A.
- * On exit, the M-by-N matrix Q.
- *
- * LDA (input) INTEGER
- * The first dimension of the array A. LDA >= max(1,M).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEQLF.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- * For optimum performance LWORK >= N*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument has an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGQL(int m, int n, int k, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGQL(&m, &n, &k, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGQR generates an M-by-N real matrix Q with orthonormal columns,
- * which is defined as the first N columns of a product of K elementary
- * reflectors of order M
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DGEQRF.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix Q. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix Q. M >= N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines the
- * matrix Q. N >= K >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the i-th column must contain the vector which
- * defines the elementary reflector H(i), for i = 1,2,...,k, as
- * returned by DGEQRF in the first k columns of its array
- * argument A.
- * On exit, the M-by-N matrix Q.
- *
- * LDA (input) INTEGER
- * The first dimension of the array A. LDA >= max(1,M).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEQRF.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N).
- * For optimum performance LWORK >= N*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument has an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGQR(int m, int n, int k, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGQR(&m, &n, &k, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGRQ generates an M-by-N real matrix Q with orthonormal rows,
- * which is defined as the last M rows of a product of K elementary
- * reflectors of order N
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DGERQF.
- *
- * Arguments
- * =========
- *
- * M (input) INTEGER
- * The number of rows of the matrix Q. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix Q. N >= M.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines the
- * matrix Q. M >= K >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the (m-k+i)-th row must contain the vector which
- * defines the elementary reflector H(i), for i = 1,2,...,k, as
- * returned by DGERQF in the last k rows of its array argument
- * A.
- * On exit, the M-by-N matrix Q.
- *
- * LDA (input) INTEGER
- * The first dimension of the array A. LDA >= max(1,M).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGERQF.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,M).
- * For optimum performance LWORK >= M*NB, where NB is the
- * optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument has an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGRQ(int m, int n, int k, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGRQ(&m, &n, &k, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORGTR generates a real orthogonal matrix Q which is defined as the
- * product of n-1 elementary reflectors of order N, as returned by
- * DSYTRD:
- *
- * if UPLO = 'U', Q = H(n-1) . . . H(2) H(1),
- *
- * if UPLO = 'L', Q = H(1) H(2) . . . H(n-1).
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A contains elementary reflectors
- * from DSYTRD;
- * = 'L': Lower triangle of A contains elementary reflectors
- * from DSYTRD.
- *
- * N (input) INTEGER
- * The order of the matrix Q. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the vectors which define the elementary reflectors,
- * as returned by DSYTRD.
- * On exit, the N-by-N orthogonal matrix Q.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (N-1)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DSYTRD.
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK. LWORK >= max(1,N-1).
- * For optimum performance LWORK >= (N-1)*NB, where NB is
- * the optimal blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORGTR(char uplo, int n, double* a, int lda, double* tau, double* work, int lwork)
- {
- int info;
- ::F_DORGTR(&uplo, &n, a, &lda, tau, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * If VECT = 'Q', DORMBR overwrites the general real M-by-N matrix C
- * with
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * If VECT = 'P', DORMBR overwrites the general real M-by-N matrix C
- * with
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': P * C C * P
- * TRANS = 'T': P**T * C C * P**T
- *
- * Here Q and P**T are the orthogonal matrices determined by DGEBRD when
- * reducing a real matrix A to bidiagonal form: A = Q * B * P**T. Q and
- * P**T are defined as products of elementary reflectors H(i) and G(i)
- * respectively.
- *
- * Let nq = m if SIDE = 'L' and nq = n if SIDE = 'R'. Thus nq is the
- * order of the orthogonal matrix Q or P**T that is applied.
- *
- * If VECT = 'Q', A is assumed to have been an NQ-by-K matrix:
- * if nq >= k, Q = H(1) H(2) . . . H(k);
- * if nq < k, Q = H(1) H(2) . . . H(nq-1).
- *
- * If VECT = 'P', A is assumed to have been a K-by-NQ matrix:
- * if k < nq, P = G(1) G(2) . . . G(k);
- * if k >= nq, P = G(1) G(2) . . . G(nq-1).
- *
- * Arguments
- * =========
- *
- * VECT (input) CHARACTER*1
- * = 'Q': apply Q or Q**T;
- * = 'P': apply P or P**T.
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q, Q**T, P or P**T from the Left;
- * = 'R': apply Q, Q**T, P or P**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q or P;
- * = 'T': Transpose, apply Q**T or P**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * If VECT = 'Q', the number of columns in the original
- * matrix reduced by DGEBRD.
- * If VECT = 'P', the number of rows in the original
- * matrix reduced by DGEBRD.
- * K >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,min(nq,K)) if VECT = 'Q'
- * (LDA,nq) if VECT = 'P'
- * The vectors which define the elementary reflectors H(i) and
- * G(i), whose products determine the matrices Q and P, as
- * returned by DGEBRD.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A.
- * If VECT = 'Q', LDA >= max(1,nq);
- * if VECT = 'P', LDA >= max(1,min(nq,K)).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (min(nq,K))
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i) or G(i) which determines Q or P, as returned
- * by DGEBRD in the array argument TAUQ or TAUP.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q
- * or P*C or P**T*C or C*P or C*P**T.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DORMBR(char vect, char side, char trans, int m, int n, int k, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMBR(&vect, &side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMHR overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix of order nq, with nq = m if
- * SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
- * IHI-ILO elementary reflectors, as returned by DGEHRD:
- *
- * Q = H(ilo) H(ilo+1) . . . H(ihi-1).
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * ILO (input) INTEGER
- * IHI (input) INTEGER
- * ILO and IHI must have the same values as in the previous call
- * of DGEHRD. Q is equal to the unit matrix except in the
- * submatrix Q(ilo+1:ihi,ilo+1:ihi).
- * If SIDE = 'L', then 1 <= ILO <= IHI <= M, if M > 0, and
- * ILO = 1 and IHI = 0, if M = 0;
- * if SIDE = 'R', then 1 <= ILO <= IHI <= N, if N > 0, and
- * ILO = 1 and IHI = 0, if N = 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L'
- * (LDA,N) if SIDE = 'R'
- * The vectors which define the elementary reflectors, as
- * returned by DGEHRD.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A.
- * LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
- *
- * TAU (input) DOUBLE PRECISION array, dimension
- * (M-1) if SIDE = 'L'
- * (N-1) if SIDE = 'R'
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEHRD.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DORMHR(char side, char trans, int m, int n, int ilo, int ihi, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMHR(&side, &trans, &m, &n, &ilo, &ihi, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMLQ overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(k) . . . H(2) H(1)
- *
- * as returned by DGELQF. Q is of order M if SIDE = 'L' and of order N
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L',
- * (LDA,N) if SIDE = 'R'
- * The i-th row must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DGELQF in the first k rows of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,K).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGELQF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORMLQ(char side, char trans, int m, int n, int k, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMLQ(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMQL overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(k) . . . H(2) H(1)
- *
- * as returned by DGEQLF. Q is of order M if SIDE = 'L' and of order N
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,K)
- * The i-th column must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DGEQLF in the last k columns of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A.
- * If SIDE = 'L', LDA >= max(1,M);
- * if SIDE = 'R', LDA >= max(1,N).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEQLF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORMQL(char side, char trans, int m, int n, int k, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMQL(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMQR overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DGEQRF. Q is of order M if SIDE = 'L' and of order N
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,K)
- * The i-th column must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DGEQRF in the first k columns of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A.
- * If SIDE = 'L', LDA >= max(1,M);
- * if SIDE = 'R', LDA >= max(1,N).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGEQRF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORMQR(char side, char trans, int m, int n, int k, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMQR(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMR3 overwrites the general real m by n matrix C with
- *
- * Q * C if SIDE = 'L' and TRANS = 'N', or
- *
- * Q'* C if SIDE = 'L' and TRANS = 'T', or
- *
- * C * Q if SIDE = 'R' and TRANS = 'N', or
- *
- * C * Q' if SIDE = 'R' and TRANS = 'T',
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DTZRZF. Q is of order m if SIDE = 'L' and of order n
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q' from the Left
- * = 'R': apply Q or Q' from the Right
- *
- * TRANS (input) CHARACTER*1
- * = 'N': apply Q (No transpose)
- * = 'T': apply Q' (Transpose)
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * L (input) INTEGER
- * The number of columns of the matrix A containing
- * the meaningful part of the Householder reflectors.
- * If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L',
- * (LDA,N) if SIDE = 'R'
- * The i-th row must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DTZRZF in the last k rows of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,K).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DTZRZF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the m-by-n matrix C.
- * On exit, C is overwritten by Q*C or Q'*C or C*Q' or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension
- * (N) if SIDE = 'L',
- * (M) if SIDE = 'R'
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DORMR3(char side, char trans, int m, int n, int k, int l, double* a, int lda, double* tau, double* c, int ldc, double* work)
- {
- int info;
- ::F_DORMR3(&side, &trans, &m, &n, &k, &l, a, &lda, tau, c, &ldc, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMRQ overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DGERQF. Q is of order M if SIDE = 'L' and of order N
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L',
- * (LDA,N) if SIDE = 'R'
- * The i-th row must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DGERQF in the last k rows of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,K).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DGERQF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORMRQ(char side, char trans, int m, int n, int k, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMRQ(&side, &trans, &m, &n, &k, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMRZ overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix defined as the product of k
- * elementary reflectors
- *
- * Q = H(1) H(2) . . . H(k)
- *
- * as returned by DTZRZF. Q is of order M if SIDE = 'L' and of order N
- * if SIDE = 'R'.
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * K (input) INTEGER
- * The number of elementary reflectors whose product defines
- * the matrix Q.
- * If SIDE = 'L', M >= K >= 0;
- * if SIDE = 'R', N >= K >= 0.
- *
- * L (input) INTEGER
- * The number of columns of the matrix A containing
- * the meaningful part of the Householder reflectors.
- * If SIDE = 'L', M >= L >= 0, if SIDE = 'R', N >= L >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L',
- * (LDA,N) if SIDE = 'R'
- * The i-th row must contain the vector which defines the
- * elementary reflector H(i), for i = 1,2,...,k, as returned by
- * DTZRZF in the last k rows of its array argument A.
- * A is modified by the routine but restored on exit.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,K).
- *
- * TAU (input) DOUBLE PRECISION array, dimension (K)
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DTZRZF.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**H*C or C*Q**H or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * Based on contributions by
- * A. Petitet, Computer Science Dept., Univ. of Tenn., Knoxville, USA
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DORMRZ(char side, char trans, int m, int n, int k, int l, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMRZ(&side, &trans, &m, &n, &k, &l, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DORMTR overwrites the general real M-by-N matrix C with
- *
- * SIDE = 'L' SIDE = 'R'
- * TRANS = 'N': Q * C C * Q
- * TRANS = 'T': Q**T * C C * Q**T
- *
- * where Q is a real orthogonal matrix of order nq, with nq = m if
- * SIDE = 'L' and nq = n if SIDE = 'R'. Q is defined as the product of
- * nq-1 elementary reflectors, as returned by DSYTRD:
- *
- * if UPLO = 'U', Q = H(nq-1) . . . H(2) H(1);
- *
- * if UPLO = 'L', Q = H(1) H(2) . . . H(nq-1).
- *
- * Arguments
- * =========
- *
- * SIDE (input) CHARACTER*1
- * = 'L': apply Q or Q**T from the Left;
- * = 'R': apply Q or Q**T from the Right.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A contains elementary reflectors
- * from DSYTRD;
- * = 'L': Lower triangle of A contains elementary reflectors
- * from DSYTRD.
- *
- * TRANS (input) CHARACTER*1
- * = 'N': No transpose, apply Q;
- * = 'T': Transpose, apply Q**T.
- *
- * M (input) INTEGER
- * The number of rows of the matrix C. M >= 0.
- *
- * N (input) INTEGER
- * The number of columns of the matrix C. N >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension
- * (LDA,M) if SIDE = 'L'
- * (LDA,N) if SIDE = 'R'
- * The vectors which define the elementary reflectors, as
- * returned by DSYTRD.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A.
- * LDA >= max(1,M) if SIDE = 'L'; LDA >= max(1,N) if SIDE = 'R'.
- *
- * TAU (input) DOUBLE PRECISION array, dimension
- * (M-1) if SIDE = 'L'
- * (N-1) if SIDE = 'R'
- * TAU(i) must contain the scalar factor of the elementary
- * reflector H(i), as returned by DSYTRD.
- *
- * C (input/output) DOUBLE PRECISION array, dimension (LDC,N)
- * On entry, the M-by-N matrix C.
- * On exit, C is overwritten by Q*C or Q**T*C or C*Q**T or C*Q.
- *
- * LDC (input) INTEGER
- * The leading dimension of the array C. LDC >= max(1,M).
- *
- * WORK (workspace/output) DOUBLE PRECISION array, dimension (MAX(1,LWORK))
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * If SIDE = 'L', LWORK >= max(1,N);
- * if SIDE = 'R', LWORK >= max(1,M).
- * For optimum performance LWORK >= N*NB if SIDE = 'L', and
- * LWORK >= M*NB if SIDE = 'R', where NB is the optimal
- * blocksize.
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal size of the WORK array, returns
- * this value as the first entry of the WORK array, and no error
- * message related to LWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DORMTR(char side, char uplo, char trans, int m, int n, double* a, int lda, double* tau, double* c, int ldc, double* work, int lwork)
- {
- int info;
- ::F_DORMTR(&side, &uplo, &trans, &m, &n, a, &lda, tau, c, &ldc, work, &lwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBCON estimates the reciprocal of the condition number (in the
- * 1-norm) of a real symmetric positive definite band matrix using the
- * Cholesky factorization A = U**T*U or A = L*L**T computed by DPBTRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular factor stored in AB;
- * = 'L': Lower triangular factor stored in AB.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T of the band matrix A, stored in the
- * first KD+1 rows of the array. The j-th column of U or L is
- * stored in the j-th column of the array AB as follows:
- * if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO ='L', AB(1+i-j,j) = L(i,j) for j<=i<=min(n,j+kd).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * ANORM (input) DOUBLE PRECISION
- * The 1-norm (or infinity-norm) of the symmetric band matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
- * estimate of the 1-norm of inv(A) computed in this routine.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBCON(char uplo, int n, int kd, double* ab, int ldab, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DPBCON(&uplo, &n, &kd, ab, &ldab, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBEQU computes row and column scalings intended to equilibrate a
- * symmetric positive definite band matrix A and reduce its condition
- * number (with respect to the two-norm). S contains the scale factors,
- * S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
- * elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
- * choice of S puts the condition number of B within a factor N of the
- * smallest possible condition number over all possible diagonal
- * scalings.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular of A is stored;
- * = 'L': Lower triangular of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The upper or lower triangle of the symmetric band matrix A,
- * stored in the first KD+1 rows of the array. The j-th column
- * of A is stored in the j-th column of the array AB as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array A. LDAB >= KD+1.
- *
- * S (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, S contains the scale factors for A.
- *
- * SCOND (output) DOUBLE PRECISION
- * If INFO = 0, S contains the ratio of the smallest S(i) to
- * the largest S(i). If SCOND >= 0.1 and AMAX is neither too
- * large nor too small, it is not worth scaling by S.
- *
- * AMAX (output) DOUBLE PRECISION
- * Absolute value of largest matrix element. If AMAX is very
- * close to overflow or very close to underflow, the matrix
- * should be scaled.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, the i-th diagonal element is nonpositive.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBEQU(char uplo, int n, int kd, double* ab, int ldab, double* s, double* scond, double* amax)
- {
- int info;
- ::F_DPBEQU(&uplo, &n, &kd, ab, &ldab, s, scond, amax, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBRFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is symmetric positive definite
- * and banded, and provides error bounds and backward error estimates
- * for the solution.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The upper or lower triangle of the symmetric band matrix A,
- * stored in the first KD+1 rows of the array. The j-th column
- * of A is stored in the j-th column of the array AB as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * AFB (input) DOUBLE PRECISION array, dimension (LDAFB,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T of the band matrix A as computed by
- * DPBTRF, in the same storage format as A (see AB).
- *
- * LDAFB (input) INTEGER
- * The leading dimension of the array AFB. LDAFB >= KD+1.
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DPBTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBRFS(char uplo, int n, int kd, int nrhs, double* ab, int ldab, double* afb, int ldafb, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPBRFS(&uplo, &n, &kd, &nrhs, ab, &ldab, afb, &ldafb, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBSTF computes a split Cholesky factorization of a real
- * symmetric positive definite band matrix A.
- *
- * This routine is designed to be used in conjunction with DSBGST.
- *
- * The factorization has the form A = S**T*S where S is a band matrix
- * of the same bandwidth as A and the following structure:
- *
- * S = ( U )
- * ( M L )
- *
- * where U is upper triangular of order m = (n+kd)/2, and L is lower
- * triangular of order n-m.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first kd+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * On exit, if INFO = 0, the factor S from the split Cholesky
- * factorization A = S**T*S. See Further Details.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the factorization could not be completed,
- * because the updated element a(i,i) was negative; the
- * matrix A is not positive definite.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * N = 7, KD = 2:
- *
- * S = ( s11 s12 s13 )
- * ( s22 s23 s24 )
- * ( s33 s34 )
- * ( s44 )
- * ( s53 s54 s55 )
- * ( s64 s65 s66 )
- * ( s75 s76 s77 )
- *
- * If UPLO = 'U', the array AB holds:
- *
- * on entry: on exit:
- *
- * * * a13 a24 a35 a46 a57 * * s13 s24 s53 s64 s75
- * * a12 a23 a34 a45 a56 a67 * s12 s23 s34 s54 s65 s76
- * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
- *
- * If UPLO = 'L', the array AB holds:
- *
- * on entry: on exit:
- *
- * a11 a22 a33 a44 a55 a66 a77 s11 s22 s33 s44 s55 s66 s77
- * a21 a32 a43 a54 a65 a76 * s12 s23 s34 s54 s65 s76 *
- * a31 a42 a53 a64 a64 * * s13 s24 s53 s64 s75 * *
- *
- * Array elements marked * are not used by the routine.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBSTF(char uplo, int n, int kd, double* ab, int ldab)
- {
- int info;
- ::F_DPBSTF(&uplo, &n, &kd, ab, &ldab, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBSV computes the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite band matrix and X
- * and B are N-by-NRHS matrices.
- *
- * The Cholesky decomposition is used to factor A as
- * A = U**T * U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular band matrix, and L is a lower
- * triangular band matrix, with the same number of superdiagonals or
- * subdiagonals as A. The factored form of A is then used to solve the
- * system of equations A * X = B.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(N,j+KD).
- * See below for further details.
- *
- * On exit, if INFO = 0, the triangular factor U or L from the
- * Cholesky factorization A = U**T*U or A = L*L**T of the band
- * matrix A, in the same storage format as A.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i of A is not
- * positive definite, so the factorization could not be
- * completed, and the solution has not been computed.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * N = 6, KD = 2, and UPLO = 'U':
- *
- * On entry: On exit:
- *
- * * * a13 a24 a35 a46 * * u13 u24 u35 u46
- * * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
- * a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
- *
- * Similarly, if UPLO = 'L' the format of A is as follows:
- *
- * On entry: On exit:
- *
- * a11 a22 a33 a44 a55 a66 l11 l22 l33 l44 l55 l66
- * a21 a32 a43 a54 a65 * l21 l32 l43 l54 l65 *
- * a31 a42 a53 a64 * * l31 l42 l53 l64 * *
- *
- * Array elements marked * are not used by the routine.
- *
- * =====================================================================
- *
- * .. External Functions ..
- **/
- int C_DPBSV(char uplo, int n, int kd, int nrhs, double* ab, int ldab, double* b, int ldb)
- {
- int info;
- ::F_DPBSV(&uplo, &n, &kd, &nrhs, ab, &ldab, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBSVX uses the Cholesky factorization A = U**T*U or A = L*L**T to
- * compute the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite band matrix and X
- * and B are N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'E', real scaling factors are computed to equilibrate
- * the system:
- * diag(S) * A * diag(S) * inv(diag(S)) * X = diag(S) * B
- * Whether or not the system will be equilibrated depends on the
- * scaling of the matrix A, but if equilibration is used, A is
- * overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
- *
- * 2. If FACT = 'N' or 'E', the Cholesky decomposition is used to
- * factor the matrix A (after equilibration if FACT = 'E') as
- * A = U**T * U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular band matrix, and L is a lower
- * triangular band matrix.
- *
- * 3. If the leading i-by-i principal minor is not positive definite,
- * then the routine returns with INFO = i. Otherwise, the factored
- * form of A is used to estimate the condition number of the matrix
- * A. If the reciprocal of the condition number is less than machine
- * precision, INFO = N+1 is returned as a warning, but the routine
- * still goes on to solve for X and compute error bounds as
- * described below.
- *
- * 4. The system of equations is solved for X using the factored form
- * of A.
- *
- * 5. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * 6. If equilibration was used, the matrix X is premultiplied by
- * diag(S) so that it solves the original system before
- * equilibration.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of the matrix A is
- * supplied on entry, and if not, whether the matrix A should be
- * equilibrated before it is factored.
- * = 'F': On entry, AFB contains the factored form of A.
- * If EQUED = 'Y', the matrix A has been equilibrated
- * with scaling factors given by S. AB and AFB will not
- * be modified.
- * = 'N': The matrix A will be copied to AFB and factored.
- * = 'E': The matrix A will be equilibrated if necessary, then
- * copied to AFB and factored.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right-hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array, except
- * if FACT = 'F' and EQUED = 'Y', then A must contain the
- * equilibrated matrix diag(S)*A*diag(S). The j-th column of A
- * is stored in the j-th column of the array AB as follows:
- * if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(N,j+KD).
- * See below for further details.
- *
- * On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
- * diag(S)*A*diag(S).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array A. LDAB >= KD+1.
- *
- * AFB (input or output) DOUBLE PRECISION array, dimension (LDAFB,N)
- * If FACT = 'F', then AFB is an input argument and on entry
- * contains the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T of the band matrix
- * A, in the same storage format as A (see AB). If EQUED = 'Y',
- * then AFB is the factored form of the equilibrated matrix A.
- *
- * If FACT = 'N', then AFB is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T.
- *
- * If FACT = 'E', then AFB is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T of the equilibrated
- * matrix A (see the description of A for the form of the
- * equilibrated matrix).
- *
- * LDAFB (input) INTEGER
- * The leading dimension of the array AFB. LDAFB >= KD+1.
- *
- * EQUED (input or output) CHARACTER*1
- * Specifies the form of equilibration that was done.
- * = 'N': No equilibration (always true if FACT = 'N').
- * = 'Y': Equilibration was done, i.e., A has been replaced by
- * diag(S) * A * diag(S).
- * EQUED is an input argument if FACT = 'F'; otherwise, it is an
- * output argument.
- *
- * S (input or output) DOUBLE PRECISION array, dimension (N)
- * The scale factors for A; not accessed if EQUED = 'N'. S is
- * an input argument if FACT = 'F'; otherwise, S is an output
- * argument. If FACT = 'F' and EQUED = 'Y', each element of S
- * must be positive.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if EQUED = 'N', B is not modified; if EQUED = 'Y',
- * B is overwritten by diag(S) * B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X to
- * the original system of equations. Note that if EQUED = 'Y',
- * A and B are modified on exit, and the solution to the
- * equilibrated system is inv(diag(S))*X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A after equilibration (if done). If RCOND is less than the
- * machine precision (in particular, if RCOND = 0), the matrix
- * is singular to working precision. This condition is
- * indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: the leading minor of order i of A is
- * not positive definite, so the factorization
- * could not be completed, and the solution has not
- * been computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * N = 6, KD = 2, and UPLO = 'U':
- *
- * Two-dimensional storage of the symmetric matrix A:
- *
- * a11 a12 a13
- * a22 a23 a24
- * a33 a34 a35
- * a44 a45 a46
- * a55 a56
- * (aij=conjg(aji)) a66
- *
- * Band storage of the upper triangle of A:
- *
- * * * a13 a24 a35 a46
- * * a12 a23 a34 a45 a56
- * a11 a22 a33 a44 a55 a66
- *
- * Similarly, if UPLO = 'L' the format of A is as follows:
- *
- * a11 a22 a33 a44 a55 a66
- * a21 a32 a43 a54 a65 *
- * a31 a42 a53 a64 * *
- *
- * Array elements marked * are not used by the routine.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBSVX(char fact, char uplo, int n, int kd, int nrhs, double* ab, int ldab, double* afb, int ldafb, char equed, double* s, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPBSVX(&fact, &uplo, &n, &kd, &nrhs, ab, &ldab, afb, &ldafb, &equed, s, b, &ldb, x, &ldx, rcond, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBTRF computes the Cholesky factorization of a real symmetric
- * positive definite band matrix A.
- *
- * The factorization has the form
- * A = U**T * U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is lower triangular.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * On exit, if INFO = 0, the triangular factor U or L from the
- * Cholesky factorization A = U**T*U or A = L*L**T of the band
- * matrix A, in the same storage format as A.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i is not
- * positive definite, and the factorization could not be
- * completed.
- *
- * Further Details
- * ===============
- *
- * The band storage scheme is illustrated by the following example, when
- * N = 6, KD = 2, and UPLO = 'U':
- *
- * On entry: On exit:
- *
- * * * a13 a24 a35 a46 * * u13 u24 u35 u46
- * * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
- * a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
- *
- * Similarly, if UPLO = 'L' the format of A is as follows:
- *
- * On entry: On exit:
- *
- * a11 a22 a33 a44 a55 a66 l11 l22 l33 l44 l55 l66
- * a21 a32 a43 a54 a65 * l21 l32 l43 l54 l65 *
- * a31 a42 a53 a64 * * l31 l42 l53 l64 * *
- *
- * Array elements marked * are not used by the routine.
- *
- * Contributed by
- * Peter Mayes and Giuseppe Radicati, IBM ECSEC, Rome, March 23, 1989
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPBTRF(char uplo, int n, int kd, double* ab, int ldab)
- {
- int info;
- ::F_DPBTRF(&uplo, &n, &kd, ab, &ldab, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPBTRS solves a system of linear equations A*X = B with a symmetric
- * positive definite band matrix A using the Cholesky factorization
- * A = U**T*U or A = L*L**T computed by DPBTRF.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular factor stored in AB;
- * = 'L': Lower triangular factor stored in AB.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AB (input) DOUBLE PRECISION array, dimension (LDAB,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T of the band matrix A, stored in the
- * first KD+1 rows of the array. The j-th column of U or L is
- * stored in the j-th column of the array AB as follows:
- * if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO ='L', AB(1+i-j,j) = L(i,j) for j<=i<=min(n,j+kd).
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD+1.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit, the solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DPBTRS(char uplo, int n, int kd, int nrhs, double* ab, int ldab, double* b, int ldb)
- {
- int info;
- ::F_DPBTRS(&uplo, &n, &kd, &nrhs, ab, &ldab, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOCON estimates the reciprocal of the condition number (in the
- * 1-norm) of a real symmetric positive definite matrix using the
- * Cholesky factorization A = U**T*U or A = L*L**T computed by DPOTRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, as computed by DPOTRF.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * ANORM (input) DOUBLE PRECISION
- * The 1-norm (or infinity-norm) of the symmetric matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
- * estimate of the 1-norm of inv(A) computed in this routine.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPOCON(char uplo, int n, double* a, int lda, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DPOCON(&uplo, &n, a, &lda, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOEQU computes row and column scalings intended to equilibrate a
- * symmetric positive definite matrix A and reduce its condition number
- * (with respect to the two-norm). S contains the scale factors,
- * S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with
- * elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This
- * choice of S puts the condition number of B within a factor N of the
- * smallest possible condition number over all possible diagonal
- * scalings.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The N-by-N symmetric positive definite matrix whose scaling
- * factors are to be computed. Only the diagonal elements of A
- * are referenced.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * S (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, S contains the scale factors for A.
- *
- * SCOND (output) DOUBLE PRECISION
- * If INFO = 0, S contains the ratio of the smallest S(i) to
- * the largest S(i). If SCOND >= 0.1 and AMAX is neither too
- * large nor too small, it is not worth scaling by S.
- *
- * AMAX (output) DOUBLE PRECISION
- * Absolute value of largest matrix element. If AMAX is very
- * close to overflow or very close to underflow, the matrix
- * should be scaled.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the i-th diagonal element is nonpositive.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPOEQU(int n, double* a, int lda, double* s, double* scond, double* amax)
- {
- int info;
- ::F_DPOEQU(&n, a, &lda, s, scond, amax, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPORFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is symmetric positive definite,
- * and provides error bounds and backward error estimates for the
- * solution.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The symmetric matrix A. If UPLO = 'U', the leading N-by-N
- * upper triangular part of A contains the upper triangular part
- * of the matrix A, and the strictly lower triangular part of A
- * is not referenced. If UPLO = 'L', the leading N-by-N lower
- * triangular part of A contains the lower triangular part of
- * the matrix A, and the strictly upper triangular part of A is
- * not referenced.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * AF (input) DOUBLE PRECISION array, dimension (LDAF,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, as computed by DPOTRF.
- *
- * LDAF (input) INTEGER
- * The leading dimension of the array AF. LDAF >= max(1,N).
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DPOTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPORFS(char uplo, int n, int nrhs, double* a, int lda, double* af, int ldaf, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPORFS(&uplo, &n, &nrhs, a, &lda, af, &ldaf, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOSV computes the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite matrix and X and B
- * are N-by-NRHS matrices.
- *
- * The Cholesky decomposition is used to factor A as
- * A = U**T* U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is a lower triangular
- * matrix. The factored form of A is then used to solve the system of
- * equations A * X = B.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the symmetric matrix A. If UPLO = 'U', the leading
- * N-by-N upper triangular part of A contains the upper
- * triangular part of the matrix A, and the strictly lower
- * triangular part of A is not referenced. If UPLO = 'L', the
- * leading N-by-N lower triangular part of A contains the lower
- * triangular part of the matrix A, and the strictly upper
- * triangular part of A is not referenced.
- *
- * On exit, if INFO = 0, the factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i of A is not
- * positive definite, so the factorization could not be
- * completed, and the solution has not been computed.
- *
- * =====================================================================
- *
- * .. External Functions ..
- **/
- int C_DPOSV(char uplo, int n, int nrhs, double* a, int lda, double* b, int ldb)
- {
- int info;
- ::F_DPOSV(&uplo, &n, &nrhs, a, &lda, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOSVX uses the Cholesky factorization A = U**T*U or A = L*L**T to
- * compute the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite matrix and X and B
- * are N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'E', real scaling factors are computed to equilibrate
- * the system:
- * diag(S) * A * diag(S) * inv(diag(S)) * X = diag(S) * B
- * Whether or not the system will be equilibrated depends on the
- * scaling of the matrix A, but if equilibration is used, A is
- * overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
- *
- * 2. If FACT = 'N' or 'E', the Cholesky decomposition is used to
- * factor the matrix A (after equilibration if FACT = 'E') as
- * A = U**T* U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is a lower triangular
- * matrix.
- *
- * 3. If the leading i-by-i principal minor is not positive definite,
- * then the routine returns with INFO = i. Otherwise, the factored
- * form of A is used to estimate the condition number of the matrix
- * A. If the reciprocal of the condition number is less than machine
- * precision, INFO = N+1 is returned as a warning, but the routine
- * still goes on to solve for X and compute error bounds as
- * described below.
- *
- * 4. The system of equations is solved for X using the factored form
- * of A.
- *
- * 5. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * 6. If equilibration was used, the matrix X is premultiplied by
- * diag(S) so that it solves the original system before
- * equilibration.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of the matrix A is
- * supplied on entry, and if not, whether the matrix A should be
- * equilibrated before it is factored.
- * = 'F': On entry, AF contains the factored form of A.
- * If EQUED = 'Y', the matrix A has been equilibrated
- * with scaling factors given by S. A and AF will not
- * be modified.
- * = 'N': The matrix A will be copied to AF and factored.
- * = 'E': The matrix A will be equilibrated if necessary, then
- * copied to AF and factored.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the symmetric matrix A, except if FACT = 'F' and
- * EQUED = 'Y', then A must contain the equilibrated matrix
- * diag(S)*A*diag(S). If UPLO = 'U', the leading
- * N-by-N upper triangular part of A contains the upper
- * triangular part of the matrix A, and the strictly lower
- * triangular part of A is not referenced. If UPLO = 'L', the
- * leading N-by-N lower triangular part of A contains the lower
- * triangular part of the matrix A, and the strictly upper
- * triangular part of A is not referenced. A is not modified if
- * FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.
- *
- * On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
- * diag(S)*A*diag(S).
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * AF (input or output) DOUBLE PRECISION array, dimension (LDAF,N)
- * If FACT = 'F', then AF is an input argument and on entry
- * contains the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T, in the same storage
- * format as A. If EQUED .ne. 'N', then AF is the factored form
- * of the equilibrated matrix diag(S)*A*diag(S).
- *
- * If FACT = 'N', then AF is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T of the original
- * matrix A.
- *
- * If FACT = 'E', then AF is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T of the equilibrated
- * matrix A (see the description of A for the form of the
- * equilibrated matrix).
- *
- * LDAF (input) INTEGER
- * The leading dimension of the array AF. LDAF >= max(1,N).
- *
- * EQUED (input or output) CHARACTER*1
- * Specifies the form of equilibration that was done.
- * = 'N': No equilibration (always true if FACT = 'N').
- * = 'Y': Equilibration was done, i.e., A has been replaced by
- * diag(S) * A * diag(S).
- * EQUED is an input argument if FACT = 'F'; otherwise, it is an
- * output argument.
- *
- * S (input or output) DOUBLE PRECISION array, dimension (N)
- * The scale factors for A; not accessed if EQUED = 'N'. S is
- * an input argument if FACT = 'F'; otherwise, S is an output
- * argument. If FACT = 'F' and EQUED = 'Y', each element of S
- * must be positive.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if EQUED = 'N', B is not modified; if EQUED = 'Y',
- * B is overwritten by diag(S) * B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X to
- * the original system of equations. Note that if EQUED = 'Y',
- * A and B are modified on exit, and the solution to the
- * equilibrated system is inv(diag(S))*X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A after equilibration (if done). If RCOND is less than the
- * machine precision (in particular, if RCOND = 0), the matrix
- * is singular to working precision. This condition is
- * indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: the leading minor of order i of A is
- * not positive definite, so the factorization
- * could not be completed, and the solution has not
- * been computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPOSVX(char fact, char uplo, int n, int nrhs, double* a, int lda, double* af, int ldaf, char equed, double* s, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPOSVX(&fact, &uplo, &n, &nrhs, a, &lda, af, &ldaf, &equed, s, b, &ldb, x, &ldx, rcond, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOTRF computes the Cholesky factorization of a real symmetric
- * positive definite matrix A.
- *
- * The factorization has the form
- * A = U**T * U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is lower triangular.
- *
- * This is the block version of the algorithm, calling Level 3 BLAS.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the symmetric matrix A. If UPLO = 'U', the leading
- * N-by-N upper triangular part of A contains the upper
- * triangular part of the matrix A, and the strictly lower
- * triangular part of A is not referenced. If UPLO = 'L', the
- * leading N-by-N lower triangular part of A contains the lower
- * triangular part of the matrix A, and the strictly upper
- * triangular part of A is not referenced.
- *
- * On exit, if INFO = 0, the factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i is not
- * positive definite, and the factorization could not be
- * completed.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPOTRF(char uplo, int n, double* a, int lda)
- {
- int info;
- ::F_DPOTRF(&uplo, &n, a, &lda, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOTRI computes the inverse of a real symmetric positive definite
- * matrix A using the Cholesky factorization A = U**T*U or A = L*L**T
- * computed by DPOTRF.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
- * On entry, the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T, as computed by
- * DPOTRF.
- * On exit, the upper or lower triangle of the (symmetric)
- * inverse of A, overwriting the input factor U or L.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the (i,i) element of the factor U or L is
- * zero, and the inverse could not be computed.
- *
- * =====================================================================
- *
- * .. External Functions ..
- **/
- int C_DPOTRI(char uplo, int n, double* a, int lda)
- {
- int info;
- ::F_DPOTRI(&uplo, &n, a, &lda, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPOTRS solves a system of linear equations A*X = B with a symmetric
- * positive definite matrix A using the Cholesky factorization
- * A = U**T*U or A = L*L**T computed by DPOTRF.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * A (input) DOUBLE PRECISION array, dimension (LDA,N)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, as computed by DPOTRF.
- *
- * LDA (input) INTEGER
- * The leading dimension of the array A. LDA >= max(1,N).
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit, the solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPOTRS(char uplo, int n, int nrhs, double* a, int lda, double* b, int ldb)
- {
- int info;
- ::F_DPOTRS(&uplo, &n, &nrhs, a, &lda, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPCON estimates the reciprocal of the condition number (in the
- * 1-norm) of a real symmetric positive definite packed matrix using
- * the Cholesky factorization A = U**T*U or A = L*L**T computed by
- * DPPTRF.
- *
- * An estimate is obtained for norm(inv(A)), and the reciprocal of the
- * condition number is computed as RCOND = 1 / (ANORM * norm(inv(A))).
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, packed columnwise in a linear
- * array. The j-th column of U or L is stored in the array AP
- * as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n.
- *
- * ANORM (input) DOUBLE PRECISION
- * The 1-norm (or infinity-norm) of the symmetric matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is an
- * estimate of the 1-norm of inv(A) computed in this routine.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPCON(char uplo, int n, double* ap, double anorm, double* rcond, double* work, int* iwork)
- {
- int info;
- ::F_DPPCON(&uplo, &n, ap, &anorm, rcond, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPEQU computes row and column scalings intended to equilibrate a
- * symmetric positive definite matrix A in packed storage and reduce
- * its condition number (with respect to the two-norm). S contains the
- * scale factors, S(i)=1/sqrt(A(i,i)), chosen so that the scaled matrix
- * B with elements B(i,j)=S(i)*A(i,j)*S(j) has ones on the diagonal.
- * This choice of S puts the condition number of B within a factor N of
- * the smallest possible condition number over all possible diagonal
- * scalings.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The upper or lower triangle of the symmetric matrix A, packed
- * columnwise in a linear array. The j-th column of A is stored
- * in the array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
- *
- * S (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, S contains the scale factors for A.
- *
- * SCOND (output) DOUBLE PRECISION
- * If INFO = 0, S contains the ratio of the smallest S(i) to
- * the largest S(i). If SCOND >= 0.1 and AMAX is neither too
- * large nor too small, it is not worth scaling by S.
- *
- * AMAX (output) DOUBLE PRECISION
- * Absolute value of largest matrix element. If AMAX is very
- * close to overflow or very close to underflow, the matrix
- * should be scaled.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the i-th diagonal element is nonpositive.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPEQU(char uplo, int n, double* ap, double* s, double* scond, double* amax)
- {
- int info;
- ::F_DPPEQU(&uplo, &n, ap, s, scond, amax, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPRFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is symmetric positive definite
- * and packed, and provides error bounds and backward error estimates
- * for the solution.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The upper or lower triangle of the symmetric matrix A, packed
- * columnwise in a linear array. The j-th column of A is stored
- * in the array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
- *
- * AFP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, as computed by DPPTRF/ZPPTRF,
- * packed columnwise in a linear array in the same format as A
- * (see AP).
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DPPTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPRFS(char uplo, int n, int nrhs, double* ap, double* afp, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPPRFS(&uplo, &n, &nrhs, ap, afp, b, &ldb, x, &ldx, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPSV computes the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite matrix stored in
- * packed format and X and B are N-by-NRHS matrices.
- *
- * The Cholesky decomposition is used to factor A as
- * A = U**T* U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is a lower triangular
- * matrix. The factored form of A is then used to solve the system of
- * equations A * X = B.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * On entry, the upper or lower triangle of the symmetric matrix
- * A, packed columnwise in a linear array. The j-th column of A
- * is stored in the array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
- * See below for further details.
- *
- * On exit, if INFO = 0, the factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T, in the same storage
- * format as A.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i of A is not
- * positive definite, so the factorization could not be
- * completed, and the solution has not been computed.
- *
- * Further Details
- * ===============
- *
- * The packed storage scheme is illustrated by the following example
- * when N = 4, UPLO = 'U':
- *
- * Two-dimensional storage of the symmetric matrix A:
- *
- * a11 a12 a13 a14
- * a22 a23 a24
- * a33 a34 (aij = conjg(aji))
- * a44
- *
- * Packed storage of the upper triangle of A:
- *
- * AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
- *
- * =====================================================================
- *
- * .. External Functions ..
- **/
- int C_DPPSV(char uplo, int n, int nrhs, double* ap, double* b, int ldb)
- {
- int info;
- ::F_DPPSV(&uplo, &n, &nrhs, ap, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPSVX uses the Cholesky factorization A = U**T*U or A = L*L**T to
- * compute the solution to a real system of linear equations
- * A * X = B,
- * where A is an N-by-N symmetric positive definite matrix stored in
- * packed format and X and B are N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'E', real scaling factors are computed to equilibrate
- * the system:
- * diag(S) * A * diag(S) * inv(diag(S)) * X = diag(S) * B
- * Whether or not the system will be equilibrated depends on the
- * scaling of the matrix A, but if equilibration is used, A is
- * overwritten by diag(S)*A*diag(S) and B by diag(S)*B.
- *
- * 2. If FACT = 'N' or 'E', the Cholesky decomposition is used to
- * factor the matrix A (after equilibration if FACT = 'E') as
- * A = U**T* U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is a lower triangular
- * matrix.
- *
- * 3. If the leading i-by-i principal minor is not positive definite,
- * then the routine returns with INFO = i. Otherwise, the factored
- * form of A is used to estimate the condition number of the matrix
- * A. If the reciprocal of the condition number is less than machine
- * precision, INFO = N+1 is returned as a warning, but the routine
- * still goes on to solve for X and compute error bounds as
- * described below.
- *
- * 4. The system of equations is solved for X using the factored form
- * of A.
- *
- * 5. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * 6. If equilibration was used, the matrix X is premultiplied by
- * diag(S) so that it solves the original system before
- * equilibration.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of the matrix A is
- * supplied on entry, and if not, whether the matrix A should be
- * equilibrated before it is factored.
- * = 'F': On entry, AFP contains the factored form of A.
- * If EQUED = 'Y', the matrix A has been equilibrated
- * with scaling factors given by S. AP and AFP will not
- * be modified.
- * = 'N': The matrix A will be copied to AFP and factored.
- * = 'E': The matrix A will be equilibrated if necessary, then
- * copied to AFP and factored.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The number of linear equations, i.e., the order of the
- * matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * On entry, the upper or lower triangle of the symmetric matrix
- * A, packed columnwise in a linear array, except if FACT = 'F'
- * and EQUED = 'Y', then A must contain the equilibrated matrix
- * diag(S)*A*diag(S). The j-th column of A is stored in the
- * array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
- * See below for further details. A is not modified if
- * FACT = 'F' or 'N', or if FACT = 'E' and EQUED = 'N' on exit.
- *
- * On exit, if FACT = 'E' and EQUED = 'Y', A is overwritten by
- * diag(S)*A*diag(S).
- *
- * AFP (input or output) DOUBLE PRECISION array, dimension
- * (N*(N+1)/2)
- * If FACT = 'F', then AFP is an input argument and on entry
- * contains the triangular factor U or L from the Cholesky
- * factorization A = U'*U or A = L*L', in the same storage
- * format as A. If EQUED .ne. 'N', then AFP is the factored
- * form of the equilibrated matrix A.
- *
- * If FACT = 'N', then AFP is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U'*U or A = L*L' of the original matrix A.
- *
- * If FACT = 'E', then AFP is an output argument and on exit
- * returns the triangular factor U or L from the Cholesky
- * factorization A = U'*U or A = L*L' of the equilibrated
- * matrix A (see the description of AP for the form of the
- * equilibrated matrix).
- *
- * EQUED (input or output) CHARACTER*1
- * Specifies the form of equilibration that was done.
- * = 'N': No equilibration (always true if FACT = 'N').
- * = 'Y': Equilibration was done, i.e., A has been replaced by
- * diag(S) * A * diag(S).
- * EQUED is an input argument if FACT = 'F'; otherwise, it is an
- * output argument.
- *
- * S (input or output) DOUBLE PRECISION array, dimension (N)
- * The scale factors for A; not accessed if EQUED = 'N'. S is
- * an input argument if FACT = 'F'; otherwise, S is an output
- * argument. If FACT = 'F' and EQUED = 'Y', each element of S
- * must be positive.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if EQUED = 'N', B is not modified; if EQUED = 'Y',
- * B is overwritten by diag(S) * B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 or INFO = N+1, the N-by-NRHS solution matrix X to
- * the original system of equations. Note that if EQUED = 'Y',
- * A and B are modified on exit, and the solution to the
- * equilibrated system is inv(diag(S))*X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The estimate of the reciprocal condition number of the matrix
- * A after equilibration (if done). If RCOND is less than the
- * machine precision (in particular, if RCOND = 0), the matrix
- * is singular to working precision. This condition is
- * indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The estimated forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j). The estimate is as reliable as
- * the estimate for RCOND, and is almost always a slight
- * overestimate of the true error.
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * IWORK (workspace) INTEGER array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: the leading minor of order i of A is
- * not positive definite, so the factorization
- * could not be completed, and the solution has not
- * been computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * Further Details
- * ===============
- *
- * The packed storage scheme is illustrated by the following example
- * when N = 4, UPLO = 'U':
- *
- * Two-dimensional storage of the symmetric matrix A:
- *
- * a11 a12 a13 a14
- * a22 a23 a24
- * a33 a34 (aij = conjg(aji))
- * a44
- *
- * Packed storage of the upper triangle of A:
- *
- * AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPSVX(char fact, char uplo, int n, int nrhs, double* ap, double* afp, char equed, double* s, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work, int* iwork)
- {
- int info;
- ::F_DPPSVX(&fact, &uplo, &n, &nrhs, ap, afp, &equed, s, b, &ldb, x, &ldx, rcond, ferr, berr, work, iwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPTRF computes the Cholesky factorization of a real symmetric
- * positive definite matrix A stored in packed format.
- *
- * The factorization has the form
- * A = U**T * U, if UPLO = 'U', or
- * A = L * L**T, if UPLO = 'L',
- * where U is an upper triangular matrix and L is lower triangular.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * On entry, the upper or lower triangle of the symmetric matrix
- * A, packed columnwise in a linear array. The j-th column of A
- * is stored in the array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
- * See below for further details.
- *
- * On exit, if INFO = 0, the triangular factor U or L from the
- * Cholesky factorization A = U**T*U or A = L*L**T, in the same
- * storage format as A.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i is not
- * positive definite, and the factorization could not be
- * completed.
- *
- * Further Details
- * ======= =======
- *
- * The packed storage scheme is illustrated by the following example
- * when N = 4, UPLO = 'U':
- *
- * Two-dimensional storage of the symmetric matrix A:
- *
- * a11 a12 a13 a14
- * a22 a23 a24
- * a33 a34 (aij = aji)
- * a44
- *
- * Packed storage of the upper triangle of A:
- *
- * AP = [ a11, a12, a22, a13, a23, a33, a14, a24, a34, a44 ]
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPTRF(char uplo, int n, double* ap)
- {
- int info;
- ::F_DPPTRF(&uplo, &n, ap, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPTRI computes the inverse of a real symmetric positive definite
- * matrix A using the Cholesky factorization A = U**T*U or A = L*L**T
- * computed by DPPTRF.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangular factor is stored in AP;
- * = 'L': Lower triangular factor is stored in AP.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * AP (input/output) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * On entry, the triangular factor U or L from the Cholesky
- * factorization A = U**T*U or A = L*L**T, packed columnwise as
- * a linear array. The j-th column of U or L is stored in the
- * array AP as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n.
- *
- * On exit, the upper or lower triangle of the (symmetric)
- * inverse of A, overwriting the input factor U or L.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the (i,i) element of the factor U or L is
- * zero, and the inverse could not be computed.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPPTRI(char uplo, int n, double* ap)
- {
- int info;
- ::F_DPPTRI(&uplo, &n, ap, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPPTRS solves a system of linear equations A*X = B with a symmetric
- * positive definite matrix A in packed storage using the Cholesky
- * factorization A = U**T*U or A = L*L**T computed by DPPTRF.
- *
- * Arguments
- * =========
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * AP (input) DOUBLE PRECISION array, dimension (N*(N+1)/2)
- * The triangular factor U or L from the Cholesky factorization
- * A = U**T*U or A = L*L**T, packed columnwise in a linear
- * array. The j-th column of U or L is stored in the array AP
- * as follows:
- * if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j;
- * if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side matrix B.
- * On exit, the solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DPPTRS(char uplo, int n, int nrhs, double* ap, double* b, int ldb)
- {
- int info;
- ::F_DPPTRS(&uplo, &n, &nrhs, ap, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTCON computes the reciprocal of the condition number (in the
- * 1-norm) of a real symmetric positive definite tridiagonal matrix
- * using the factorization A = L*D*L**T or A = U**T*D*U computed by
- * DPTTRF.
- *
- * Norm(inv(A)) is computed by a direct method, and the reciprocal of
- * the condition number is computed as
- * RCOND = 1 / (ANORM * norm(inv(A))).
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the diagonal matrix D from the
- * factorization of A, as computed by DPTTRF.
- *
- * E (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) off-diagonal elements of the unit bidiagonal factor
- * U or L from the factorization of A, as computed by DPTTRF.
- *
- * ANORM (input) DOUBLE PRECISION
- * The 1-norm of the original matrix A.
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal of the condition number of the matrix A,
- * computed as RCOND = 1/(ANORM * AINVNM), where AINVNM is the
- * 1-norm of inv(A) computed in this routine.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Further Details
- * ===============
- *
- * The method used is described in Nicholas J. Higham, "Efficient
- * Algorithms for Computing the Condition Number of a Tridiagonal
- * Matrix", SIAM J. Sci. Stat. Comput., Vol. 7, No. 1, January 1986.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPTCON(int n, double* d, double* e, double anorm, double* rcond, double* work)
- {
- int info;
- ::F_DPTCON(&n, d, e, &anorm, rcond, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTEQR computes all eigenvalues and, optionally, eigenvectors of a
- * symmetric positive definite tridiagonal matrix by first factoring the
- * matrix using DPTTRF, and then calling DBDSQR to compute the singular
- * values of the bidiagonal factor.
- *
- * This routine computes the eigenvalues of the positive definite
- * tridiagonal matrix to high relative accuracy. This means that if the
- * eigenvalues range over many orders of magnitude in size, then the
- * small eigenvalues and corresponding eigenvectors will be computed
- * more accurately than, for example, with the standard QR method.
- *
- * The eigenvectors of a full or band symmetric positive definite matrix
- * can also be found if DSYTRD, DSPTRD, or DSBTRD has been used to
- * reduce this matrix to tridiagonal form. (The reduction to tridiagonal
- * form, however, may preclude the possibility of obtaining high
- * relative accuracy in the small eigenvalues of the original matrix, if
- * these eigenvalues range over many orders of magnitude.)
- *
- * Arguments
- * =========
- *
- * COMPZ (input) CHARACTER*1
- * = 'N': Compute eigenvalues only.
- * = 'V': Compute eigenvectors of original symmetric
- * matrix also. Array Z contains the orthogonal
- * matrix used to reduce the original matrix to
- * tridiagonal form.
- * = 'I': Compute eigenvectors of tridiagonal matrix also.
- *
- * N (input) INTEGER
- * The order of the matrix. N >= 0.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, the n diagonal elements of the tridiagonal
- * matrix.
- * On normal exit, D contains the eigenvalues, in descending
- * order.
- *
- * E (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, the (n-1) subdiagonal elements of the tridiagonal
- * matrix.
- * On exit, E has been destroyed.
- *
- * Z (input/output) DOUBLE PRECISION array, dimension (LDZ, N)
- * On entry, if COMPZ = 'V', the orthogonal matrix used in the
- * reduction to tridiagonal form.
- * On exit, if COMPZ = 'V', the orthonormal eigenvectors of the
- * original symmetric matrix;
- * if COMPZ = 'I', the orthonormal eigenvectors of the
- * tridiagonal matrix.
- * If INFO > 0 on exit, Z contains the eigenvectors associated
- * with only the stored eigenvalues.
- * If COMPZ = 'N', then Z is not referenced.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1, and if
- * COMPZ = 'V' or 'I', LDZ >= max(1,N).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (4*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, and i is:
- * <= N the Cholesky factorization of the matrix could
- * not be performed because the i-th principal minor
- * was not positive definite.
- * > N the SVD algorithm failed to converge;
- * if INFO = N+i, i off-diagonal elements of the
- * bidiagonal factor did not converge to zero.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPTEQR(char compz, int n, double* d, double* e, double* z, int ldz, double* work)
- {
- int info;
- ::F_DPTEQR(&compz, &n, d, e, z, &ldz, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTRFS improves the computed solution to a system of linear
- * equations when the coefficient matrix is symmetric positive definite
- * and tridiagonal, and provides error bounds and backward error
- * estimates for the solution.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the tridiagonal matrix A.
- *
- * E (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of the tridiagonal matrix A.
- *
- * DF (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the diagonal matrix D from the
- * factorization computed by DPTTRF.
- *
- * EF (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of the unit bidiagonal factor
- * L from the factorization computed by DPTTRF.
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (input/output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * On entry, the solution matrix X, as computed by DPTTRS.
- * On exit, the improved solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j).
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in
- * any element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (2*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- *
- * Internal Parameters
- * ===================
- *
- * ITMAX is the maximum number of steps of iterative refinement.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPTRFS(int n, int nrhs, double* d, double* e, double* df, double* ef, double* b, int ldb, double* x, int ldx, double* ferr, double* berr, double* work)
- {
- int info;
- ::F_DPTRFS(&n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, ferr, berr, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTSV computes the solution to a real system of linear equations
- * A*X = B, where A is an N-by-N symmetric positive definite tridiagonal
- * matrix, and X and B are N-by-NRHS matrices.
- *
- * A is factored as A = L*D*L**T, and the factored form of A is then
- * used to solve the system of equations.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, the n diagonal elements of the tridiagonal matrix
- * A. On exit, the n diagonal elements of the diagonal matrix
- * D from the factorization A = L*D*L**T.
- *
- * E (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, the (n-1) subdiagonal elements of the tridiagonal
- * matrix A. On exit, the (n-1) subdiagonal elements of the
- * unit bidiagonal factor L from the L*D*L**T factorization of
- * A. (E can also be regarded as the superdiagonal of the unit
- * bidiagonal factor U from the U**T*D*U factorization of A.)
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the N-by-NRHS right hand side matrix B.
- * On exit, if INFO = 0, the N-by-NRHS solution matrix X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the leading minor of order i is not
- * positive definite, and the solution has not been
- * computed. The factorization has not been completed
- * unless i = N.
- *
- * =====================================================================
- *
- * .. External Subroutines ..
- **/
- int C_DPTSV(int n, int nrhs, double* d, double* e, double* b, int ldb)
- {
- int info;
- ::F_DPTSV(&n, &nrhs, d, e, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTSVX uses the factorization A = L*D*L**T to compute the solution
- * to a real system of linear equations A*X = B, where A is an N-by-N
- * symmetric positive definite tridiagonal matrix and X and B are
- * N-by-NRHS matrices.
- *
- * Error bounds on the solution and a condition estimate are also
- * provided.
- *
- * Description
- * ===========
- *
- * The following steps are performed:
- *
- * 1. If FACT = 'N', the matrix A is factored as A = L*D*L**T, where L
- * is a unit lower bidiagonal matrix and D is diagonal. The
- * factorization can also be regarded as having the form
- * A = U**T*D*U.
- *
- * 2. If the leading i-by-i principal minor is not positive definite,
- * then the routine returns with INFO = i. Otherwise, the factored
- * form of A is used to estimate the condition number of the matrix
- * A. If the reciprocal of the condition number is less than machine
- * precision, INFO = N+1 is returned as a warning, but the routine
- * still goes on to solve for X and compute error bounds as
- * described below.
- *
- * 3. The system of equations is solved for X using the factored form
- * of A.
- *
- * 4. Iterative refinement is applied to improve the computed solution
- * matrix and calculate error bounds and backward error estimates
- * for it.
- *
- * Arguments
- * =========
- *
- * FACT (input) CHARACTER*1
- * Specifies whether or not the factored form of A has been
- * supplied on entry.
- * = 'F': On entry, DF and EF contain the factored form of A.
- * D, E, DF, and EF will not be modified.
- * = 'N': The matrix A will be copied to DF and EF and
- * factored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrices B and X. NRHS >= 0.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the tridiagonal matrix A.
- *
- * E (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of the tridiagonal matrix A.
- *
- * DF (input or output) DOUBLE PRECISION array, dimension (N)
- * If FACT = 'F', then DF is an input argument and on entry
- * contains the n diagonal elements of the diagonal matrix D
- * from the L*D*L**T factorization of A.
- * If FACT = 'N', then DF is an output argument and on exit
- * contains the n diagonal elements of the diagonal matrix D
- * from the L*D*L**T factorization of A.
- *
- * EF (input or output) DOUBLE PRECISION array, dimension (N-1)
- * If FACT = 'F', then EF is an input argument and on entry
- * contains the (n-1) subdiagonal elements of the unit
- * bidiagonal factor L from the L*D*L**T factorization of A.
- * If FACT = 'N', then EF is an output argument and on exit
- * contains the (n-1) subdiagonal elements of the unit
- * bidiagonal factor L from the L*D*L**T factorization of A.
- *
- * B (input) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * The N-by-NRHS right hand side matrix B.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,NRHS)
- * If INFO = 0 of INFO = N+1, the N-by-NRHS solution matrix X.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X. LDX >= max(1,N).
- *
- * RCOND (output) DOUBLE PRECISION
- * The reciprocal condition number of the matrix A. If RCOND
- * is less than the machine precision (in particular, if
- * RCOND = 0), the matrix is singular to working precision.
- * This condition is indicated by a return code of INFO > 0.
- *
- * FERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The forward error bound for each solution vector
- * X(j) (the j-th column of the solution matrix X).
- * If XTRUE is the true solution corresponding to X(j), FERR(j)
- * is an estimated upper bound for the magnitude of the largest
- * element in (X(j) - XTRUE) divided by the magnitude of the
- * largest element in X(j).
- *
- * BERR (output) DOUBLE PRECISION array, dimension (NRHS)
- * The componentwise relative backward error of each solution
- * vector X(j) (i.e., the smallest relative change in any
- * element of A or B that makes X(j) an exact solution).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (2*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is
- * <= N: the leading minor of order i of A is
- * not positive definite, so the factorization
- * could not be completed, and the solution has not
- * been computed. RCOND = 0 is returned.
- * = N+1: U is nonsingular, but RCOND is less than machine
- * precision, meaning that the matrix is singular
- * to working precision. Nevertheless, the
- * solution and error bounds are computed because
- * there are a number of situations where the
- * computed solution can be more accurate than the
- * value of RCOND would suggest.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPTSVX(char fact, int n, int nrhs, double* d, double* e, double* df, double* ef, double* b, int ldb, double* x, int ldx, double* rcond, double* ferr, double* berr, double* work)
- {
- int info;
- ::F_DPTSVX(&fact, &n, &nrhs, d, e, df, ef, b, &ldb, x, &ldx, rcond, ferr, berr, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTTRF computes the L*D*L' factorization of a real symmetric
- * positive definite tridiagonal matrix A. The factorization may also
- * be regarded as having the form A = U'*D*U.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * D (input/output) DOUBLE PRECISION array, dimension (N)
- * On entry, the n diagonal elements of the tridiagonal matrix
- * A. On exit, the n diagonal elements of the diagonal matrix
- * D from the L*D*L' factorization of A.
- *
- * E (input/output) DOUBLE PRECISION array, dimension (N-1)
- * On entry, the (n-1) subdiagonal elements of the tridiagonal
- * matrix A. On exit, the (n-1) subdiagonal elements of the
- * unit bidiagonal factor L from the L*D*L' factorization of A.
- * E can also be regarded as the superdiagonal of the unit
- * bidiagonal factor U from the U'*D*U factorization of A.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -k, the k-th argument had an illegal value
- * > 0: if INFO = k, the leading minor of order k is not
- * positive definite; if k < N, the factorization could not
- * be completed, while if k = N, the factorization was
- * completed, but D(N) <= 0.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DPTTRF(int n, double* d, double* e)
- {
- int info;
- ::F_DPTTRF(&n, d, e, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DPTTRS solves a tridiagonal system of the form
- * A * X = B
- * using the L*D*L' factorization of A computed by DPTTRF. D is a
- * diagonal matrix specified in the vector D, L is a unit bidiagonal
- * matrix whose subdiagonal is specified in the vector E, and X and B
- * are N by NRHS matrices.
- *
- * Arguments
- * =========
- *
- * N (input) INTEGER
- * The order of the tridiagonal matrix A. N >= 0.
- *
- * NRHS (input) INTEGER
- * The number of right hand sides, i.e., the number of columns
- * of the matrix B. NRHS >= 0.
- *
- * D (input) DOUBLE PRECISION array, dimension (N)
- * The n diagonal elements of the diagonal matrix D from the
- * L*D*L' factorization of A.
- *
- * E (input) DOUBLE PRECISION array, dimension (N-1)
- * The (n-1) subdiagonal elements of the unit bidiagonal factor
- * L from the L*D*L' factorization of A. E can also be regarded
- * as the superdiagonal of the unit bidiagonal factor U from the
- * factorization A = U'*D*U.
- *
- * B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS)
- * On entry, the right hand side vectors B for the system of
- * linear equations.
- * On exit, the solution vectors, X.
- *
- * LDB (input) INTEGER
- * The leading dimension of the array B. LDB >= max(1,N).
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -k, the k-th argument had an illegal value
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DPTTRS(int n, int nrhs, double* d, double* e, double* b, int ldb)
- {
- int info;
- ::F_DPTTRS(&n, &nrhs, d, e, b, &ldb, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBEV computes all the eigenvalues and, optionally, eigenvectors of
- * a real symmetric band matrix A.
- *
- * Arguments
- * =========
- *
- * JOBZ (input) CHARACTER*1
- * = 'N': Compute eigenvalues only;
- * = 'V': Compute eigenvalues and eigenvectors.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB, N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * On exit, AB is overwritten by values generated during the
- * reduction to tridiagonal form. If UPLO = 'U', the first
- * superdiagonal and the diagonal of the tridiagonal matrix T
- * are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
- * the diagonal and first subdiagonal of T are returned in the
- * first two rows of AB.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD + 1.
- *
- * W (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, the eigenvalues in ascending order.
- *
- * Z (output) DOUBLE PRECISION array, dimension (LDZ, N)
- * If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
- * eigenvectors of the matrix A, with the i-th column of Z
- * holding the eigenvector associated with W(i).
- * If JOBZ = 'N', then Z is not referenced.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1, and if
- * JOBZ = 'V', LDZ >= max(1,N).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (max(1,3*N-2))
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the algorithm failed to converge; i
- * off-diagonal elements of an intermediate tridiagonal
- * form did not converge to zero.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DSBEV(char jobz, char uplo, int n, int kd, double* ab, int ldab, double* w, double* z, int ldz, double* work)
- {
- int info;
- ::F_DSBEV(&jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBEVD computes all the eigenvalues and, optionally, eigenvectors of
- * a real symmetric band matrix A. If eigenvectors are desired, it uses
- * a divide and conquer algorithm.
- *
- * The divide and conquer algorithm makes very mild assumptions about
- * floating point arithmetic. It will work on machines with a guard
- * digit in add/subtract, or on those binary machines without guard
- * digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
- * Cray-2. It could conceivably fail on hexadecimal or decimal machines
- * without guard digits, but we know of none.
- *
- * Arguments
- * =========
- *
- * JOBZ (input) CHARACTER*1
- * = 'N': Compute eigenvalues only;
- * = 'V': Compute eigenvalues and eigenvectors.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB, N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * On exit, AB is overwritten by values generated during the
- * reduction to tridiagonal form. If UPLO = 'U', the first
- * superdiagonal and the diagonal of the tridiagonal matrix T
- * are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
- * the diagonal and first subdiagonal of T are returned in the
- * first two rows of AB.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD + 1.
- *
- * W (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, the eigenvalues in ascending order.
- *
- * Z (output) DOUBLE PRECISION array, dimension (LDZ, N)
- * If JOBZ = 'V', then if INFO = 0, Z contains the orthonormal
- * eigenvectors of the matrix A, with the i-th column of Z
- * holding the eigenvector associated with W(i).
- * If JOBZ = 'N', then Z is not referenced.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1, and if
- * JOBZ = 'V', LDZ >= max(1,N).
- *
- * WORK (workspace/output) DOUBLE PRECISION array,
- * dimension (LWORK)
- * On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
- *
- * LWORK (input) INTEGER
- * The dimension of the array WORK.
- * IF N <= 1, LWORK must be at least 1.
- * If JOBZ = 'N' and N > 2, LWORK must be at least 2*N.
- * If JOBZ = 'V' and N > 2, LWORK must be at least
- * ( 1 + 5*N + 2*N**2 ).
- *
- * If LWORK = -1, then a workspace query is assumed; the routine
- * only calculates the optimal sizes of the WORK and IWORK
- * arrays, returns these values as the first entries of the WORK
- * and IWORK arrays, and no error message related to LWORK or
- * LIWORK is issued by XERBLA.
- *
- * IWORK (workspace/output) INTEGER array, dimension (MAX(1,LIWORK))
- * On exit, if INFO = 0, IWORK(1) returns the optimal LIWORK.
- *
- * LIWORK (input) INTEGER
- * The dimension of the array LIWORK.
- * If JOBZ = 'N' or N <= 1, LIWORK must be at least 1.
- * If JOBZ = 'V' and N > 2, LIWORK must be at least 3 + 5*N.
- *
- * If LIWORK = -1, then a workspace query is assumed; the
- * routine only calculates the optimal sizes of the WORK and
- * IWORK arrays, returns these values as the first entries of
- * the WORK and IWORK arrays, and no error message related to
- * LWORK or LIWORK is issued by XERBLA.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, the algorithm failed to converge; i
- * off-diagonal elements of an intermediate tridiagonal
- * form did not converge to zero.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DSBEVD(char jobz, char uplo, int n, int kd, double* ab, int ldab, double* w, double* z, int ldz, double* work, int lwork, int* iwork, int liwork)
- {
- int info;
- ::F_DSBEVD(&jobz, &uplo, &n, &kd, ab, &ldab, w, z, &ldz, work, &lwork, iwork, &liwork, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBEVX computes selected eigenvalues and, optionally, eigenvectors
- * of a real symmetric band matrix A. Eigenvalues and eigenvectors can
- * be selected by specifying either a range of values or a range of
- * indices for the desired eigenvalues.
- *
- * Arguments
- * =========
- *
- * JOBZ (input) CHARACTER*1
- * = 'N': Compute eigenvalues only;
- * = 'V': Compute eigenvalues and eigenvectors.
- *
- * RANGE (input) CHARACTER*1
- * = 'A': all eigenvalues will be found;
- * = 'V': all eigenvalues in the half-open interval (VL,VU]
- * will be found;
- * = 'I': the IL-th through IU-th eigenvalues will be found.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrix A. N >= 0.
- *
- * KD (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KD >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB, N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first KD+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd).
- *
- * On exit, AB is overwritten by values generated during the
- * reduction to tridiagonal form. If UPLO = 'U', the first
- * superdiagonal and the diagonal of the tridiagonal matrix T
- * are returned in rows KD and KD+1 of AB, and if UPLO = 'L',
- * the diagonal and first subdiagonal of T are returned in the
- * first two rows of AB.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KD + 1.
- *
- * Q (output) DOUBLE PRECISION array, dimension (LDQ, N)
- * If JOBZ = 'V', the N-by-N orthogonal matrix used in the
- * reduction to tridiagonal form.
- * If JOBZ = 'N', the array Q is not referenced.
- *
- * LDQ (input) INTEGER
- * The leading dimension of the array Q. If JOBZ = 'V', then
- * LDQ >= max(1,N).
- *
- * VL (input) DOUBLE PRECISION
- * VU (input) DOUBLE PRECISION
- * If RANGE='V', the lower and upper bounds of the interval to
- * be searched for eigenvalues. VL < VU.
- * Not referenced if RANGE = 'A' or 'I'.
- *
- * IL (input) INTEGER
- * IU (input) INTEGER
- * If RANGE='I', the indices (in ascending order) of the
- * smallest and largest eigenvalues to be returned.
- * 1 <= IL <= IU <= N, if N > 0; IL = 1 and IU = 0 if N = 0.
- * Not referenced if RANGE = 'A' or 'V'.
- *
- * ABSTOL (input) DOUBLE PRECISION
- * The absolute error tolerance for the eigenvalues.
- * An approximate eigenvalue is accepted as converged
- * when it is determined to lie in an interval [a,b]
- * of width less than or equal to
- *
- * ABSTOL + EPS * max( |a|,|b| ) ,
- *
- * where EPS is the machine precision. If ABSTOL is less than
- * or equal to zero, then EPS*|T| will be used in its place,
- * where |T| is the 1-norm of the tridiagonal matrix obtained
- * by reducing AB to tridiagonal form.
- *
- * Eigenvalues will be computed most accurately when ABSTOL is
- * set to twice the underflow threshold 2*DLAMCH('S'), not zero.
- * If this routine returns with INFO>0, indicating that some
- * eigenvectors did not converge, try setting ABSTOL to
- * 2*DLAMCH('S').
- *
- * See "Computing Small Singular Values of Bidiagonal Matrices
- * with Guaranteed High Relative Accuracy," by Demmel and
- * Kahan, LAPACK Working Note #3.
- *
- * M (output) INTEGER
- * The total number of eigenvalues found. 0 <= M <= N.
- * If RANGE = 'A', M = N, and if RANGE = 'I', M = IU-IL+1.
- *
- * W (output) DOUBLE PRECISION array, dimension (N)
- * The first M elements contain the selected eigenvalues in
- * ascending order.
- *
- * Z (output) DOUBLE PRECISION array, dimension (LDZ, max(1,M))
- * If JOBZ = 'V', then if INFO = 0, the first M columns of Z
- * contain the orthonormal eigenvectors of the matrix A
- * corresponding to the selected eigenvalues, with the i-th
- * column of Z holding the eigenvector associated with W(i).
- * If an eigenvector fails to converge, then that column of Z
- * contains the latest approximation to the eigenvector, and the
- * index of the eigenvector is returned in IFAIL.
- * If JOBZ = 'N', then Z is not referenced.
- * Note: the user must ensure that at least max(1,M) columns are
- * supplied in the array Z; if RANGE = 'V', the exact value of M
- * is not known in advance and an upper bound must be used.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1, and if
- * JOBZ = 'V', LDZ >= max(1,N).
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (7*N)
- *
- * IWORK (workspace) INTEGER array, dimension (5*N)
- *
- * IFAIL (output) INTEGER array, dimension (N)
- * If JOBZ = 'V', then if INFO = 0, the first M elements of
- * IFAIL are zero. If INFO > 0, then IFAIL contains the
- * indices of the eigenvectors that failed to converge.
- * If JOBZ = 'N', then IFAIL is not referenced.
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit.
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- * > 0: if INFO = i, then i eigenvectors failed to converge.
- * Their indices are stored in array IFAIL.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DSBEVX(char jobz, char range, char uplo, int n, int kd, double* ab, int ldab, double* q, int ldq, double vl, double vu, int il, int iu, double abstol, int* m, double* w, double* z, int ldz, double* work, int* iwork, int* ifail)
- {
- int info;
- ::F_DSBEVX(&jobz, &range, &uplo, &n, &kd, ab, &ldab, q, &ldq, &vl, &vu, &il, &iu, &abstol, m, w, z, &ldz, work, iwork, ifail, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBGST reduces a real symmetric-definite banded generalized
- * eigenproblem A*x = lambda*B*x to standard form C*y = lambda*y,
- * such that C has the same bandwidth as A.
- *
- * B must have been previously factorized as S**T*S by DPBSTF, using a
- * split Cholesky factorization. A is overwritten by C = X**T*A*X, where
- * X = S**(-1)*Q and Q is an orthogonal matrix chosen to preserve the
- * bandwidth of A.
- *
- * Arguments
- * =========
- *
- * VECT (input) CHARACTER*1
- * = 'N': do not form the transformation matrix X;
- * = 'V': form X.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangle of A is stored;
- * = 'L': Lower triangle of A is stored.
- *
- * N (input) INTEGER
- * The order of the matrices A and B. N >= 0.
- *
- * KA (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KA >= 0.
- *
- * KB (input) INTEGER
- * The number of superdiagonals of the matrix B if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KA >= KB >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first ka+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
- *
- * On exit, the transformed matrix X**T*A*X, stored in the same
- * format as A.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KA+1.
- *
- * BB (input) DOUBLE PRECISION array, dimension (LDBB,N)
- * The banded factor S from the split Cholesky factorization of
- * B, as returned by DPBSTF, stored in the first KB+1 rows of
- * the array.
- *
- * LDBB (input) INTEGER
- * The leading dimension of the array BB. LDBB >= KB+1.
- *
- * X (output) DOUBLE PRECISION array, dimension (LDX,N)
- * If VECT = 'V', the n-by-n matrix X.
- * If VECT = 'N', the array X is not referenced.
- *
- * LDX (input) INTEGER
- * The leading dimension of the array X.
- * LDX >= max(1,N) if VECT = 'V'; LDX >= 1 otherwise.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (2*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value.
- *
- * =====================================================================
- *
- * .. Parameters ..
- **/
- int C_DSBGST(char vect, char uplo, int n, int ka, int kb, double* ab, int ldab, double* bb, int ldbb, double* x, int ldx, double* work)
- {
- int info;
- ::F_DSBGST(&vect, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb, x, &ldx, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBGV computes all the eigenvalues, and optionally, the eigenvectors
- * of a real generalized symmetric-definite banded eigenproblem, of
- * the form A*x=(lambda)*B*x. Here A and B are assumed to be symmetric
- * and banded, and B is also positive definite.
- *
- * Arguments
- * =========
- *
- * JOBZ (input) CHARACTER*1
- * = 'N': Compute eigenvalues only;
- * = 'V': Compute eigenvalues and eigenvectors.
- *
- * UPLO (input) CHARACTER*1
- * = 'U': Upper triangles of A and B are stored;
- * = 'L': Lower triangles of A and B are stored.
- *
- * N (input) INTEGER
- * The order of the matrices A and B. N >= 0.
- *
- * KA (input) INTEGER
- * The number of superdiagonals of the matrix A if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KA >= 0.
- *
- * KB (input) INTEGER
- * The number of superdiagonals of the matrix B if UPLO = 'U',
- * or the number of subdiagonals if UPLO = 'L'. KB >= 0.
- *
- * AB (input/output) DOUBLE PRECISION array, dimension (LDAB, N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix A, stored in the first ka+1 rows of the array. The
- * j-th column of A is stored in the j-th column of the array AB
- * as follows:
- * if UPLO = 'U', AB(ka+1+i-j,j) = A(i,j) for max(1,j-ka)<=i<=j;
- * if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+ka).
- *
- * On exit, the contents of AB are destroyed.
- *
- * LDAB (input) INTEGER
- * The leading dimension of the array AB. LDAB >= KA+1.
- *
- * BB (input/output) DOUBLE PRECISION array, dimension (LDBB, N)
- * On entry, the upper or lower triangle of the symmetric band
- * matrix B, stored in the first kb+1 rows of the array. The
- * j-th column of B is stored in the j-th column of the array BB
- * as follows:
- * if UPLO = 'U', BB(kb+1+i-j,j) = B(i,j) for max(1,j-kb)<=i<=j;
- * if UPLO = 'L', BB(1+i-j,j) = B(i,j) for j<=i<=min(n,j+kb).
- *
- * On exit, the factor S from the split Cholesky factorization
- * B = S**T*S, as returned by DPBSTF.
- *
- * LDBB (input) INTEGER
- * The leading dimension of the array BB. LDBB >= KB+1.
- *
- * W (output) DOUBLE PRECISION array, dimension (N)
- * If INFO = 0, the eigenvalues in ascending order.
- *
- * Z (output) DOUBLE PRECISION array, dimension (LDZ, N)
- * If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
- * eigenvectors, with the i-th column of Z holding the
- * eigenvector associated with W(i). The eigenvectors are
- * normalized so that Z**T*B*Z = I.
- * If JOBZ = 'N', then Z is not referenced.
- *
- * LDZ (input) INTEGER
- * The leading dimension of the array Z. LDZ >= 1, and if
- * JOBZ = 'V', LDZ >= N.
- *
- * WORK (workspace) DOUBLE PRECISION array, dimension (3*N)
- *
- * C++ Return value: INFO (output) INTEGER
- * = 0: successful exit
- * < 0: if INFO = -i, the i-th argument had an illegal value
- * > 0: if INFO = i, and i is:
- * <= N: the algorithm failed to converge:
- * i off-diagonal elements of an intermediate
- * tridiagonal form did not converge to zero;
- * > N: if INFO = N + i, for 1 <= i <= N, then DPBSTF
- * returned INFO = i: B is not positive definite.
- * The factorization of B could not be completed and
- * no eigenvalues or eigenvectors were computed.
- *
- * =====================================================================
- *
- * .. Local Scalars ..
- **/
- int C_DSBGV(char jobz, char uplo, int n, int ka, int kb, double* ab, int ldab, double* bb, int ldbb, double* w, double* z, int ldz, double* work)
- {
- int info;
- ::F_DSBGV(&jobz, &uplo, &n, &ka, &kb, ab, &ldab, bb, &ldbb, w, z, &ldz, work, &info);
- return info;
- }
- /**
- * Purpose
- * =======
- *
- * DSBGVD computes all the eigenvalues, and optionally, the eigenvectors
- * of a real generalized symmetric-definite banded eigenproblem, of the
- * form A*x=(lambda)*B*x. Here A and B are assumed to be symmetric and
- * banded, and B is also positive definite. If eigenvectors are
- * desired, it uses a divide and conquer algorithm.
- *
- * The divide and conquer algorithm makes very mild assumptions about
- * floating point arithmetic. It will work on machines with a guard
- * digit in add/subtract, or on those binary machines without guard
- * digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or
- * Cray-2. It could conceivably fail on hexadecimal or decimal machines
- * withou