This is low priority.
Currently, we implement most TensorOps operations in the operator extension statements, for example:
extension [T <: Tuple: Labels, V](t: Tensor[T, V])
def <(other: Tensor[T, V]): Tensor[T, Boolean] = Tensor(Jax.jnp.less(t.jaxValue, other.jaxValue))
As far as I understand a cleaner pattern is to have operator operations just as facade calling a type class implementation behind the scene:
extension [T <: Tuple: Labels, V](t: Tensor[T, V])(using c: TensorComparision)
def <(other: Tensor[T, V]): Tensor[T, Boolean] = c.smallerThan(t, other)
This would fix
- Code clean up. The TensorOps could be split into multiple files, one per type class.
- Clearer abstraction of Tensor operations, helping to find missing operations.
- Ambiguous overload, when wanting to provide the same operations in FloatTensorTree (which is why we currently have ** operations). This fixes it as the Type class can be provided by FloatTensorTree (leading to same operator implementation) instead of having a second overload of the operator.
This is low priority.
Currently, we implement most TensorOps operations in the operator extension statements, for example:
As far as I understand a cleaner pattern is to have operator operations just as facade calling a type class implementation behind the scene:
This would fix