lapack.go 8.0 KB

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