JErnestoMtz / rapl

Rank Polymorphic array library for Rust.
103 stars 3 forks source link

Non Rank typed checked primitive operations. #27

Closed JErnestoMtz closed 1 year ago

JErnestoMtz commented 1 year ago

Now all primitive operations like Transpose, Slice, Reduce, etc. are Ranked typed checked. For the user perspective this is great, but there are dependent functions like MatMul, Outer Product, etc. that use those primitive operations, and thus they have a lot of Rank trait requirements that add a lot of noise and make writing user defining Rank-Generic functions a lot harder.

The thing is, that we in theory know the output Ranks of those operations and in principle that should be all that we need. But, how it is written now we are dragging in all the Type requirements from the primitive operations used.

The solution I see is to write a non rank typed checked primitive operation alternative i.e. .t() -> .t_notyped(), and use them when we have a-priori information about the output Rank like in MatMul, Outer/ Inner Producct, etc.