mirror of
https://github.com/gonum/gonum.git
synced 2025-10-06 07:37:03 +08:00
mat: s/mat64/mat/g
This commit is contained in:
@@ -14,8 +14,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
badTriangle = "mat64: invalid triangle"
|
badTriangle = "mat: invalid triangle"
|
||||||
badCholesky = "mat64: invalid Cholesky factorization"
|
badCholesky = "mat: invalid Cholesky factorization"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Cholesky is a type for creating and using the Cholesky factorization of a
|
// Cholesky is a type for creating and using the Cholesky factorization of a
|
||||||
|
@@ -67,8 +67,8 @@ func NewDense(r, c int, data []float64) *Dense {
|
|||||||
// reuseAs must be kept in sync with reuseAsZeroed.
|
// reuseAs must be kept in sync with reuseAsZeroed.
|
||||||
func (m *Dense) reuseAs(r, c int) {
|
func (m *Dense) reuseAs(r, c int) {
|
||||||
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
||||||
// Panic as a string, not a mat64.Error.
|
// Panic as a string, not a mat.Error.
|
||||||
panic("mat64: caps not correctly set")
|
panic("mat: caps not correctly set")
|
||||||
}
|
}
|
||||||
if m.isZero() {
|
if m.isZero() {
|
||||||
m.mat = blas64.General{
|
m.mat = blas64.General{
|
||||||
@@ -93,8 +93,8 @@ func (m *Dense) reuseAs(r, c int) {
|
|||||||
// reuseAsZeroed must be kept in sync with reuseAs.
|
// reuseAsZeroed must be kept in sync with reuseAs.
|
||||||
func (m *Dense) reuseAsZeroed(r, c int) {
|
func (m *Dense) reuseAsZeroed(r, c int) {
|
||||||
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
||||||
// Panic as a string, not a mat64.Error.
|
// Panic as a string, not a mat.Error.
|
||||||
panic("mat64: caps not correctly set")
|
panic("mat: caps not correctly set")
|
||||||
}
|
}
|
||||||
if m.isZero() {
|
if m.isZero() {
|
||||||
m.mat = blas64.General{
|
m.mat = blas64.General{
|
||||||
|
@@ -693,8 +693,8 @@ func (m *Dense) Outer(alpha float64, x, y *Vector) {
|
|||||||
// TODO(kortschak): Factor out into reuseZeroedAs if
|
// TODO(kortschak): Factor out into reuseZeroedAs if
|
||||||
// we find another case that needs it.
|
// we find another case that needs it.
|
||||||
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
if m.mat.Rows > m.capRows || m.mat.Cols > m.capCols {
|
||||||
// Panic as a string, not a mat64.Error.
|
// Panic as a string, not a mat.Error.
|
||||||
panic("mat64: caps not correctly set")
|
panic("mat: caps not correctly set")
|
||||||
}
|
}
|
||||||
if m.isZero() {
|
if m.isZero() {
|
||||||
m.mat = blas64.General{
|
m.mat = blas64.General{
|
||||||
|
10
mat/doc.go
10
mat/doc.go
@@ -28,10 +28,10 @@
|
|||||||
// for i := range data {
|
// for i := range data {
|
||||||
// data[i] = rand.NormFloat64()
|
// data[i] = rand.NormFloat64()
|
||||||
// }
|
// }
|
||||||
// a := mat64.NewDense(6, 6, data)
|
// a := mat.NewDense(6, 6, data)
|
||||||
// Operations involving matrix data are implemented as functions when the values
|
// Operations involving matrix data are implemented as functions when the values
|
||||||
// of the matrix remain unchanged
|
// of the matrix remain unchanged
|
||||||
// tr := mat64.Trace(a)
|
// tr := mat.Trace(a)
|
||||||
// and are implemented as methods when the operation modifies the receiver.
|
// and are implemented as methods when the operation modifies the receiver.
|
||||||
// zero.Copy(a)
|
// zero.Copy(a)
|
||||||
//
|
//
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
// Matrix factorizations, such as the LU decomposition, typically have their own
|
// Matrix factorizations, such as the LU decomposition, typically have their own
|
||||||
// specific data storage, and so are each implemented as a specific type. The
|
// specific data storage, and so are each implemented as a specific type. The
|
||||||
// factorization can be computed through a call to Factorize
|
// factorization can be computed through a call to Factorize
|
||||||
// var lu mat64.LU
|
// var lu mat.LU
|
||||||
// lu.Factorize(a)
|
// lu.Factorize(a)
|
||||||
// The elements of the factorization can be extracted through methods on the
|
// The elements of the factorization can be extracted through methods on the
|
||||||
// factorized type, i.e. *LU.UTo. The factorization types can also be used directly,
|
// factorized type, i.e. *LU.UTo. The factorization types can also be used directly,
|
||||||
@@ -130,8 +130,8 @@
|
|||||||
//
|
//
|
||||||
// This prohibition is to help avoid subtle mistakes when the method needs to read
|
// This prohibition is to help avoid subtle mistakes when the method needs to read
|
||||||
// from and write to the same data region. There are ways to make mistakes using the
|
// from and write to the same data region. There are ways to make mistakes using the
|
||||||
// mat64 API, and mat64 functions will detect and complain about those.
|
// mat API, and mat functions will detect and complain about those.
|
||||||
// There are many ways to make mistakes by excursion from the mat64 API via
|
// There are many ways to make mistakes by excursion from the mat API via
|
||||||
// interaction with raw matrix values.
|
// interaction with raw matrix values.
|
||||||
//
|
//
|
||||||
// If you need to read the rest of this section to understand the behavior of
|
// If you need to read the rest of this section to understand the behavior of
|
||||||
|
@@ -11,8 +11,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
badFact = "mat64: use without successful factorization"
|
badFact = "mat: use without successful factorization"
|
||||||
badNoVect = "mat64: eigenvectors not computed"
|
badNoVect = "mat: eigenvectors not computed"
|
||||||
)
|
)
|
||||||
|
|
||||||
// EigenSym is a type for creating and manipulating the Eigen decomposition of
|
// EigenSym is a type for creating and manipulating the Eigen decomposition of
|
||||||
|
@@ -44,7 +44,7 @@ const (
|
|||||||
|
|
||||||
const stackTraceBufferSize = 1 << 20
|
const stackTraceBufferSize = 1 << 20
|
||||||
|
|
||||||
// Maybe will recover a panic with a type mat64.Error from fn, and return this error
|
// Maybe will recover a panic with a type mat.Error from fn, and return this error
|
||||||
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
||||||
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
||||||
func Maybe(fn func()) (err error) {
|
func Maybe(fn func()) (err error) {
|
||||||
@@ -52,7 +52,7 @@ func Maybe(fn func()) (err error) {
|
|||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
if e, ok := r.(Error); ok {
|
if e, ok := r.(Error); ok {
|
||||||
if e.string == "" {
|
if e.string == "" {
|
||||||
panic("mat64: invalid error")
|
panic("mat: invalid error")
|
||||||
}
|
}
|
||||||
buf := make([]byte, stackTraceBufferSize)
|
buf := make([]byte, stackTraceBufferSize)
|
||||||
n := runtime.Stack(buf, false)
|
n := runtime.Stack(buf, false)
|
||||||
@@ -66,7 +66,7 @@ func Maybe(fn func()) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaybeFloat will recover a panic with a type mat64.Error from fn, and return this error
|
// MaybeFloat will recover a panic with a type mat.Error from fn, and return this error
|
||||||
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
||||||
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
||||||
func MaybeFloat(fn func() float64) (f float64, err error) {
|
func MaybeFloat(fn func() float64) (f float64, err error) {
|
||||||
@@ -74,7 +74,7 @@ func MaybeFloat(fn func() float64) (f float64, err error) {
|
|||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
if e, ok := r.(Error); ok {
|
if e, ok := r.(Error); ok {
|
||||||
if e.string == "" {
|
if e.string == "" {
|
||||||
panic("mat64: invalid error")
|
panic("mat: invalid error")
|
||||||
}
|
}
|
||||||
buf := make([]byte, stackTraceBufferSize)
|
buf := make([]byte, stackTraceBufferSize)
|
||||||
n := runtime.Stack(buf, false)
|
n := runtime.Stack(buf, false)
|
||||||
@@ -87,7 +87,7 @@ func MaybeFloat(fn func() float64) (f float64, err error) {
|
|||||||
return fn(), nil
|
return fn(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaybeComplex will recover a panic with a type mat64.Error from fn, and return this error
|
// MaybeComplex will recover a panic with a type mat.Error from fn, and return this error
|
||||||
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
// as the Err field of an ErrorStack. The stack trace for the panicking function will be
|
||||||
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
// recovered and placed in the StackTrace field. Any other error is re-panicked.
|
||||||
func MaybeComplex(fn func() complex128) (f complex128, err error) {
|
func MaybeComplex(fn func() complex128) (f complex128, err error) {
|
||||||
@@ -95,7 +95,7 @@ func MaybeComplex(fn func() complex128) (f complex128, err error) {
|
|||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
if e, ok := r.(Error); ok {
|
if e, ok := r.(Error); ok {
|
||||||
if e.string == "" {
|
if e.string == "" {
|
||||||
panic("mat64: invalid error")
|
panic("mat: invalid error")
|
||||||
}
|
}
|
||||||
buf := make([]byte, stackTraceBufferSize)
|
buf := make([]byte, stackTraceBufferSize)
|
||||||
n := runtime.Stack(buf, false)
|
n := runtime.Stack(buf, false)
|
||||||
|
@@ -300,7 +300,7 @@ func (gsvd *GSVD) SigmaBTo(dst *Dense) *Dense {
|
|||||||
// UTo will panic if the receiver does not contain a successful factorization.
|
// UTo will panic if the receiver does not contain a successful factorization.
|
||||||
func (gsvd *GSVD) UTo(dst *Dense) *Dense {
|
func (gsvd *GSVD) UTo(dst *Dense) *Dense {
|
||||||
if gsvd.kind&GSVDU == 0 {
|
if gsvd.kind&GSVDU == 0 {
|
||||||
panic("mat64: improper GSVD kind")
|
panic("mat: improper GSVD kind")
|
||||||
}
|
}
|
||||||
r := gsvd.u.Rows
|
r := gsvd.u.Rows
|
||||||
c := gsvd.u.Cols
|
c := gsvd.u.Cols
|
||||||
@@ -326,7 +326,7 @@ func (gsvd *GSVD) UTo(dst *Dense) *Dense {
|
|||||||
// VTo will panic if the receiver does not contain a successful factorization.
|
// VTo will panic if the receiver does not contain a successful factorization.
|
||||||
func (gsvd *GSVD) VTo(dst *Dense) *Dense {
|
func (gsvd *GSVD) VTo(dst *Dense) *Dense {
|
||||||
if gsvd.kind&GSVDV == 0 {
|
if gsvd.kind&GSVDV == 0 {
|
||||||
panic("mat64: improper GSVD kind")
|
panic("mat: improper GSVD kind")
|
||||||
}
|
}
|
||||||
r := gsvd.v.Rows
|
r := gsvd.v.Rows
|
||||||
c := gsvd.v.Cols
|
c := gsvd.v.Cols
|
||||||
@@ -352,7 +352,7 @@ func (gsvd *GSVD) VTo(dst *Dense) *Dense {
|
|||||||
// QTo will panic if the receiver does not contain a successful factorization.
|
// QTo will panic if the receiver does not contain a successful factorization.
|
||||||
func (gsvd *GSVD) QTo(dst *Dense) *Dense {
|
func (gsvd *GSVD) QTo(dst *Dense) *Dense {
|
||||||
if gsvd.kind&GSVDQ == 0 {
|
if gsvd.kind&GSVDQ == 0 {
|
||||||
panic("mat64: improper GSVD kind")
|
panic("mat: improper GSVD kind")
|
||||||
}
|
}
|
||||||
r := gsvd.q.Rows
|
r := gsvd.q.Rows
|
||||||
c := gsvd.q.Cols
|
c := gsvd.q.Cols
|
||||||
|
@@ -33,7 +33,7 @@ func Inner(x *Vector, A Matrix, y *Vector) float64 {
|
|||||||
case RawSymmetricer:
|
case RawSymmetricer:
|
||||||
bmat := b.RawSymmetric()
|
bmat := b.RawSymmetric()
|
||||||
if bmat.Uplo != blas.Upper {
|
if bmat.Uplo != blas.Upper {
|
||||||
// Panic as a string not a mat64.Error.
|
// Panic as a string not a mat.Error.
|
||||||
panic(badSymTriangle)
|
panic(badSymTriangle)
|
||||||
}
|
}
|
||||||
for i := 0; i < x.Len(); i++ {
|
for i := 0; i < x.Len(); i++ {
|
||||||
|
16
mat/io.go
16
mat/io.go
@@ -20,10 +20,10 @@ var (
|
|||||||
sizeInt64 = binary.Size(int64(0))
|
sizeInt64 = binary.Size(int64(0))
|
||||||
sizeFloat64 = binary.Size(float64(0))
|
sizeFloat64 = binary.Size(float64(0))
|
||||||
|
|
||||||
errTooBig = errors.New("mat64: resulting data slice too big")
|
errTooBig = errors.New("mat: resulting data slice too big")
|
||||||
errTooSmall = errors.New("mat64: input slice too small")
|
errTooSmall = errors.New("mat: input slice too small")
|
||||||
errBadBuffer = errors.New("mat64: data buffer size mismatch")
|
errBadBuffer = errors.New("mat: data buffer size mismatch")
|
||||||
errBadSize = errors.New("mat64: invalid dimension")
|
errBadSize = errors.New("mat: invalid dimension")
|
||||||
)
|
)
|
||||||
|
|
||||||
// MarshalBinary encodes the receiver into a binary form and returns the result.
|
// MarshalBinary encodes the receiver into a binary form and returns the result.
|
||||||
@@ -110,7 +110,7 @@ func (m Dense) MarshalBinaryTo(w io.Writer) (int, error) {
|
|||||||
// it should not be used on untrusted data.
|
// it should not be used on untrusted data.
|
||||||
func (m *Dense) UnmarshalBinary(data []byte) error {
|
func (m *Dense) UnmarshalBinary(data []byte) error {
|
||||||
if !m.isZero() {
|
if !m.isZero() {
|
||||||
panic("mat64: unmarshal into non-zero matrix")
|
panic("mat: unmarshal into non-zero matrix")
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(data) < 2*sizeInt64 {
|
if len(data) < 2*sizeInt64 {
|
||||||
@@ -159,7 +159,7 @@ func (m *Dense) UnmarshalBinary(data []byte) error {
|
|||||||
// it should not be used on untrusted data.
|
// it should not be used on untrusted data.
|
||||||
func (m *Dense) UnmarshalBinaryFrom(r io.Reader) (int, error) {
|
func (m *Dense) UnmarshalBinaryFrom(r io.Reader) (int, error) {
|
||||||
if !m.isZero() {
|
if !m.isZero() {
|
||||||
panic("mat64: unmarshal into non-zero matrix")
|
panic("mat: unmarshal into non-zero matrix")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -269,7 +269,7 @@ func (v Vector) MarshalBinaryTo(w io.Writer) (int, error) {
|
|||||||
// it should not be used on untrusted data.
|
// it should not be used on untrusted data.
|
||||||
func (v *Vector) UnmarshalBinary(data []byte) error {
|
func (v *Vector) UnmarshalBinary(data []byte) error {
|
||||||
if !v.isZero() {
|
if !v.isZero() {
|
||||||
panic("mat64: unmarshal into non-zero vector")
|
panic("mat: unmarshal into non-zero vector")
|
||||||
}
|
}
|
||||||
|
|
||||||
p := 0
|
p := 0
|
||||||
@@ -302,7 +302,7 @@ func (v *Vector) UnmarshalBinary(data []byte) error {
|
|||||||
// See UnmarshalBinary for the list of sanity checks performed on the input.
|
// See UnmarshalBinary for the list of sanity checks performed on the input.
|
||||||
func (v *Vector) UnmarshalBinaryFrom(r io.Reader) (int, error) {
|
func (v *Vector) UnmarshalBinaryFrom(r io.Reader) (int, error) {
|
||||||
if !v.isZero() {
|
if !v.isZero() {
|
||||||
panic("mat64: unmarshal into non-zero vector")
|
panic("mat: unmarshal into non-zero vector")
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -13,7 +13,7 @@ import (
|
|||||||
"gonum.org/v1/gonum/lapack/lapack64"
|
"gonum.org/v1/gonum/lapack/lapack64"
|
||||||
)
|
)
|
||||||
|
|
||||||
const badSliceLength = "mat64: improper slice length"
|
const badSliceLength = "mat: improper slice length"
|
||||||
|
|
||||||
// LU is a type for creating and using the LU factorization of a matrix.
|
// LU is a type for creating and using the LU factorization of a matrix.
|
||||||
type LU struct {
|
type LU struct {
|
||||||
|
@@ -68,7 +68,7 @@ func (t Transpose) Untranspose() Matrix {
|
|||||||
// Untransposer is a type that can undo an implicit transpose.
|
// Untransposer is a type that can undo an implicit transpose.
|
||||||
type Untransposer interface {
|
type Untransposer interface {
|
||||||
// Note: This interface is needed to unify all of the Transpose types. In
|
// Note: This interface is needed to unify all of the Transpose types. In
|
||||||
// the mat64 methods, we need to test if the Matrix has been implicitly
|
// the mat methods, we need to test if the Matrix has been implicitly
|
||||||
// transposed. If this is checked by testing for the specific Transpose type
|
// transposed. If this is checked by testing for the specific Transpose type
|
||||||
// then the behavior will be different if the user uses T() or TTri() for a
|
// then the behavior will be different if the user uses T() or TTri() for a
|
||||||
// triangular matrix.
|
// triangular matrix.
|
||||||
@@ -274,7 +274,7 @@ func Cond(a Matrix, norm float64) float64 {
|
|||||||
var lnorm lapack.MatrixNorm
|
var lnorm lapack.MatrixNorm
|
||||||
switch norm {
|
switch norm {
|
||||||
default:
|
default:
|
||||||
panic("mat64: bad norm value")
|
panic("mat: bad norm value")
|
||||||
case 1:
|
case 1:
|
||||||
lnorm = lapack.MaxColumnSum
|
lnorm = lapack.MaxColumnSum
|
||||||
case 2:
|
case 2:
|
||||||
|
@@ -12,15 +12,15 @@ import (
|
|||||||
const (
|
const (
|
||||||
// regionOverlap is the panic string used for the general case
|
// regionOverlap is the panic string used for the general case
|
||||||
// of a matrix region overlap between a source and destination.
|
// of a matrix region overlap between a source and destination.
|
||||||
regionOverlap = "mat64: bad region: overlap"
|
regionOverlap = "mat: bad region: overlap"
|
||||||
|
|
||||||
// regionIdentity is the panic string used for the specific
|
// regionIdentity is the panic string used for the specific
|
||||||
// case of complete agreement between a source and a destination.
|
// case of complete agreement between a source and a destination.
|
||||||
regionIdentity = "mat64: bad region: identical"
|
regionIdentity = "mat: bad region: identical"
|
||||||
|
|
||||||
// mismatchedStrides is the panic string used for overlapping
|
// mismatchedStrides is the panic string used for overlapping
|
||||||
// data slices with differing strides.
|
// data slices with differing strides.
|
||||||
mismatchedStrides = "mat64: bad region: different strides"
|
mismatchedStrides = "mat: bad region: different strides"
|
||||||
)
|
)
|
||||||
|
|
||||||
// checkOverlap returns false if the receiver does not overlap data elements
|
// checkOverlap returns false if the receiver does not overlap data elements
|
||||||
|
@@ -144,7 +144,7 @@ func (svd *SVD) Values(s []float64) []float64 {
|
|||||||
func (svd *SVD) UTo(dst *Dense) *Dense {
|
func (svd *SVD) UTo(dst *Dense) *Dense {
|
||||||
kind := svd.kind
|
kind := svd.kind
|
||||||
if kind != SVDFull && kind != SVDThin {
|
if kind != SVDFull && kind != SVDThin {
|
||||||
panic("mat64: improper SVD kind")
|
panic("mat: improper SVD kind")
|
||||||
}
|
}
|
||||||
r := svd.u.Rows
|
r := svd.u.Rows
|
||||||
c := svd.u.Cols
|
c := svd.u.Cols
|
||||||
@@ -170,7 +170,7 @@ func (svd *SVD) UTo(dst *Dense) *Dense {
|
|||||||
func (svd *SVD) VTo(dst *Dense) *Dense {
|
func (svd *SVD) VTo(dst *Dense) *Dense {
|
||||||
kind := svd.kind
|
kind := svd.kind
|
||||||
if kind != SVDFull && kind != SVDThin {
|
if kind != SVDFull && kind != SVDThin {
|
||||||
panic("mat64: improper SVD kind")
|
panic("mat: improper SVD kind")
|
||||||
}
|
}
|
||||||
r := svd.vt.Rows
|
r := svd.vt.Rows
|
||||||
c := svd.vt.Cols
|
c := svd.vt.Cols
|
||||||
|
@@ -21,8 +21,8 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
badSymTriangle = "mat64: blas64.Symmetric not upper"
|
badSymTriangle = "mat: blas64.Symmetric not upper"
|
||||||
badSymCap = "mat64: bad capacity for SymDense"
|
badSymCap = "mat: bad capacity for SymDense"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SymDense is a symmetric matrix that uses dense storage. SymDense
|
// SymDense is a symmetric matrix that uses dense storage. SymDense
|
||||||
@@ -60,7 +60,7 @@ type MutableSymmetric interface {
|
|||||||
// Only the values in the upper triangular portion of the matrix are used.
|
// Only the values in the upper triangular portion of the matrix are used.
|
||||||
func NewSymDense(n int, data []float64) *SymDense {
|
func NewSymDense(n int, data []float64) *SymDense {
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
panic("mat64: negative dimension")
|
panic("mat: negative dimension")
|
||||||
}
|
}
|
||||||
if data != nil && n*n != len(data) {
|
if data != nil && n*n != len(data) {
|
||||||
panic(ErrShape)
|
panic(ErrShape)
|
||||||
|
@@ -15,7 +15,7 @@ var (
|
|||||||
_ RawTriangular = triDense
|
_ RawTriangular = triDense
|
||||||
)
|
)
|
||||||
|
|
||||||
const badTriCap = "mat64: bad capacity for TriDense"
|
const badTriCap = "mat: bad capacity for TriDense"
|
||||||
|
|
||||||
// TriDense represents an upper or lower triangular matrix in dense storage
|
// TriDense represents an upper or lower triangular matrix in dense storage
|
||||||
// format.
|
// format.
|
||||||
@@ -100,7 +100,7 @@ func (t TransposeTri) UntransposeTri() Triangular {
|
|||||||
// Only the values in the triangular portion corresponding to kind are used.
|
// Only the values in the triangular portion corresponding to kind are used.
|
||||||
func NewTriDense(n int, kind TriKind, data []float64) *TriDense {
|
func NewTriDense(n int, kind TriKind, data []float64) *TriDense {
|
||||||
if n < 0 {
|
if n < 0 {
|
||||||
panic("mat64: negative dimension")
|
panic("mat: negative dimension")
|
||||||
}
|
}
|
||||||
if data != nil && len(data) != n*n {
|
if data != nil && len(data) != n*n {
|
||||||
panic(ErrShape)
|
panic(ErrShape)
|
||||||
@@ -159,7 +159,7 @@ func isUpperUplo(u blas.Uplo) bool {
|
|||||||
// be upper triangular.
|
// be upper triangular.
|
||||||
func (t *TriDense) asSymBlas() blas64.Symmetric {
|
func (t *TriDense) asSymBlas() blas64.Symmetric {
|
||||||
if t.mat.Diag == blas.Unit {
|
if t.mat.Diag == blas.Unit {
|
||||||
panic("mat64: cannot convert unit TriDense into blas64.Symmetric")
|
panic("mat: cannot convert unit TriDense into blas64.Symmetric")
|
||||||
}
|
}
|
||||||
return blas64.Symmetric{
|
return blas64.Symmetric{
|
||||||
N: t.mat.N,
|
N: t.mat.N,
|
||||||
@@ -402,7 +402,7 @@ func copySymIntoTriangle(t *TriDense, s Symmetric) {
|
|||||||
n, upper := t.Triangle()
|
n, upper := t.Triangle()
|
||||||
ns := s.Symmetric()
|
ns := s.Symmetric()
|
||||||
if n != ns {
|
if n != ns {
|
||||||
panic("mat64: triangle size mismatch")
|
panic("mat: triangle size mismatch")
|
||||||
}
|
}
|
||||||
ts := t.mat.Stride
|
ts := t.mat.Stride
|
||||||
if rs, ok := s.(RawSymmetricer); ok {
|
if rs, ok := s.(RawSymmetricer); ok {
|
||||||
|
@@ -23,7 +23,7 @@ type Vector struct {
|
|||||||
mat blas64.Vector
|
mat blas64.Vector
|
||||||
n int
|
n int
|
||||||
// A BLAS vector can have a negative increment, but allowing this
|
// A BLAS vector can have a negative increment, but allowing this
|
||||||
// in the mat64 type complicates a lot of code, and doesn't gain anything.
|
// in the mat type complicates a lot of code, and doesn't gain anything.
|
||||||
// Vector must have positive increment in this package.
|
// Vector must have positive increment in this package.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user