lapack.go 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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. package lapack
  5. import "gonum.org/v1/gonum/blas"
  6. // Complex128 defines the public complex128 LAPACK API supported by gonum/lapack.
  7. type Complex128 interface{}
  8. // Float64 defines the public float64 LAPACK API supported by gonum/lapack.
  9. type Float64 interface {
  10. Dgecon(norm MatrixNorm, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64
  11. 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)
  12. Dgels(trans blas.Transpose, m, n, nrhs int, a []float64, lda int, b []float64, ldb int, work []float64, lwork int) bool
  13. Dgelqf(m, n int, a []float64, lda int, tau, work []float64, lwork int)
  14. Dgeqrf(m, n int, a []float64, lda int, tau, work []float64, lwork int)
  15. 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)
  16. Dgetrf(m, n int, a []float64, lda int, ipiv []int) (ok bool)
  17. Dgetri(n int, a []float64, lda int, ipiv []int, work []float64, lwork int) (ok bool)
  18. Dgetrs(trans blas.Transpose, n, nrhs int, a []float64, lda int, ipiv []int, b []float64, ldb int)
  19. 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)
  20. Dlantr(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, m, n int, a []float64, lda int, work []float64) float64
  21. Dlange(norm MatrixNorm, m, n int, a []float64, lda int, work []float64) float64
  22. Dlansy(norm MatrixNorm, uplo blas.Uplo, n int, a []float64, lda int, work []float64) float64
  23. Dlapmr(forward bool, m, n int, x []float64, ldx int, k []int)
  24. Dlapmt(forward bool, m, n int, x []float64, ldx int, k []int)
  25. Dormqr(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int)
  26. Dormlq(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int)
  27. Dpbcon(uplo blas.Uplo, n, kd int, ab []float64, ldab int, anorm float64, work []float64, iwork []int) float64
  28. Dpbtrf(uplo blas.Uplo, n, kd int, ab []float64, ldab int) (ok bool)
  29. Dpbtrs(uplo blas.Uplo, n, kd, nrhs int, ab []float64, ldab int, b []float64, ldb int)
  30. Dpocon(uplo blas.Uplo, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64
  31. Dpotrf(ul blas.Uplo, n int, a []float64, lda int) (ok bool)
  32. Dpotri(ul blas.Uplo, n int, a []float64, lda int) (ok bool)
  33. Dpotrs(ul blas.Uplo, n, nrhs int, a []float64, lda int, b []float64, ldb int)
  34. Dpstrf(uplo blas.Uplo, n int, a []float64, lda int, piv []int, tol float64, work []float64) (rank int, ok bool)
  35. Dsyev(jobz EVJob, uplo blas.Uplo, n int, a []float64, lda int, w, work []float64, lwork int) (ok bool)
  36. Dtbtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, kd, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool)
  37. Dtrcon(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int, work []float64, iwork []int) float64
  38. Dtrtri(uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int) (ok bool)
  39. Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool)
  40. }
  41. // Direct specifies the direction of the multiplication for the Householder matrix.
  42. type Direct byte
  43. const (
  44. Forward Direct = 'F' // Reflectors are right-multiplied, H_0 * H_1 * ... * H_{k-1}.
  45. Backward Direct = 'B' // Reflectors are left-multiplied, H_{k-1} * ... * H_1 * H_0.
  46. )
  47. // Sort is the sorting order.
  48. type Sort byte
  49. const (
  50. SortIncreasing Sort = 'I'
  51. SortDecreasing Sort = 'D'
  52. )
  53. // StoreV indicates the storage direction of elementary reflectors.
  54. type StoreV byte
  55. const (
  56. ColumnWise StoreV = 'C' // Reflector stored in a column of the matrix.
  57. RowWise StoreV = 'R' // Reflector stored in a row of the matrix.
  58. )
  59. // MatrixNorm represents the kind of matrix norm to compute.
  60. type MatrixNorm byte
  61. const (
  62. MaxAbs MatrixNorm = 'M' // max(abs(A(i,j)))
  63. MaxColumnSum MatrixNorm = 'O' // Maximum absolute column sum (one norm)
  64. MaxRowSum MatrixNorm = 'I' // Maximum absolute row sum (infinity norm)
  65. Frobenius MatrixNorm = 'F' // Frobenius norm (sqrt of sum of squares)
  66. )
  67. // MatrixType represents the kind of matrix represented in the data.
  68. type MatrixType byte
  69. const (
  70. General MatrixType = 'G' // A general dense matrix.
  71. UpperTri MatrixType = 'U' // An upper triangular matrix.
  72. LowerTri MatrixType = 'L' // A lower triangular matrix.
  73. )
  74. // Pivot specifies the pivot type for plane rotations.
  75. type Pivot byte
  76. const (
  77. Variable Pivot = 'V'
  78. Top Pivot = 'T'
  79. Bottom Pivot = 'B'
  80. )
  81. // ApplyOrtho specifies which orthogonal matrix is applied in Dormbr.
  82. type ApplyOrtho byte
  83. const (
  84. ApplyP ApplyOrtho = 'P' // Apply P or Pᵀ.
  85. ApplyQ ApplyOrtho = 'Q' // Apply Q or Qᵀ.
  86. )
  87. // GenOrtho specifies which orthogonal matrix is generated in Dorgbr.
  88. type GenOrtho byte
  89. const (
  90. GeneratePT GenOrtho = 'P' // Generate Pᵀ.
  91. GenerateQ GenOrtho = 'Q' // Generate Q.
  92. )
  93. // SVDJob specifies the singular vector computation type for SVD.
  94. type SVDJob byte
  95. const (
  96. SVDAll SVDJob = 'A' // Compute all columns of the orthogonal matrix U or V.
  97. SVDStore SVDJob = 'S' // Compute the singular vectors and store them in the orthogonal matrix U or V.
  98. SVDOverwrite SVDJob = 'O' // Compute the singular vectors and overwrite them on the input matrix A.
  99. SVDNone SVDJob = 'N' // Do not compute singular vectors.
  100. )
  101. // GSVDJob specifies the singular vector computation type for Generalized SVD.
  102. type GSVDJob byte
  103. const (
  104. GSVDU GSVDJob = 'U' // Compute orthogonal matrix U.
  105. GSVDV GSVDJob = 'V' // Compute orthogonal matrix V.
  106. GSVDQ GSVDJob = 'Q' // Compute orthogonal matrix Q.
  107. GSVDUnit GSVDJob = 'I' // Use unit-initialized matrix.
  108. GSVDNone GSVDJob = 'N' // Do not compute orthogonal matrix.
  109. )
  110. // EVComp specifies how eigenvectors are computed in Dsteqr.
  111. type EVComp byte
  112. const (
  113. EVOrig EVComp = 'V' // Compute eigenvectors of the original symmetric matrix.
  114. EVTridiag EVComp = 'I' // Compute eigenvectors of the tridiagonal matrix.
  115. EVCompNone EVComp = 'N' // Do not compute eigenvectors.
  116. )
  117. // EVJob specifies whether eigenvectors are computed in Dsyev.
  118. type EVJob byte
  119. const (
  120. EVCompute EVJob = 'V' // Compute eigenvectors.
  121. EVNone EVJob = 'N' // Do not compute eigenvectors.
  122. )
  123. // LeftEVJob specifies whether left eigenvectors are computed in Dgeev.
  124. type LeftEVJob byte
  125. const (
  126. LeftEVCompute LeftEVJob = 'V' // Compute left eigenvectors.
  127. LeftEVNone LeftEVJob = 'N' // Do not compute left eigenvectors.
  128. )
  129. // RightEVJob specifies whether right eigenvectors are computed in Dgeev.
  130. type RightEVJob byte
  131. const (
  132. RightEVCompute RightEVJob = 'V' // Compute right eigenvectors.
  133. RightEVNone RightEVJob = 'N' // Do not compute right eigenvectors.
  134. )
  135. // BalanceJob specifies matrix balancing operation.
  136. type BalanceJob byte
  137. const (
  138. Permute BalanceJob = 'P'
  139. Scale BalanceJob = 'S'
  140. PermuteScale BalanceJob = 'B'
  141. BalanceNone BalanceJob = 'N'
  142. )
  143. // SchurJob specifies whether the Schur form is computed in Dhseqr.
  144. type SchurJob byte
  145. const (
  146. EigenvaluesOnly SchurJob = 'E'
  147. EigenvaluesAndSchur SchurJob = 'S'
  148. )
  149. // SchurComp specifies whether and how the Schur vectors are computed in Dhseqr.
  150. type SchurComp byte
  151. const (
  152. SchurOrig SchurComp = 'V' // Compute Schur vectors of the original matrix.
  153. SchurHess SchurComp = 'I' // Compute Schur vectors of the upper Hessenberg matrix.
  154. SchurNone SchurComp = 'N' // Do not compute Schur vectors.
  155. )
  156. // UpdateSchurComp specifies whether the matrix of Schur vectors is updated in Dtrexc.
  157. type UpdateSchurComp byte
  158. const (
  159. UpdateSchur UpdateSchurComp = 'V' // Update the matrix of Schur vectors.
  160. UpdateSchurNone UpdateSchurComp = 'N' // Do not update the matrix of Schur vectors.
  161. )
  162. // EVSide specifies what eigenvectors are computed in Dtrevc3.
  163. type EVSide byte
  164. const (
  165. EVRight EVSide = 'R' // Compute only right eigenvectors.
  166. EVLeft EVSide = 'L' // Compute only left eigenvectors.
  167. EVBoth EVSide = 'B' // Compute both right and left eigenvectors.
  168. )
  169. // EVHowMany specifies which eigenvectors are computed in Dtrevc3 and how.
  170. type EVHowMany byte
  171. const (
  172. EVAll EVHowMany = 'A' // Compute all right and/or left eigenvectors.
  173. EVAllMulQ EVHowMany = 'B' // Compute all right and/or left eigenvectors multiplied by an input matrix.
  174. EVSelected EVHowMany = 'S' // Compute selected right and/or left eigenvectors.
  175. )
  176. // MaximizeNormX specifies the heuristic method for computing a contribution to
  177. // the reciprocal Dif-estimate in Dlatdf.
  178. type MaximizeNormXJob byte
  179. const (
  180. LocalLookAhead MaximizeNormXJob = 0 // Solve Z*x=h-f where h is a vector of ±1.
  181. NormalizedNullVector MaximizeNormXJob = 2 // Compute an approximate null-vector e of Z, normalize e and solve Z*x=±e-f.
  182. )