mirror of
https://github.com/gonum/gonum.git
synced 2025-10-29 09:42:38 +08:00
mat: handle vector transposes better
This commit is contained in:
@@ -38,6 +38,11 @@ func (t TransposeVec) At(i, j int) float64 {
|
||||
return t.Vector.At(j, i)
|
||||
}
|
||||
|
||||
// AtVec returns the element at position i. It panics if i is out of bounds.
|
||||
func (t TransposeVec) AtVec(i int) float64 {
|
||||
return t.Vector.AtVec(i)
|
||||
}
|
||||
|
||||
// Dims returns the dimensions of the transposed vector.
|
||||
func (t TransposeVec) Dims() (r, c int) {
|
||||
c, r = t.Vector.Dims()
|
||||
@@ -150,6 +155,11 @@ func (v *VecDense) T() Matrix {
|
||||
return Transpose{v}
|
||||
}
|
||||
|
||||
// TVec performs an implicit transpose by returning the receiver inside a TransposeVec.
|
||||
func (v *VecDense) TVec() Vector {
|
||||
return TransposeVec{v}
|
||||
}
|
||||
|
||||
// Reset zeros the length of the vector so that it can be reused as the
|
||||
// receiver of a dimensionally restricted operation.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user