github.com/gonum/lapack@v0.0.0-20181123203213-e4cdc5a0bff9/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  // This repository is no longer maintained.
     6  // Development has moved to https://github.com/gonum/gonum.
     7  package lapack
     8  
     9  import "github.com/gonum/blas"
    10  
    11  const None = 'N'
    12  
    13  type Job byte
    14  
    15  type Comp byte
    16  
    17  // Complex128 defines the public complex128 LAPACK API supported by gonum/lapack.
    18  type Complex128 interface{}
    19  
    20  // Float64 defines the public float64 LAPACK API supported by gonum/lapack.
    21  type Float64 interface {
    22  	Dgecon(norm MatrixNorm, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64
    23  	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)
    24  	Dgels(trans blas.Transpose, m, n, nrhs int, a []float64, lda int, b []float64, ldb int, work []float64, lwork int) bool
    25  	Dgelqf(m, n int, a []float64, lda int, tau, work []float64, lwork int)
    26  	Dgeqrf(m, n int, a []float64, lda int, tau, work []float64, lwork int)
    27  	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)
    28  	Dgetrf(m, n int, a []float64, lda int, ipiv []int) (ok bool)
    29  	Dgetri(n int, a []float64, lda int, ipiv []int, work []float64, lwork int) (ok bool)
    30  	Dgetrs(trans blas.Transpose, n, nrhs int, a []float64, lda int, ipiv []int, b []float64, ldb int)
    31  	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)
    32  	Dlantr(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, m, n int, a []float64, lda int, work []float64) float64
    33  	Dlange(norm MatrixNorm, m, n int, a []float64, lda int, work []float64) float64
    34  	Dlansy(norm MatrixNorm, uplo blas.Uplo, n int, a []float64, lda int, work []float64) float64
    35  	Dlapmt(forward bool, m, n int, x []float64, ldx int, k []int)
    36  	Dormqr(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int)
    37  	Dormlq(side blas.Side, trans blas.Transpose, m, n, k int, a []float64, lda int, tau, c []float64, ldc int, work []float64, lwork int)
    38  	Dpocon(uplo blas.Uplo, n int, a []float64, lda int, anorm float64, work []float64, iwork []int) float64
    39  	Dpotrf(ul blas.Uplo, n int, a []float64, lda int) (ok bool)
    40  	Dsyev(jobz EVJob, uplo blas.Uplo, n int, a []float64, lda int, w, work []float64, lwork int) (ok bool)
    41  	Dtrcon(norm MatrixNorm, uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int, work []float64, iwork []int) float64
    42  	Dtrtri(uplo blas.Uplo, diag blas.Diag, n int, a []float64, lda int) (ok bool)
    43  	Dtrtrs(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, nrhs int, a []float64, lda int, b []float64, ldb int) (ok bool)
    44  }
    45  
    46  // Direct specifies the direction of the multiplication for the Householder matrix.
    47  type Direct byte
    48  
    49  const (
    50  	Forward  Direct = 'F' // Reflectors are right-multiplied, H_0 * H_1 * ... * H_{k-1}.
    51  	Backward Direct = 'B' // Reflectors are left-multiplied, H_{k-1} * ... * H_1 * H_0.
    52  )
    53  
    54  // Sort is the sorting order.
    55  type Sort byte
    56  
    57  const (
    58  	SortIncreasing Sort = 'I'
    59  	SortDecreasing Sort = 'D'
    60  )
    61  
    62  // StoreV indicates the storage direction of elementary reflectors.
    63  type StoreV byte
    64  
    65  const (
    66  	ColumnWise StoreV = 'C' // Reflector stored in a column of the matrix.
    67  	RowWise    StoreV = 'R' // Reflector stored in a row of the matrix.
    68  )
    69  
    70  // MatrixNorm represents the kind of matrix norm to compute.
    71  type MatrixNorm byte
    72  
    73  const (
    74  	MaxAbs       MatrixNorm = 'M' // max(abs(A(i,j)))  ('M')
    75  	MaxColumnSum MatrixNorm = 'O' // Maximum column sum (one norm) ('1', 'O')
    76  	MaxRowSum    MatrixNorm = 'I' // Maximum row sum (infinity norm) ('I', 'i')
    77  	NormFrob     MatrixNorm = 'F' // Frobenius norm (sqrt of sum of squares) ('F', 'f', E, 'e')
    78  )
    79  
    80  // MatrixType represents the kind of matrix represented in the data.
    81  type MatrixType byte
    82  
    83  const (
    84  	General  MatrixType = 'G' // A dense matrix (like blas64.General).
    85  	UpperTri MatrixType = 'U' // An upper triangular matrix.
    86  	LowerTri MatrixType = 'L' // A lower triangular matrix.
    87  )
    88  
    89  // Pivot specifies the pivot type for plane rotations
    90  type Pivot byte
    91  
    92  const (
    93  	Variable Pivot = 'V'
    94  	Top      Pivot = 'T'
    95  	Bottom   Pivot = 'B'
    96  )
    97  
    98  type DecompUpdate byte
    99  
   100  const (
   101  	ApplyP DecompUpdate = 'P'
   102  	ApplyQ DecompUpdate = 'Q'
   103  )
   104  
   105  // SVDJob specifies the singular vector computation type for SVD.
   106  type SVDJob byte
   107  
   108  const (
   109  	SVDAll       SVDJob = 'A' // Compute all singular vectors
   110  	SVDInPlace   SVDJob = 'S' // Compute the first singular vectors and store them in provided storage.
   111  	SVDOverwrite SVDJob = 'O' // Compute the singular vectors and store them in input matrix
   112  	SVDNone      SVDJob = 'N' // Do not compute singular vectors
   113  )
   114  
   115  // GSVDJob specifies the singular vector computation type for Generalized SVD.
   116  type GSVDJob byte
   117  
   118  const (
   119  	GSVDU    GSVDJob = 'U' // Compute orthogonal matrix U
   120  	GSVDV    GSVDJob = 'V' // Compute orthogonal matrix V
   121  	GSVDQ    GSVDJob = 'Q' // Compute orthogonal matrix Q
   122  	GSVDUnit GSVDJob = 'I' // Use unit-initialized matrix
   123  	GSVDNone GSVDJob = 'N' // Do not compute orthogonal matrix
   124  )
   125  
   126  // EVComp specifies how eigenvectors are computed.
   127  type EVComp byte
   128  
   129  const (
   130  	// OriginalEV specifies to compute the eigenvectors of the original
   131  	// matrix.
   132  	OriginalEV EVComp = 'V'
   133  	// TridiagEV specifies to compute both the eigenvectors of the input
   134  	// tridiagonal matrix.
   135  	TridiagEV EVComp = 'I'
   136  	// HessEV specifies to compute both the eigenvectors of the input upper
   137  	// Hessenberg matrix.
   138  	HessEV EVComp = 'I'
   139  
   140  	// UpdateSchur specifies that the matrix of Schur vectors will be
   141  	// updated by Dtrexc.
   142  	UpdateSchur EVComp = 'V'
   143  )
   144  
   145  // Job types for computation of eigenvectors.
   146  type (
   147  	EVJob      byte
   148  	LeftEVJob  byte
   149  	RightEVJob byte
   150  )
   151  
   152  // Job constants for computation of eigenvectors.
   153  const (
   154  	ComputeEV      EVJob      = 'V' // Compute eigenvectors in Dsyev.
   155  	ComputeLeftEV  LeftEVJob  = 'V' // Compute left eigenvectors.
   156  	ComputeRightEV RightEVJob = 'V' // Compute right eigenvectors.
   157  )
   158  
   159  // Jobs for Dgebal.
   160  const (
   161  	Permute      Job = 'P'
   162  	Scale        Job = 'S'
   163  	PermuteScale Job = 'B'
   164  )
   165  
   166  // Job constants for Dhseqr.
   167  const (
   168  	EigenvaluesOnly     EVJob = 'E'
   169  	EigenvaluesAndSchur EVJob = 'S'
   170  )
   171  
   172  // EVSide specifies what eigenvectors will be computed.
   173  type EVSide byte
   174  
   175  // EVSide constants for Dtrevc3.
   176  const (
   177  	RightEV     EVSide = 'R' // Compute right eigenvectors only.
   178  	LeftEV      EVSide = 'L' // Compute left eigenvectors only.
   179  	RightLeftEV EVSide = 'B' // Compute both right and left eigenvectors.
   180  )
   181  
   182  // HowMany specifies which eigenvectors will be computed.
   183  type HowMany byte
   184  
   185  // HowMany constants for Dhseqr.
   186  const (
   187  	AllEV      HowMany = 'A' // Compute all right and/or left eigenvectors.
   188  	AllEVMulQ  HowMany = 'B' // Compute all right and/or left eigenvectors multiplied by an input matrix.
   189  	SelectedEV HowMany = 'S' // Compute selected right and/or left eigenvectors.
   190  )