Closed kortschak closed 6 years ago
It would bring its own set of implications but RowView
and ColView
could return a *Dense
instead of *Vector
.
There still needs to be a way of getting a Vector
from a Dense
.
Here is a sketch (minimal changes wrt method addition): https://github.com/gonum/matrix/commit/67ac476ec15bf010fc7bd1f7c16222c73dcfaf02
https://github.com/gonum/gonum/issues/167 is the new issue for this.
This comes out of discussion in #361. The answer is probably no, but I want to decide formally before API stability.
There is a need to be able to perform a
dst.Copy(vec.T())
wherevec
is a vector shadowing the destination row indst
sincevec
represents a column vector, even when it is the result of adst.RowView(i)
call.The problem in #361 is a result of this semantic abuse. A possible solution (proposed here) is to change the signature of
RowView
toRowView(int) *Row
,ColView
toColView(int) *Col
and deriveRow
andCol
fromVector
.Col
becomes a method limited alias ofVector
(bothCol
andRow
must satisfyMatrix
but needn't have the other methods. This adds a level of complexity since now rows or columns must be converted to a Vector for some operations and some operations will need to have additional type switch cases, but we can remove the exception for unitary stride inCopy
goes away and the type system is more consistent.