LAPACK++
LAPACK C++ API

Functions

int64_t lapack::gbbrd (lapack::Vect vect, int64_t m, int64_t n, int64_t ncc, int64_t kl, int64_t ku, double *AB, int64_t ldab, double *D, double *E, double *Q, int64_t ldq, double *PT, int64_t ldpt, double *C, int64_t ldc)
 
int64_t lapack::gbbrd (lapack::Vect vect, int64_t m, int64_t n, int64_t ncc, int64_t kl, int64_t ku, float *AB, int64_t ldab, float *D, float *E, float *Q, int64_t ldq, float *PT, int64_t ldpt, float *C, int64_t ldc)
 
int64_t lapack::gbbrd (lapack::Vect vect, int64_t m, int64_t n, int64_t ncc, int64_t kl, int64_t ku, std::complex< double > *AB, int64_t ldab, double *D, double *E, std::complex< double > *Q, int64_t ldq, std::complex< double > *PT, int64_t ldpt, std::complex< double > *C, int64_t ldc)
 Reduces a general m-by-n band matrix A to real upper bidiagonal form B by a unitary transformation: \(Q^H A P = B\). More...
 
int64_t lapack::gbbrd (lapack::Vect vect, int64_t m, int64_t n, int64_t ncc, int64_t kl, int64_t ku, std::complex< float > *AB, int64_t ldab, float *D, float *E, std::complex< float > *Q, int64_t ldq, std::complex< float > *PT, int64_t ldpt, std::complex< float > *C, int64_t ldc)
 
int64_t lapack::gebrd (int64_t m, int64_t n, double *A, int64_t lda, double *D, double *E, double *tauq, double *taup)
 
int64_t lapack::gebrd (int64_t m, int64_t n, float *A, int64_t lda, float *D, float *E, float *tauq, float *taup)
 
int64_t lapack::gebrd (int64_t m, int64_t n, std::complex< double > *A, int64_t lda, double *D, double *E, std::complex< double > *tauq, std::complex< double > *taup)
 Reduces a general m-by-n matrix A to upper or lower bidiagonal form B by a unitary transformation: \(Q^H A P = B\). More...
 
int64_t lapack::gebrd (int64_t m, int64_t n, std::complex< float > *A, int64_t lda, float *D, float *E, std::complex< float > *tauq, std::complex< float > *taup)
 
int64_t lapack::orgbr (lapack::Vect vect, int64_t m, int64_t n, int64_t k, double *A, int64_t lda, double const *tau)
 
int64_t lapack::orgbr (lapack::Vect vect, int64_t m, int64_t n, int64_t k, float *A, int64_t lda, float const *tau)
 
int64_t lapack::ormbr (lapack::Vect vect, lapack::Side side, lapack::Op trans, int64_t m, int64_t n, int64_t k, double const *A, int64_t lda, double const *tau, double *C, int64_t ldc)
 
int64_t lapack::ormbr (lapack::Vect vect, lapack::Side side, lapack::Op trans, int64_t m, int64_t n, int64_t k, float const *A, int64_t lda, float const *tau, float *C, int64_t ldc)
 
int64_t lapack::ungbr (lapack::Vect vect, int64_t m, int64_t n, int64_t k, std::complex< double > *A, int64_t lda, std::complex< double > const *tau)
 Generates one of the complex unitary matrices \(Q\) or \(P^H\) determined by lapack::gebrd when reducing a complex matrix A to bidiagonal form: \(A = Q B P^H.\) \(Q\) and \(P^H\) are defined as products of elementary reflectors H(i) or G(i) respectively. More...
 
int64_t lapack::ungbr (lapack::Vect vect, int64_t m, int64_t n, int64_t k, std::complex< float > *A, int64_t lda, std::complex< float > const *tau)
 
int64_t lapack::unmbr (lapack::Vect vect, lapack::Side side, lapack::Op trans, int64_t m, int64_t n, int64_t k, std::complex< double > const *A, int64_t lda, std::complex< double > const *tau, std::complex< double > *C, int64_t ldc)
 Multiplies the general m-by-n matrix C by P or Q from lapack::gebrd as follows: More...
 
int64_t lapack::unmbr (lapack::Vect vect, lapack::Side side, lapack::Op trans, int64_t m, int64_t n, int64_t k, std::complex< float > const *A, int64_t lda, std::complex< float > const *tau, std::complex< float > *C, int64_t ldc)
 

Detailed Description

Function Documentation

◆ gbbrd()

int64_t lapack::gbbrd ( lapack::Vect  vect,
int64_t  m,
int64_t  n,
int64_t  ncc,
int64_t  kl,
int64_t  ku,
std::complex< double > *  AB,
int64_t  ldab,
double *  D,
double *  E,
std::complex< double > *  Q,
int64_t  ldq,
std::complex< double > *  PT,
int64_t  ldpt,
std::complex< double > *  C,
int64_t  ldc 
)

Reduces a general m-by-n band matrix A to real upper bidiagonal form B by a unitary transformation: \(Q^H A P = B\).

The routine computes B, and optionally forms \(Q\) or \(P^H\), or computes \(Q^H C\) for a given matrix C.

Overloaded versions are available for float, double, std::complex<float>, and std::complex<double>.

Parameters
[in]vectWhether or not the matrices Q and P^H are to be formed.
  • lapack::Vect::None: do not form \(Q\) or \(P^H\);
  • lapack::Vect::Q: form \(Q\) only;
  • lapack::Vect::P: form \(P^H\) only;
  • lapack::Vect::Both: form both.
[in]mThe number of rows of the matrix A. m >= 0.
[in]nThe number of columns of the matrix A. n >= 0.
[in]nccThe number of columns of the matrix C. ncc >= 0.
[in]klThe number of subdiagonals of the matrix A. kl >= 0.
[in]kuThe number of superdiagonals of the matrix A. ku >= 0.
[in,out]ABThe m-by-n band matrix AB, stored in an ldab-by-n array. 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.
[in]ldabThe leading dimension of the array A. ldab >= kl+ku+1.
[out]DThe vector D of length min(m,n). The diagonal elements of the bidiagonal matrix B.
[out]EThe vector E of length min(m,n)-1. The superdiagonal elements of the bidiagonal matrix B.
[out]QThe m-by-m matrix Q, stored in an ldq-by-m array.
  • If vect = Q or Both, the m-by-m unitary matrix Q.
  • If vect = None or P, the array Q is not referenced.
[in]ldqThe leading dimension of the array Q.
  • If vect = Q or Both, ldq >= max(1,m);
  • otherwise, ldq >= 1.
[out]PTThe n-by-n matrix PT, stored in an ldpt-by-n array.
  • If vect = P or Both, the n-by-n unitary matrix \(P^H\);
  • If vect = None or Q, the array PT is not referenced.
[in]ldptThe leading dimension of the array PT.
  • If vect = P or Both, ldpt >= max(1,n);
  • otherwise, ldpt >= 1.
[in,out]CThe m-by-ncc matrix C, stored in an ldc-by-ncc array. On entry, an m-by-ncc matrix C. On exit, C is overwritten by \(Q^H C\). C is not referenced if ncc = 0.
[in]ldcThe leading dimension of the array C.
  • If ncc > 0, ldc >= max(1,m);
  • if ncc = 0, ldc >= 1.
Returns
= 0: successful exit.

◆ gebrd()

int64_t lapack::gebrd ( int64_t  m,
int64_t  n,
std::complex< double > *  A,
int64_t  lda,
double *  D,
double *  E,
std::complex< double > *  tauq,
std::complex< double > *  taup 
)

Reduces a general m-by-n matrix A to upper or lower bidiagonal form B by a unitary transformation: \(Q^H A P = B\).

If m >= n, B is upper bidiagonal; if m < n, B is lower bidiagonal.

Overloaded versions are available for float, double, std::complex<float>, and std::complex<double>.

Parameters
[in]mThe number of rows in the matrix A. m >= 0.
[in]nThe number of columns in the matrix A. n >= 0.
[in,out]AThe m-by-n matrix A, stored in an lda-by-n array. 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 unitary matrix Q as a product of elementary reflectors, and the elements above the first superdiagonal, with the array taup, represent the unitary 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 unitary matrix Q as a product of elementary reflectors, and the elements above the diagonal, with the array taup, represent the unitary matrix P as a product of elementary reflectors. See Further Details.
[in]ldaThe leading dimension of the array A. lda >= max(1,m).
[out]DThe vector D of length min(m,n). The diagonal elements of the bidiagonal matrix B: D(i) = A(i,i).
[out]EThe vector E of length 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.
[out]tauqThe vector tauq of length min(m,n). The scalar factors of the elementary reflectors which represent the unitary matrix Q. See Further Details.
[out]taupThe vector taup of length min(m,n). The scalar factors of the elementary reflectors which represent the unitary matrix P. See Further Details.
Returns
= 0: successful exit.
Further Details

The matrices Q and P are represented as products of elementary reflectors:

If m >= n,

\[ Q = H(1) H(2) . . . H(n) \]

\[ P = G(1) G(2) . . . G(n-1). \]

Each H(i) and G(i) has the form:

\[ H(i) = I - \tau_q v v^H \]

and

\[ G(i) = I - \tau_p u u^H \]

where \(\tau_q\) and \(\tau_p\) are scalars, and v and u are 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); \(\tau_q\) is stored in tauq(i) and \(\tau_p\) 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 - \tau_q v v^H \]

and

\[ G(i) = I - \tau_p u u^H \]

where \(\tau_q\) and \(\tau_p\) are scalars, and v and u are 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); \(\tau_q\) is stored in tauq(i) and \(\tau_p\) 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).

◆ orgbr()

int64_t lapack::orgbr ( lapack::Vect  vect,
int64_t  m,
int64_t  n,
int64_t  k,
double *  A,
int64_t  lda,
double const *  tau 
)
See also
lapack::ungbr

◆ ormbr()

int64_t lapack::ormbr ( lapack::Vect  vect,
lapack::Side  side,
lapack::Op  trans,
int64_t  m,
int64_t  n,
int64_t  k,
double const *  A,
int64_t  lda,
double const *  tau,
double *  C,
int64_t  ldc 
)
See also
lapack::unmbr

◆ ungbr()

int64_t lapack::ungbr ( lapack::Vect  vect,
int64_t  m,
int64_t  n,
int64_t  k,
std::complex< double > *  A,
int64_t  lda,
std::complex< double > const *  tau 
)

Generates one of the complex unitary matrices \(Q\) or \(P^H\) determined by lapack::gebrd when reducing a complex matrix A to bidiagonal form: \(A = Q B P^H.\) \(Q\) and \(P^H\) 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) \dots H(k)\) and ungbr returns the first n columns of Q, where m >= n >= k;
    • if m < k, \(Q = H(1) H(2) \dots H(m-1)\) and ungbr returns Q as an m-by-m matrix.
  • If vect = P, A is assumed to have been a k-by-n matrix, and \(P^H\) is of order n:
    • if k < n, \(P^H = G(k) \dots G(2) G(1)\) and ungbr returns the first m rows of \(P^H,\) where n >= m >= k;
    • if k >= n, \(P^H = G(n-1) \dots G(2) G(1)\) and ungbr returns \(P^H\) as an n-by-n matrix.

Overloaded versions are available for float, double, std::complex<float>, and std::complex<double>. For real matrices, this is an alias for lapack::orgbr.

Parameters
[in]vectSpecifies whether the matrix \(Q\) or the matrix \(P^H\) is required, as defined in the transformation applied by lapack::gebrd:
  • lapack::Vect::Q: generate \(Q;\)
  • lapack::Vect::P: generate \(P^H,\)
[in]mThe number of rows of the matrix Q or \(P^H\) to be returned. m >= 0.
[in]nThe number of columns of the matrix Q or \(P^H\) to be returned. n >= 0.
  • If vect = Q, m >= n >= min(m,k);
  • if vect = P, n >= m >= min(n,k).
[in]k
  • If vect = Q, the number of columns in the original m-by-k matrix reduced by lapack::gebrd.
  • If vect = P, the number of rows in the original k-by-n matrix reduced by lapack::gebrd.
  • k >= 0.
[in,out]AThe m-by-n matrix A, stored in an lda-by-n array. On entry, the vectors which define the elementary reflectors, as returned by lapack::gebrd. On exit, the m-by-n matrix \(Q\) or \(P^H,\)
[in]ldaThe leading dimension of the array A. lda >= m.
[in]tautau(i) must contain the scalar factor of the elementary reflector H(i) or G(i), which determines \(Q\) or \(P^H,\) as returned by lapack::gebrd in its array argument tauq or taup.
  • If vect = Q, the vector tau of length min(m,k);
  • if vect = P, the vector tau of length min(n,k).
Returns
= 0: successful exit

◆ unmbr()

int64_t lapack::unmbr ( lapack::Vect  vect,
lapack::Side  side,
lapack::Op  trans,
int64_t  m,
int64_t  n,
int64_t  k,
std::complex< double > const *  A,
int64_t  lda,
std::complex< double > const *  tau,
std::complex< double > *  C,
int64_t  ldc 
)

Multiplies the general m-by-n matrix C by P or Q from lapack::gebrd as follows:

  • If vect = Q:
    • side = Left, trans = NoTrans: \(Q C\)
    • side = Right, trans = NoTrans: \(C Q\)
    • side = Left, trans = ConjTrans: \(Q^H C\)
    • side = Right, trans = ConjTrans: \(C Q^H\)
  • If vect = P:
    • side = Left, trans = NoTrans: \(P C\)
    • side = Right, trans = NoTrans: \(C P\)
    • side = Left, trans = ConjTrans: \(P^H C\)
    • side = Right, trans = ConjTrans: \(C P^H\)

Here \(Q\) and \(P^H\) are the unitary matrices determined by lapack::gebrd when reducing a complex matrix A to bidiagonal form: \(A = Q B P^H\). \(Q\) and \(P^H\) are defined as products of elementary reflectors H(i) and G(i) respectively.

Let nq = m if side = Left and nq = n if side = Right. Thus nq is the order of the unitary matrix \(Q\) or \(P^H\) 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) \dots H(k)\);
    • if nq < k, \(Q = H(1) H(2) \dots 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) \dots G(k)\);
    • if k >= nq, \(P = G(1) G(2) \dots G(nq-1)\).

Overloaded versions are available for float, double, std::complex<float>, and std::complex<double>. For real matrices, this is an alias for lapack::ormbr.

Parameters
[in]vect
  • lapack::Vect::Q: apply \(Q\) or \(Q^H\);
  • lapack::Vect::P: apply \(P\) or \(P^H\).
[in]side
  • lapack::Side::Left: apply \(Q\), \(Q^H\), \(P\), or \(P^H\) from the Left;
  • lapack::Side::Right: apply \(Q\), \(Q^H\), \(P\), or \(P^H\) from the Right.
[in]trans
  • lapack::Op::NoTrans: No transpose, apply \(Q\) or \(P\);
  • lapack::Op::ConjTrans: Conjugate transpose, apply \(Q^H\) or \(P^H\).
[in]mThe number of rows of the matrix C. m >= 0.
[in]nThe number of columns of the matrix C. n >= 0.
[in]k
  • If vect = Q, the number of columns in the original matrix reduced by lapack::gebrd.
  • If vect = P, the number of rows in the original matrix reduced by lapack::gebrd.
  • k >= 0.
[in]AThe vector A of length lda,min(nq,k) if vect = Q; lda,nq if vect = P. (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 lapack::gebrd.
  • If vect = Q, the nq-by-min(nq,k) matrix A, stored in an lda-by-min(nq,k) array.
  • if vect = P, the min(nq,k)-by-nq matrix A, stored in an lda-by-nq array.
[in]ldaThe leading dimension of the array A.
  • If vect = Q, lda >= max(1,nq);
  • if vect = P, lda >= max(1,min(nq,k)).
[in]tauThe vector tau of length 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 lapack::gebrd in the array argument tauq or taup.
[in,out]CThe m-by-n matrix C, stored in an ldc-by-n array. On entry, the m-by-n matrix C. On exit, C is overwritten by one of \(Q C\), \(Q^H C\), \(C Q^H\), \(C Q\), \(P C\), \(P^H C\), \(C P^H\), or \(C P\).
[in]ldcThe leading dimension of the array C. ldc >= max(1,m).
Returns
= 0: successful exit