@@ -17,7 +17,7 @@ macro_rules! boolean_op {
17
17
} ;
18
18
}
19
19
20
- macro_rules! map_op {
20
+ macro_rules! unary_op {
21
21
( $( #[ $meta: meta] ) * fn $id: ident) => {
22
22
$( #[ $meta] ) *
23
23
pub fn $id( & self ) -> Array <A , D > {
@@ -26,7 +26,7 @@ macro_rules! map_op {
26
26
} ;
27
27
}
28
28
29
- macro_rules! bin_op {
29
+ macro_rules! binary_op {
30
30
( $( #[ $meta: meta] ) * fn $id: ident( $ty: ty) ) => {
31
31
$( #[ $meta] ) *
32
32
pub fn $id( & self , rhs: $ty) -> Array <A , D > {
@@ -56,49 +56,49 @@ where
56
56
/// Return `true` if any element is infinity.
57
57
fn is_infinite_any -> is_infinite
58
58
}
59
- map_op ! {
59
+ unary_op ! {
60
60
/// The largest integer less than or equal to each element.
61
61
fn floor
62
62
}
63
- map_op ! {
63
+ unary_op ! {
64
64
/// The smallest integer less than or equal to each element.
65
65
fn ceil
66
66
}
67
- map_op ! {
67
+ unary_op ! {
68
68
/// The nearest integer of each element.
69
69
fn round
70
70
}
71
- map_op ! {
71
+ unary_op ! {
72
72
/// The integer part of each element.
73
73
fn trunc
74
74
}
75
- map_op ! {
75
+ unary_op ! {
76
76
/// The fractional part of each element.
77
77
fn fract
78
78
}
79
- map_op ! {
79
+ unary_op ! {
80
80
/// Absolute of each element.
81
81
fn abs
82
82
}
83
- map_op ! {
83
+ unary_op ! {
84
84
/// Sign number of each element.
85
85
///
86
86
/// + `1.0` for all positive numbers.
87
87
/// + `-1.0` for all negative numbers.
88
88
/// + `NaN` for all `NaN` (not a number).
89
89
fn signum
90
90
}
91
- map_op ! {
91
+ unary_op ! {
92
92
/// The reciprocal (inverse) of each element, `1/x`.
93
93
fn recip
94
94
}
95
- bin_op ! {
95
+ binary_op ! {
96
96
/// Integer power of each element.
97
97
///
98
98
/// This function is generally faster than using float power.
99
99
fn powi( i32 )
100
100
}
101
- bin_op ! {
101
+ binary_op ! {
102
102
/// Float power of each element.
103
103
fn powf( A )
104
104
}
@@ -108,59 +108,59 @@ where
108
108
self . mapv ( |v| v * v)
109
109
}
110
110
111
- map_op ! {
111
+ unary_op ! {
112
112
/// Square root of each element.
113
113
fn sqrt
114
114
}
115
- map_op ! {
115
+ unary_op ! {
116
116
/// `e^x` of each element. (Exponential function)
117
117
fn exp
118
118
}
119
- map_op ! {
119
+ unary_op ! {
120
120
/// `2^x` of each element.
121
121
fn exp2
122
122
}
123
- map_op ! {
123
+ unary_op ! {
124
124
/// Natural logarithm of each element.
125
125
fn ln
126
126
}
127
- bin_op ! {
127
+ binary_op ! {
128
128
/// Logarithm of each element with respect to an arbitrary base.
129
129
fn log( A )
130
130
}
131
- map_op ! {
131
+ unary_op ! {
132
132
/// Base 2 logarithm of each element.
133
133
fn log2
134
134
}
135
- map_op ! {
135
+ unary_op ! {
136
136
/// Base 10 logarithm of each element.
137
137
fn log10
138
138
}
139
- bin_op ! {
139
+ binary_op ! {
140
140
/// The positive difference between given number and each element.
141
141
fn abs_sub( A )
142
142
}
143
- map_op ! {
143
+ unary_op ! {
144
144
/// Cubic root of each element.
145
145
fn cbrt
146
146
}
147
- map_op ! {
147
+ unary_op ! {
148
148
/// Sine of each element. (in radians)
149
149
fn sin
150
150
}
151
- map_op ! {
151
+ unary_op ! {
152
152
/// Cosine of each element. (in radians)
153
153
fn cos
154
154
}
155
- map_op ! {
155
+ unary_op ! {
156
156
/// Tangent of each element. (in radians)
157
157
fn tan
158
158
}
159
- map_op ! {
159
+ unary_op ! {
160
160
/// Converts radians to degrees for each element.
161
161
fn to_degrees
162
162
}
163
- map_op ! {
163
+ unary_op ! {
164
164
/// Converts degrees to radians for each element.
165
165
fn to_radians
166
166
}
0 commit comments