File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,9 +59,6 @@ and [<AbstractClass>] Vector<'a>() =
5959 static member inline (.+) ( x : Vector < 'a >, y : Vector < 'a >) = x.EWiseAddInplace y
6060 static member inline (. *) ( x : Vector < 'a >, y : Vector < 'a >) = x.EWiseMultInplace y
6161
62- // двойственная к вектору структура, пока это не явно, но должно легуо приводиться друг в друга
63- // вместо множества сожно использовать упорядоченную очередь
64- // можно сдлеать это DU с 1 элементом
6562and Mask1D ( size : int , indexList : int list ) =
6663
6764 member this.Item
@@ -77,4 +74,18 @@ and Mask1D(size: int, indexList: int list) =
7774
7875 static member ( ~~) ( mask : Mask1D ) = mask.GetComplement()
7976
80- and Mask2D () = class end
77+ and Mask2D ( size : int , indexList : ( int * int ) list ) =
78+
79+ member this.Item
80+ with get ( idx : int ) = indexList.[ idx]
81+
82+ member this.GetComplement () =
83+ let indices = Set.ofList indexList
84+ let allIndices = List.init size ( fun i -> ( i, i)) |> Set.ofList
85+ let complementIndices = Set.difference allIndices indices |> Set.toList
86+ Mask2D( size, complementIndices)
87+
88+ member this.GetEnumerator () = ( indexList |> List.toSeq) .GetEnumerator()
89+
90+ static member ( ~~) ( mask : Mask2D ) = mask.GetComplement()
91+
You can’t perform that action at this time.
0 commit comments