lapack.go 8.3 KB

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