Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- type NDims2 () =
- static member indexer (ind1:int) =
- let m = 2 // case of matrix 2x2 %)
- fun ind2 -> ind1 + 2*ind2
- type NDArray<'t, 'ndims> =
- {
- data : 't array
- }
- let inline indexer (arr: NDArray<_, 'ndims>) ind1 =
- (^ndims : (static member indexer : int -> ^rest) ind1)
- let inline get (arr : NDArray<'t, 'ndims>) ind1 rest : 't =
- let indexr = indexer arr ind1
- arr.data.[indexr rest]
- let mat : NDArray<_, NDims2> = { data = [|1;2;3;4|] }
- get mat 1 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement