scalanlp/breeze

Optionally Encode Dimension in Types

開放

#526 建立於 2016年4月18日

 (16 則留言) (0 個反應) (0 位負責人)Scala (690 個分叉)batch import
help wantedproject

倉庫指標

星標
 (3,453 顆星)
PR 合併指標
 (30 天內沒有已合併 PR)

描述

One thing I found tedious is the runtime check the dimensionality match, for example, when writing a neural network, if you want to be safe, you need to check if the dimensionality of each layer matches, and when writing a single layer, you need to check if the multiple components of that layer have matching dimensions.

I am wondering if it's possible to encode the dimension in type so that such runtime check can be compiler time check? For example, I imagine it's possible to use Shapeless.Nat something like Matrix with D(_2, _3).

Perhaps this has been considered and deemed infeasible?

貢獻者指南