Documentation ¶
Index ¶
- Constants
- func KronekerDelta(a, b, epsilon float64) float64
- func Matrix2Dense(A *Matrix) *mat.Dense
- type Error
- type Matrix
- func (F *Matrix) Add(A, B *Matrix)
- func (F *Matrix) AddFloat(A *Matrix, B float64)
- func (F *Matrix) AddRow(A, row *Matrix)
- func (F *Matrix) AddVec(A, vec *Matrix)
- func (F *Matrix) Col(dst []float64, i int) []float64
- func (F *Matrix) ColSlice(i int) *Matrix
- func (F *Matrix) ColView(i int) *Matrix
- func (F *Matrix) Cross(a, b *Matrix)
- func (F *Matrix) DelRow(A *Matrix, i int)
- func (F *Matrix) DelVec(A *Matrix, i int)
- func (F *Matrix) Dot(A *Matrix) float64
- func (F *Matrix) Len() int
- func (F *Matrix) Mul(A, B mat.Matrix)
- func (F *Matrix) NVecs() int
- func (F *Matrix) Norm(i float64) float64
- func (F *Matrix) RawSlice() []float64
- func (F *Matrix) Row(dst []float64, i int) []float64
- func (F *Matrix) RowView(i int) *Matrix
- func (F *Matrix) Scale(v float64, A *Matrix)
- func (F *Matrix) ScaleByCol(A, Col mat.Matrix)
- func (F *Matrix) ScaleByRow(A, coord *Matrix)
- func (F *Matrix) ScaleByVec(A, Vec *Matrix)
- func (F *Matrix) SetMatrix(i, j int, A *Matrix)
- func (F *Matrix) SetVecs(A *Matrix, clist []int)
- func (F *Matrix) Slice(i, r, j, c int) *Matrix
- func (F *Matrix) SomeVecs(A *Matrix, clist []int)
- func (F *Matrix) SomeVecsSafe(A *Matrix, clist []int) error
- func (F *Matrix) Stack(A, B *Matrix)
- func (F *Matrix) StackVec(A, B *Matrix)
- func (F *Matrix) String() string
- func (F *Matrix) Sub(A, B *Matrix)
- func (F *Matrix) SubRow(A, row *Matrix)
- func (F *Matrix) SubVec(A, vec *Matrix)
- func (F *Matrix) SwapVecs(i, j int)
- func (F *Matrix) Tr()
- func (F *Matrix) TrRet() *Matrix
- func (F *Matrix) Unit(A *Matrix)
- func (F *Matrix) VecSlice(i int) *Matrix
- func (F *Matrix) VecView(i int) *Matrix
- func (F *Matrix) View(i, j, r, c int) *Matrix
- type PanicMsg
Constants ¶
const ( ErrNotXx3Matrix = PanicMsg("goChem/v3: A VecMatrix should have 3 columns") ErrNoCrossProduct = PanicMsg("goChem/v3: Invalid matrix for cross product") ErrNotOrthogonal = PanicMsg("goChem/v3: Vectors nor orthogonal") ErrNotEnoughElements = PanicMsg("goChem/v3: not enough elements in Matrix") ErrGonum = PanicMsg("goChem/v3: Error in gonum function") ErrEigen = PanicMsg("goChem/v3: Can't obtain eigenvectors/eigenvalues of given matrix") ErrDeterminant = PanicMsg("goChem/v3: Determinants are only available for 3x3 matrices") ErrShape = PanicMsg("goChem/v3: Dimension mismatch") ErrIndexOutOfRange = PanicMsg("mat64: index out of range") )
Variables ¶
This section is empty.
Functions ¶
func KronekerDelta ¶
KronekerDelta is a naive implementation of the kroneker delta function.
func Matrix2Dense ¶
Matrix2Dense returns the A Gonum Dense matrix associated with A. Changes in one will be reflected in t he other
Types ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is an error on the v3 package. Compatible with goChem
type Matrix ¶
type Matrix struct { //The main container, must be able to implement most //gonum interfaces *mat.Dense }
Matrix is a set of vectors in 3D space. The underlying implementation varies. Within the package it is understood that a "vector" is a row vector, i.e. the cartesian coordinates of a point in 3D space. The name of some functions in the library reflect this.
func Dense2Matrix ¶
Dense2Matrix returns a *v3.Matrix from a Gonum dense matrix, which has to be Nx3
func EigenWrap ¶
EigenWrap wraps the mat.Eigen structure in order to guarantee That the eigenvectors and eigenvalues are sorted according to the eigenvalues It also guarantees orthonormality and handness. I don't know how many of these are already guaranteed by Eig(). Will delete the unneeded parts And even this whole function when sure. The main reason for this function Is the compatibiliy with go.matrix. This function should dissapear when we have a pure Go blas.
func (*Matrix) AddFloat ¶
AddFloat puts in the receiver a matrix which elements are those of matrix A plus the float B.
func (*Matrix) AddRow ¶
AddRow adds the row vector row to each row of the matrix A, putting the result on the receiver. Panics if matrices are mismatched. It will not work if A and row reference to the same Matrix.
func (*Matrix) AddVec ¶
AddVec adds a vector to the coordmatrix A putting the result on the received. depending on whether the underlying matrix to coordmatrix is col or row major, it could add a col or a row vector.
func (*Matrix) Col ¶
Col fills the dst slice of float64 with the ith col of matrix F and returns it. The slice must have the correct size or be nil, in which case a new slice will be created. This method is merely a frontend for the mat64.Col function of gonum.
func (*Matrix) ColView ¶
ColView a view of the given col of the matrix on the receiver. This function is for compatibility with the gonum v1 API The older one might be deleted in the future, but, if at all, it will take time.
func (*Matrix) Cross ¶
Cross puts the cross product of the first vecs of a and b in the first vec of F. Panics if error.
func (*Matrix) DelRow ¶
DelRow deletes a row in matrix A, placing the results in the receiver. Equivalent to DelVec for compatibility.
func (*Matrix) DelVec ¶
DelVec deletes a (row) vector in matrix A, placing the results in the receiver.
func (*Matrix) Dot ¶
Dot gets the dot product between the first row of F and the first row of A. It's a vector dot product, to be used with 1-row matrices.
func (*Matrix) Len ¶ added in v0.6.3
Len return the number of (row) vectors in F. Equivalent to NVecs, but more in line with Go APIS.
func (*Matrix) Mul ¶
Mul Wraps mat.Mul to take care of the case when one of the arguments is also the received. Since the received is a Matrix, the mat64 function could check A (mat64.Dense) vs F (Matrix) and it would not know that internally F.Dense==A, hence the need for this function.
func (*Matrix) RawSlice ¶ added in v0.6.0
RawSlice returns the underlying []float64 slice for the receiver. Changes on either the []float64 or the receiver are expected to reflect on the other.
func (*Matrix) Row ¶
Row fills the dst slice of float64 with the ith row of matrix F and returns it. The slice must have the correct size or be nil, in which case a new slice will be created. This method is merely a frontend for the mat64.Row function of gonum.
func (*Matrix) RowView ¶
RowView puts a view of the given row of the matrix in the receiver Equivalent to VecView
func (*Matrix) ScaleByCol ¶
ScaleByCol scales each column of matrix A by Col, putting the result in the received.
func (*Matrix) ScaleByRow ¶
ScaleByRow scales each coordinates in the A by the coordinate in the row-vector coord. The result is put in F. This is the old name fo the function, now called ScaleByVec. It is kept for compatibility
func (*Matrix) ScaleByVec ¶
ScaleByVec scales each column of matrix A by Vec, putting the result in the received.
func (*Matrix) SetMatrix ¶
SetMatrix the matrix A in the received starting from the ith row and jth col of the receiver.
func (*Matrix) SetVecs ¶
SetVecs sets the vector F[clist[i]] to the vector A[i], for all indexes i in clist. nth vector of A. Indexes i must be positive or 0
func (*Matrix) Slice ¶
Slice returns a view of F starting from i,j and spanning r rows and c columns. Changes in the view are reflected in F and vice-versa This function is to keep compatibility with the gonum v1 API.
func (*Matrix) SomeVecs ¶
SomeVecs Returns a matrix contaning a copy of the ith rows of matrix A, where i are the numbers in clist. The rows are in the same order than the clist. The numbers in clist must be positive or zero.
func (*Matrix) SomeVecsSafe ¶
SomeVecsSafe returns a matrix contaning all the ith vectors of matrix A, where i are the numbers in clist. The vectors are in the same order than the clist. It will try to recover so it returns an error instead of panicking.
func (*Matrix) SubRow ¶
SubRow subtracts the row vector row to each row of the matrix A, putting the result on the receiver. Panics if matrices are mismatched. It will not work if A and row reference to the same Matrix.
func (*Matrix) SubVec ¶
SubVec subtracts the vector to each vector of the matrix A, putting the result on the receiver. Panics if matrices are mismatched. It will not work if A and row reference to the same Matrix.
func (*Matrix) Tr ¶
func (F *Matrix) Tr()
Tr performs an explicit, in-place tranpose of the receiver. it relies in the fact that v3 matrix are all 3D. If the receiver has more than 3 rows, the square submatrix of the first 3 rows will be transposed (i.e. no panic or returned error). it panics if the receiver has less than 3 rows.
func (*Matrix) Unit ¶
Unit puts in the receiver the unit vector pointing in the same direction as the vector A (A divided by its norm).
func (*Matrix) VecSlice ¶
VecSlice slice of the given vector of the matrix in the receiver This function is to keep compatibility with the new gonum v1 API
func (*Matrix) View ¶
View returns a view of F starting from i,j and spanning r rows and c columns. Changes in the view are reflected in F and vice-versa This view has the wrong signature for the interface mat64.Viewer, But the right signatur was not possible to implement. Notice that very little memory allocation happens, only a couple of ints and pointers.