gonum.org/v1/gonum@v0.15.1-0.20240517103525-f853624cb1bb/lapack/lapack.go (about) 1 // Copyright ©2015 The Gonum Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package lapack 6 7 import "gonum.org/v1/gonum/blas" 8 9 // Complex128 defines the public complex128 LAPACK API supported by gonum/lapack. 10 type Complex128 interface{} 11 12 // Float64 defines the public float64 LAPACK API supported by gonum/lapack. 13 type Float64 interface { 14 Dgecon(norm MatrixNorm, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64 15 Dgeev(jobvl LeftEVJob, jobvr RightEVJob, n int, a []float64, lda int, wr, wi []float64, vl []float64, ldvl int, vr []float64, ldvr int, work []float64, lwork int) (first int) 16 Dgels(trans blas.Transpose, m, n, nrhs int, a []float64, lda int, b []float64, ldb int, work []float64, lwork int) bool 17 Dgelqf(m, n int, a []float64, lda int, tau, work []float64, lwork int) 18 Dgeqp3(m, n int, a []float64, lda int, jpvt []int, tau, work []float64, lwork int) 19 Dgeqrf(m, n int, a []float64, lda int, tau, work []float64, lwork int) 20 Dgesvd(jobU, jobVT SVDJob, m, n int, a []float64, lda int, s, u []float64, ldu int, vt []float64, ldvt int, work []float64, lwork int) (ok bool) 21 Dgetrf(m, n int, a []float64, lda int, ipiv []int) (ok bool) 22 Dgetri(n int, a []float64, lda int, ipiv []int, work []float64, lwork int) (ok bool) 23 Dgetrs(trans blas.Transpose, n, nrhs int, a []float64, lda int, ipiv []int, b []float64, ldb int) 24 Dggsvd3(jobU, jobV, jobQ GSVDJob, m, n, p int, a []float64, lda int, b []float64, ldb int, alpha, beta, u []float64, ldu int, v []float64, ldv int, q []float64, ldq int, work []float64, lwork int, iwork []int) (k, l int, ok bool) 25 Dlantr(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, m, n int, a []float64, lda int, work []float64) float64 26 Dlange(norm MatrixNorm, m, n int, a []float64, lda int, work []float64) float64 27 Dlansy(norm MatrixNorm, uplo blas.Uplo, n int, a []float64, lda int, work []float64) float64 28 Dlapmr(forward bool, m, n int, x []float64, ldx int, k []int) 29 Dlapmt(forward bool, m, n int, x []float64, ldx int, k []int) 30 Dorgqr(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) 31 Dormqr(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int) 32 Dorglq(m, n, k int, a []float64, lda int, tau, work []float64, lwork int) 33 Dormlq(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int) 34 Dpbcon(uplo blas.Uplo, n, kd int, ab []float64, ldab int, anorm float64, work []float64, iwork []int) float64 35 Dpbtrf(uplo blas.Uplo, n, kd int, ab []float64, ldab int) (ok bool) 36 Dpbtrs(uplo blas.Uplo, n, kd, nrhs int, ab []float64, ldab int, b []float64, ldb int) 37 Dpocon(uplo blas.Uplo, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64 38 Dpotrf(ul blas.Uplo, n int, a []float64, lda int) (ok bool) 39 Dpotri(ul blas.Uplo, n int, a []float64, lda int) (ok bool) 40 Dpotrs(ul blas.Uplo, n, nrhs int, a []float64, lda int, b []float64, ldb int) 41 Dpstrf(uplo blas.Uplo, n int, a []float64, lda int, piv []int, tol float64, work []float64) (rank int, ok bool) 42 Dsyev(jobz EVJob, uplo blas.Uplo, n int, a []float64, lda int, w, work []float64, lwork int) (ok bool) 43 Dtbtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, kd, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool) 44 Dtrcon(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int, work []float64, iwork []int) float64 45 Dtrtri(uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int) (ok bool) 46 Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool) 47 } 48 49 // Direct specifies the direction of the multiplication for the Householder matrix. 50 type Direct byte 51 52 const ( 53 Forward Direct = 'F' // Reflectors are right-multiplied, H_0 * H_1 * ... * H_{k-1}. 54 Backward Direct = 'B' // Reflectors are left-multiplied, H_{k-1} * ... * H_1 * H_0. 55 ) 56 57 // Sort is the sorting order. 58 type Sort byte 59 60 const ( 61 SortIncreasing Sort = 'I' 62 SortDecreasing Sort = 'D' 63 ) 64 65 // StoreV indicates the storage direction of elementary reflectors. 66 type StoreV byte 67 68 const ( 69 ColumnWise StoreV = 'C' // Reflector stored in a column of the matrix. 70 RowWise StoreV = 'R' // Reflector stored in a row of the matrix. 71 ) 72 73 // MatrixNorm represents the kind of matrix norm to compute. 74 type MatrixNorm byte 75 76 const ( 77 MaxAbs MatrixNorm = 'M' // max(abs(A(i,j))) 78 MaxColumnSum MatrixNorm = 'O' // Maximum absolute column sum (one norm) 79 MaxRowSum MatrixNorm = 'I' // Maximum absolute row sum (infinity norm) 80 Frobenius MatrixNorm = 'F' // Frobenius norm (sqrt of sum of squares) 81 ) 82 83 // MatrixType represents the kind of matrix represented in the data. 84 type MatrixType byte 85 86 const ( 87 General MatrixType = 'G' // A general dense matrix. 88 UpperTri MatrixType = 'U' // An upper triangular matrix. 89 LowerTri MatrixType = 'L' // A lower triangular matrix. 90 ) 91 92 // Pivot specifies the pivot type for plane rotations. 93 type Pivot byte 94 95 const ( 96 Variable Pivot = 'V' 97 Top Pivot = 'T' 98 Bottom Pivot = 'B' 99 ) 100 101 // ApplyOrtho specifies which orthogonal matrix is applied in Dormbr. 102 type ApplyOrtho byte 103 104 const ( 105 ApplyP ApplyOrtho = 'P' // Apply P or Pᵀ. 106 ApplyQ ApplyOrtho = 'Q' // Apply Q or Qᵀ. 107 ) 108 109 // GenOrtho specifies which orthogonal matrix is generated in Dorgbr. 110 type GenOrtho byte 111 112 const ( 113 GeneratePT GenOrtho = 'P' // Generate Pᵀ. 114 GenerateQ GenOrtho = 'Q' // Generate Q. 115 ) 116 117 // SVDJob specifies the singular vector computation type for SVD. 118 type SVDJob byte 119 120 const ( 121 SVDAll SVDJob = 'A' // Compute all columns of the orthogonal matrix U or V. 122 SVDStore SVDJob = 'S' // Compute the singular vectors and store them in the orthogonal matrix U or V. 123 SVDOverwrite SVDJob = 'O' // Compute the singular vectors and overwrite them on the input matrix A. 124 SVDNone SVDJob = 'N' // Do not compute singular vectors. 125 ) 126 127 // GSVDJob specifies the singular vector computation type for Generalized SVD. 128 type GSVDJob byte 129 130 const ( 131 GSVDU GSVDJob = 'U' // Compute orthogonal matrix U. 132 GSVDV GSVDJob = 'V' // Compute orthogonal matrix V. 133 GSVDQ GSVDJob = 'Q' // Compute orthogonal matrix Q. 134 GSVDUnit GSVDJob = 'I' // Use unit-initialized matrix. 135 GSVDNone GSVDJob = 'N' // Do not compute orthogonal matrix. 136 ) 137 138 // EVComp specifies how eigenvectors are computed in Dsteqr. 139 type EVComp byte 140 141 const ( 142 EVOrig EVComp = 'V' // Compute eigenvectors of the original symmetric matrix. 143 EVTridiag EVComp = 'I' // Compute eigenvectors of the tridiagonal matrix. 144 EVCompNone EVComp = 'N' // Do not compute eigenvectors. 145 ) 146 147 // EVJob specifies whether eigenvectors are computed in Dsyev. 148 type EVJob byte 149 150 const ( 151 EVCompute EVJob = 'V' // Compute eigenvectors. 152 EVNone EVJob = 'N' // Do not compute eigenvectors. 153 ) 154 155 // LeftEVJob specifies whether left eigenvectors are computed in Dgeev. 156 type LeftEVJob byte 157 158 const ( 159 LeftEVCompute LeftEVJob = 'V' // Compute left eigenvectors. 160 LeftEVNone LeftEVJob = 'N' // Do not compute left eigenvectors. 161 ) 162 163 // RightEVJob specifies whether right eigenvectors are computed in Dgeev. 164 type RightEVJob byte 165 166 const ( 167 RightEVCompute RightEVJob = 'V' // Compute right eigenvectors. 168 RightEVNone RightEVJob = 'N' // Do not compute right eigenvectors. 169 ) 170 171 // BalanceJob specifies matrix balancing operation. 172 type BalanceJob byte 173 174 const ( 175 Permute BalanceJob = 'P' 176 Scale BalanceJob = 'S' 177 PermuteScale BalanceJob = 'B' 178 BalanceNone BalanceJob = 'N' 179 ) 180 181 // SchurJob specifies whether the Schur form is computed in Dhseqr. 182 type SchurJob byte 183 184 const ( 185 EigenvaluesOnly SchurJob = 'E' 186 EigenvaluesAndSchur SchurJob = 'S' 187 ) 188 189 // SchurComp specifies whether and how the Schur vectors are computed in Dhseqr. 190 type SchurComp byte 191 192 const ( 193 SchurOrig SchurComp = 'V' // Compute Schur vectors of the original matrix. 194 SchurHess SchurComp = 'I' // Compute Schur vectors of the upper Hessenberg matrix. 195 SchurNone SchurComp = 'N' // Do not compute Schur vectors. 196 ) 197 198 // UpdateSchurComp specifies whether the matrix of Schur vectors is updated in Dtrexc. 199 type UpdateSchurComp byte 200 201 const ( 202 UpdateSchur UpdateSchurComp = 'V' // Update the matrix of Schur vectors. 203 UpdateSchurNone UpdateSchurComp = 'N' // Do not update the matrix of Schur vectors. 204 ) 205 206 // EVSide specifies what eigenvectors are computed in Dtrevc3. 207 type EVSide byte 208 209 const ( 210 EVRight EVSide = 'R' // Compute only right eigenvectors. 211 EVLeft EVSide = 'L' // Compute only left eigenvectors. 212 EVBoth EVSide = 'B' // Compute both right and left eigenvectors. 213 ) 214 215 // EVHowMany specifies which eigenvectors are computed in Dtrevc3 and how. 216 type EVHowMany byte 217 218 const ( 219 EVAll EVHowMany = 'A' // Compute all right and/or left eigenvectors. 220 EVAllMulQ EVHowMany = 'B' // Compute all right and/or left eigenvectors multiplied by an input matrix. 221 EVSelected EVHowMany = 'S' // Compute selected right and/or left eigenvectors. 222 ) 223 224 // MaximizeNormXJob specifies the heuristic method for computing a contribution to 225 // the reciprocal Dif-estimate in Dlatdf. 226 type MaximizeNormXJob byte 227 228 const ( 229 LocalLookAhead MaximizeNormXJob = 0 // Solve Z*x=h-f where h is a vector of ±1. 230 NormalizedNullVector MaximizeNormXJob = 2 // Compute an approximate null-vector e of Z, normalize e and solve Z*x=±e-f. 231 ) 232 233 // OrthoComp specifies whether and how the orthogonal matrix is computed in Dgghrd. 234 type OrthoComp byte 235 236 const ( 237 OrthoNone OrthoComp = 'N' // Do not compute the orthogonal matrix. 238 OrthoExplicit OrthoComp = 'I' // The orthogonal matrix is formed explicitly and returned in the argument. 239 OrthoPostmul OrthoComp = 'V' // The orthogonal matrix is post-multiplied into the matrix stored in the argument on entry. 240 )