You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that FiniteDimVectorSpace::dimension is independent of &self. This forces all implementors of this trait to return constant value. Therefore, Vec<T> where T: Field is not a vector over the field T.
This is an awkward definition. It might make some sense for vector space of a certain dimension known at compile time, such as Vec2 and Vec3 in the examples. However, it prohibits implementations in general.
The dimension associated method in the definition of SquareMatrix makes much less sense in this context. Recall its definition:
Note that FiniteDimVectorSpace::dimension is independent of &self. This forces all implementors of this trait to return constant value. Therefore, Vec where T: Field is not a vector over the field T.
This is actually the reason why it is independent of &self. The type Vec<T> where T: Field cannot represent a vector space over the field T because two vectors of different dimensions are not part of the same vector space.
The dimension associated method in this case takes &self, but it is in fact independent of &self once Self::Vector has constant rank at compile time.
The proposed change is to allow FiniteDimVectorSpace::dimension to accept &self.
I agree this does not make sense. Though I think the actual fix here is to make SquareMatrix::dimension independent from self so it is in line with FiniteDimVectorSpace.
I agree this does not make sense. Though I think the actual fix here is to make SquareMatrix::dimension independent from self so it is in line with FiniteDimVectorSpace.
Agree, if FiniteDimVectorSpace::dimension stays independent of &self.
So, allow me to explain the context. I am trying to manipulate matrices and vectors over an abstract field. The problem is some of the matrices/linear operators do not have the dimension of the vector spaces at compile time. For instance, an instance of permutation matrix has a finite dimension of the target vector space, but it is not necessarily fixed. With the current trait definition, these Permutation matrices must have the same size, or a constant generic perimeter in the type signature. It is a bit inflexible.
Recall this definition:
Note that
FiniteDimVectorSpace::dimension
is independent of&self
. This forces all implementors of this trait to return constant value. Therefore,Vec<T>
whereT: Field
is not a vector over the fieldT
.This is an awkward definition. It might make some sense for vector space of a certain dimension known at compile time, such as
Vec2
andVec3
in the examples. However, it prohibits implementations in general.The
dimension
associated method in the definition ofSquareMatrix
makes much less sense in this context. Recall its definition:The
dimension
associated method in this case takes&self
, but it is in fact independent of&self
onceSelf::Vector
has constant rank at compile time.The proposed change is to allow
FiniteDimVectorSpace::dimension
to accept&self
.The text was updated successfully, but these errors were encountered: