LAPACK++  2022.05.00
LAPACK C++ API
Initialize, copy, convert matrices

Functions

void lapack::lacpy (lapack::MatrixType matrixtype, int64_t m, int64_t n, double const *A, int64_t lda, double *B, int64_t ldb)
 
void lapack::lacpy (lapack::MatrixType matrixtype, int64_t m, int64_t n, float const *A, int64_t lda, float *B, int64_t ldb)
 
void lapack::lacpy (lapack::MatrixType matrixtype, int64_t m, int64_t n, std::complex< double > const *A, int64_t lda, std::complex< double > *B, int64_t ldb)
 Copies all or part of a two-dimensional matrix A to another matrix B. More...
 
void lapack::lacpy (lapack::MatrixType matrixtype, int64_t m, int64_t n, std::complex< float > const *A, int64_t lda, std::complex< float > *B, int64_t ldb)
 
void lapack::larnv (int64_t idist, int64_t *iseed, int64_t n, double *X)
 
void lapack::larnv (int64_t idist, int64_t *iseed, int64_t n, float *X)
 
void lapack::larnv (int64_t idist, int64_t *iseed, int64_t n, std::complex< double > *X)
 Returns a vector of n random complex numbers from a uniform or normal distribution. More...
 
void lapack::larnv (int64_t idist, int64_t *iseed, int64_t n, std::complex< float > *X)
 
void lapack::laset (lapack::MatrixType matrixtype, int64_t m, int64_t n, double offdiag, double diag, double *A, int64_t lda)
 
void lapack::laset (lapack::MatrixType matrixtype, int64_t m, int64_t n, float offdiag, float diag, float *A, int64_t lda)
 
void lapack::laset (lapack::MatrixType matrixtype, int64_t m, int64_t n, std::complex< double > offdiag, std::complex< double > diag, std::complex< double > *A, int64_t lda)
 Initializes a 2-D array A to diag on the diagonal and offdiag on the offdiagonals. More...
 
void lapack::laset (lapack::MatrixType matrixtype, int64_t m, int64_t n, std::complex< float > offdiag, std::complex< float > diag, std::complex< float > *A, int64_t lda)
 

Detailed Description

Function Documentation

◆ lacpy()

void lapack::lacpy ( lapack::MatrixType  matrixtype,
int64_t  m,
int64_t  n,
std::complex< double > const *  A,
int64_t  lda,
std::complex< double > *  B,
int64_t  ldb 
)

Copies all or part of a two-dimensional matrix A to another matrix B.

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

Parameters
[in]matrixtypeSpecifies the part of the matrix A to be copied to B.
  • lapack::MatrixType::Upper: Upper triangular part
  • lapack::MatrixType::Lower: Lower triangular part
  • lapack::MatrixType::General: All of the matrix A
[in]mThe number of rows of the matrix A. m >= 0.
[in]nThe number of columns of the matrix A. n >= 0.
[in]AThe m-by-n matrix A, stored in an lda-by-n array. The m-by-n matrix A.
  • If matrixtype = Upper, only the upper trapezium is accessed;
  • if matrixtype = Lower, only the lower trapezium is accessed.
[in]ldaThe leading dimension of the array A. lda >= max(1,m).
[out]BThe m-by-n matrix B, stored in an ldb-by-n array. On exit, \(B = A\) in the locations specified by matrixtype.
[in]ldbThe leading dimension of the array B. ldb >= max(1,m).

◆ larnv()

void lapack::larnv ( int64_t  idist,
int64_t *  iseed,
int64_t  n,
std::complex< double > *  X 
)

Returns a vector of n random complex numbers from a uniform or normal distribution.

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

Parameters
[in]idistThe distribution of the random numbers:
  • 1: real and imaginary parts each uniform (0,1)
  • 2: real and imaginary parts each uniform (-1,1)
  • 3: real and imaginary parts each normal (0,1)
  • 4: uniformly distributed on the disc abs(z) < 1
  • 5: uniformly distributed on the circle abs(z) = 1
[in,out]iseedThe vector iseed of length 4. On entry, the seed of the random number generator; the array elements must be between 0 and 4095, and iseed(4) must be odd. On exit, the seed is updated.
[in]nThe number of random numbers to be generated.
[out]XThe vector X of length n. The generated random numbers.
Further Details

This routine calls the auxiliary routine lapack::laruv to generate random real numbers from a uniform (0,1) distribution, in batches of up to 128 using vectorisable code. The Box-Muller method is used to transform numbers from a uniform to a normal distribution.

◆ laset()

void lapack::laset ( lapack::MatrixType  matrixtype,
int64_t  m,
int64_t  n,
std::complex< double >  offdiag,
std::complex< double >  diag,
std::complex< double > *  A,
int64_t  lda 
)

Initializes a 2-D array A to diag on the diagonal and offdiag on the offdiagonals.

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

Parameters
[in]matrixtypeSpecifies the part of the matrix A to be set.
  • lapack::MatrixType::Upper: Upper triangular part is set. The lower triangle is unchanged.
  • lapack::MatrixType::Lower: Lower triangular part is set. The upper triangle is unchanged.
  • lapack::MatrixType::General: All of the matrix A is set.
[in]mOn entry, m specifies the number of rows of A.
[in]nOn entry, n specifies the number of columns of A.
[in]offdiagAll the offdiagonal array elements are set to offdiag.
[in]diagAll the diagonal array elements are set to diag.
[out]AThe m-by-n matrix A, stored in an lda-by-n array. On entry, the m-by-n matrix A. On exit,
  • A(i,j) = offdiag, 1 <= i <= m, 1 <= j <= n, i != j;
  • A(i,i) = diag, 1 <= i <= min(m,n)
[in]ldaThe leading dimension of the array A. lda >= max(1,m).