@@ -3,6 +3,7 @@ namespace FSharpPlus.Data
3
3
#if ! FABLE_ COMPILER
4
4
5
5
open System.Runtime .CompilerServices
6
+ open System.ComponentModel
6
7
open FSharpPlus.Control
7
8
open FSharpPlus.TypeLevel
8
9
open TypeLevelOperators
@@ -294,6 +295,13 @@ module Matrix =
294
295
{ Items =
295
296
Array2D.init ( Array2D.length1 m1.Items) ( Array2D.length2 m1.Items)
296
297
( fun i j -> f m1.Items.[ i, j] m2.Items.[ i, j] ) }
298
+
299
+ [<MethodImpl( MethodImplOptions.AggressiveInlining) >]
300
+ let map3 ( f : 'a -> 'b -> 'c -> 'd ) ( m1 : Matrix < 'a , 'm , 'n >) ( m2 : Matrix < 'b , 'm , 'n >) ( m3 : Matrix < 'c , 'm , 'n >) : Matrix < 'd , 'm , 'n > =
301
+ { Items =
302
+ Array2D.init ( Array2D.length1 m1.Items) ( Array2D.length2 m1.Items)
303
+ ( fun i j -> f m1.Items.[ i, j] m2.Items.[ i, j] m3.Items.[ i, j] ) }
304
+
297
305
[<MethodImpl( MethodImplOptions.AggressiveInlining) >]
298
306
let mapi ( f : int -> int -> 'a -> 'b ) ( m : Matrix < 'a , 'm , 'n >) : Matrix < 'b , 'm , 'n > =
299
307
{ Items = Array2D.mapi ( fun i j -> f i j) m.Items }
@@ -554,8 +562,17 @@ module Matrix =
554
562
type Matrix < 'Item , 'Row , 'Column > with
555
563
static member inline Item ( mtx : Matrix < 'a , 'm , 'n >, ( m , n )) = Matrix.get m n mtx
556
564
static member inline Map ( mtx : Matrix < 'a , 'm , 'n >, f : 'a -> 'b ) = Matrix.map f mtx
565
+
566
+ [<EditorBrowsable( EditorBrowsableState.Never) >]
567
+ static member inline Map2 ( f , m1 , m2 ) : Matrix < 'x , 'm , 'n > = Matrix.map2 f m1 m2
568
+
569
+ [<EditorBrowsable( EditorBrowsableState.Never) >]
570
+ static member inline Map3 ( f , m1 , m2 , m3 ) : Matrix < 'x , 'm , 'n > = Matrix.map3 f m1 m2 m3
571
+
557
572
static member inline Return ( x : 'x ) : Matrix < 'x , 'm , 'n > = Matrix.replicate Singleton Singleton x
573
+ static member inline Pure ( x : 'x ) : Matrix < 'x , 'm , 'n > = Matrix.replicate Singleton Singleton x
558
574
static member inline ( <*> ) ( f : Matrix < 'x -> 'y , 'm , 'n >, x : Matrix < 'x , 'm , 'n >) = Matrix.map2 id f x
575
+ static member inline ( <.> ) ( f : Matrix < 'x -> 'y , 'm , 'n >, x : Matrix < 'x , 'm , 'n >) = Matrix.map2 id f x
559
576
static member inline get_Zero () : Matrix < 'a , 'm , 'n > = Matrix.zero
560
577
static member inline ( + ) ( m1 , m2 ) = Matrix.map2 (+) m1 m2
561
578
static member inline ( - ) ( m1 , m2 ) = Matrix.map2 (-) m1 m2
@@ -579,9 +596,21 @@ type Matrix<'Item, 'Row, 'Column> with
579
596
type Vector < 'Item , 'Length > with
580
597
static member inline Item ( v : Vector < 'a , 'n >, i ) = Vector.get i v
581
598
static member inline Map ( v : Vector < 'a , 'n >, f : 'a -> 'b ) : Vector < 'b , 'n > = Vector.map f v
599
+
600
+ [<EditorBrowsable( EditorBrowsableState.Never) >]
601
+ static member inline Map2 ( f , vec1 , vec2 ) : Vector < 'x , 'n > = Vector.map2 f vec1 vec2
602
+
603
+ [<EditorBrowsable( EditorBrowsableState.Never) >]
604
+ static member inline Map3 ( f , vec1 , vec2 , vec3 ) : Vector < 'x , 'n > = Vector.map3 f vec1 vec2 vec3
605
+
582
606
static member inline Return ( x : 'x ) : Vector < 'x , 'n > = Vector.replicate Singleton x
607
+ static member inline Pure ( x : 'x ) : Vector < 'x , 'n > = Vector.replicate Singleton x
583
608
static member inline ( <*> ) ( f : Vector < 'x -> 'y , 'n >, x : Vector < 'x , 'n >) : Vector < 'y , 'n > = Vector.apply f x
609
+ static member inline ( <.> ) ( f : Vector < 'x -> 'y , 'n >, x : Vector < 'x , 'n >) : Vector < 'y , 'n > = Vector.apply f x
610
+
611
+ [<EditorBrowsable( EditorBrowsableState.Never) >]
584
612
static member inline Zip ( x , y ) = Vector.zip x y
613
+
585
614
static member inline get_Zero () : Vector < 'x , 'n > = Vector.zero
586
615
static member inline ( + ) ( v1 : Vector < _ , 'n >, v2 : Vector < _ , 'n >) = Vector.map2 (+) v1 v2
587
616
static member inline ( - ) ( v1 : Vector < _ , 'n >, v2 : Vector < _ , 'n >) = Vector.map2 (-) v1 v2
0 commit comments