mat: handle vector transposes better
@@ -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.
//
