-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathMod.cs
More file actions
105 lines (80 loc) · 5.19 KB
/
Copy pathMod.cs
File metadata and controls
105 lines (80 loc) · 5.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
using Tensornet.Common;
namespace Tensornet{
public static class ModExtension{
public static Tensor<double> Mod(this Tensor<double> a, Tensor<double> b){
return InterElemOperation.Execute<double, double, double>(a, b, (x, y) => x % y);
}
public static Tensor<double> Mod(this Tensor<double> a, Tensor<float> b){
return InterElemOperation.Execute<double, float, double>(a, b, (x, y) => x % y);
}
public static Tensor<double> Mod(this Tensor<double> a, Tensor<long> b){
return InterElemOperation.Execute<double, long, double>(a, b, (x, y) => x % y);
}
public static Tensor<double> Mod(this Tensor<double> a, Tensor<int> b){
return InterElemOperation.Execute<double, int, double>(a, b, (x, y) => x % y);
}
public static Tensor<double> Mod(this Tensor<double> a, Tensor<bool> b){
return InterElemOperation.Execute<double, bool, double>(a, b, (x, y) => y ? (x % 1) : Double.NaN);
}
public static Tensor<double> Mod(this Tensor<float> a, Tensor<double> b){
return InterElemOperation.Execute<float, double, double>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<float> a, Tensor<float> b){
return InterElemOperation.Execute<float, float, float>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<float> a, Tensor<long> b){
return InterElemOperation.Execute<float, long, float>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<float> a, Tensor<int> b){
return InterElemOperation.Execute<float, int, float>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<float> a, Tensor<bool> b){
return InterElemOperation.Execute<float, bool, float>(a, b, (x, y) => y ? (x % 1) : Single.NaN);
}
public static Tensor<double> Mod(this Tensor<long> a, Tensor<double> b){
return InterElemOperation.Execute<long, double, double>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<long> a, Tensor<float> b){
return InterElemOperation.Execute<long, float, float>(a, b, (x, y) => x % y);
}
public static Tensor<long> Mod(this Tensor<long> a, Tensor<long> b){
return InterElemOperation.Execute<long, long, long>(a, b, (x, y) => x % y);
}
public static Tensor<long> Mod(this Tensor<long> a, Tensor<int> b){
return InterElemOperation.Execute<long, int, long>(a, b, (x, y) => x % y);
}
public static Tensor<long> Mod(this Tensor<long> a, Tensor<bool> b){
return InterElemOperation.Execute<long, bool, long>(a, b, (x, y) => 0);
}
public static Tensor<double> Mod(this Tensor<int> a, Tensor<double> b){
return InterElemOperation.Execute<int, double, double>(a, b, (x, y) => x % y);
}
public static Tensor<float> Mod(this Tensor<int> a, Tensor<float> b){
return InterElemOperation.Execute<int, float, float>(a, b, (x, y) => x % y);
}
public static Tensor<long> Mod(this Tensor<int> a, Tensor<long> b){
return InterElemOperation.Execute<int, long, long>(a, b, (x, y) => x % y);
}
public static Tensor<int> Mod(this Tensor<int> a, Tensor<int> b){
return InterElemOperation.Execute<int, int, int>(a, b, (x, y) => x % y);
}
public static Tensor<int> Mod(this Tensor<int> a, Tensor<bool> b){
return InterElemOperation.Execute<int, bool, int>(a, b, (x, y) => 0);
}
public static Tensor<double> Mod(this Tensor<bool> a, Tensor<double> b){
return InterElemOperation.Execute<bool, double, double>(a, b, (x, y) => (x ? 1 : 0) % y);
}
public static Tensor<float> Mod(this Tensor<bool> a, Tensor<float> b){
return InterElemOperation.Execute<bool, float, float>(a, b, (x, y) => (x ? 1 : 0) % y);
}
public static Tensor<long> Mod(this Tensor<bool> a, Tensor<long> b){
return InterElemOperation.Execute<bool, long, long>(a, b, (x, y) => (x ? 1 : 0) % y);
}
public static Tensor<int> Mod(this Tensor<bool> a, Tensor<int> b){
return InterElemOperation.Execute<bool, int, int>(a, b, (x, y) => (x ? 1 : 0) % y);
}
public static Tensor<bool> Mod(this Tensor<bool> a, Tensor<bool> b){
return InterElemOperation.Execute<bool, bool, bool>(a, b, (x, y) => false);
}
}
}