Documentation
¶
Index ¶
- func Eigensystem(M CMatrix) (evals []float64, evecs [][]complex128)
- func GSLmatrixColumnsToSlices(m *C.gsl_matrix_complex) [][]complex128
- func GSLvectorToSlice(v *C.gsl_vector) []float64
- func HermEigensystem(M *CMatrixGSL, work *HermWorkGSL, evals *VectorGSL, evecs *CMatrixGSL)
- func HermEigensystemCleanup(work *HermWorkGSL, evals *VectorGSL, evecs *CMatrixGSL)
- func HermEigensystemSetup(M *CMatrixGSL) (*HermWorkGSL, *VectorGSL, *CMatrixGSL)
- func HermToGSL(M CMatrix) (Mgsl *C.gsl_matrix_complex)
- type CMatrix
- type CMatrixGSL
- type HermWorkGSL
- type SliceCMatrix
- type VectorGSL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Eigensystem ¶
func Eigensystem(M CMatrix) (evals []float64, evecs [][]complex128)
Perform eigendecomposition of the Hermitian matrix M. Returns a list of eigenvalues and a list of eigenvectors. Eigenvectors are ordered corresponding to the eigenvalues.
func GSLmatrixColumnsToSlices ¶
func GSLmatrixColumnsToSlices(m *C.gsl_matrix_complex) [][]complex128
Convert the complex GSL matrix m to a slice of slices representing the columns of the matrix m. The first index of the output corresponds to the column index of m, while the second index of the output corresponds to the row index of m.
func GSLvectorToSlice ¶
func GSLvectorToSlice(v *C.gsl_vector) []float64
Convert the GSL vector v to a slice of float64 values.
func HermEigensystem ¶
func HermEigensystem(M *CMatrixGSL, work *HermWorkGSL, evals *VectorGSL, evecs *CMatrixGSL)
func HermEigensystemCleanup ¶
func HermEigensystemCleanup(work *HermWorkGSL, evals *VectorGSL, evecs *CMatrixGSL)
func HermEigensystemSetup ¶
func HermEigensystemSetup(M *CMatrixGSL) (*HermWorkGSL, *VectorGSL, *CMatrixGSL)
Allocate the eigensystem's workspace and its return values. Returns the workspace, eigenvalue vector, and eigenvector matrix.
func HermToGSL ¶
func HermToGSL(M CMatrix) (Mgsl *C.gsl_matrix_complex)
Construct a Hermitian gsl_matrix_complex from the diagonal and lower triangular parts of M. When done using the returned gsl_matrix_complex, it must be manually freed using gsl_matrix_complex_free.
Types ¶
type CMatrix ¶
type CMatrix interface {
// Dims returns the dimensions of a CMatrix.
Dims() (r, c int)
// At returns the value of the matrix element at (r, c). It will
// panic if r or c are out of bounds for the matrix.
At(r, c int) complex128
String() string
}
CMatrix represents a matrix storing complex128 values. Follows the Matrix interface of gonum, which is found at:
https://github.com/gonum/matrix/blob/master/mat64/matrix.go
type CMatrixGSL ¶
type CMatrixGSL struct {
M *C.gsl_matrix_complex
}
func NewCMatrixGSL ¶
func NewCMatrixGSL(r, c int) *CMatrixGSL
func (*CMatrixGSL) At ¶
func (M *CMatrixGSL) At(r, c int) complex128
func (*CMatrixGSL) Destroy ¶
func (M *CMatrixGSL) Destroy()
func (*CMatrixGSL) Dims ¶
func (M *CMatrixGSL) Dims() (int, int)
func (*CMatrixGSL) Set ¶
func (M *CMatrixGSL) Set(r, c int, val complex128)
func (*CMatrixGSL) String ¶
func (M *CMatrixGSL) String() string
type HermWorkGSL ¶
type HermWorkGSL struct {
W *C.gsl_eigen_hermv_workspace
}
type SliceCMatrix ¶
type SliceCMatrix [][]complex128
func InitSliceCMatrix ¶
func InitSliceCMatrix(r, c int) SliceCMatrix
Create a SliceCMatrix of dimensions r x c with all values initialized to 0.
func (SliceCMatrix) AddMulTo ¶
func (M SliceCMatrix) AddMulTo(A *SliceCMatrix, val complex128)
Add M*val to A in-place (i.e. A --> A + val*M).
func (SliceCMatrix) AddTo ¶
func (M SliceCMatrix) AddTo(A *SliceCMatrix)
Add M to A in-place (i.e. A --> A + M).
func (SliceCMatrix) At ¶
func (M SliceCMatrix) At(r, c int) complex128
func (SliceCMatrix) Dims ¶
func (M SliceCMatrix) Dims() (r, c int)
Assume all inner slices have the same length.
func (*SliceCMatrix) MulBy ¶
func (M *SliceCMatrix) MulBy(val complex128)
Multiply M by the given scalar in-place (i.e. M --> val*M).
func (SliceCMatrix) String ¶
func (M SliceCMatrix) String() string
String representation: "row1_col1 row1_col2 ... row1_colN \n row2_col1 ..."