pub trait CmpOps: Sized {
Show 18 methods
// Required methods
fn max(dims: usize, a: &[Self]) -> Self;
fn max_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn max_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn min(dims: usize, a: &[Self]) -> Self;
fn min_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn min_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn eq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn eq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn neq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn neq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn lt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn lt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn lte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn lte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn gt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn gt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn gte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
fn gte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])
where for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>;
}Expand description
Various comparison operations over vectors.
Required Methods§
Sourcefn max_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn max_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Performs an element wise max on each element of vector a and the provided broadcast
value, writing the result to result.
§Pseudocode
result = [0; dims]
for i in range(dims):
result[i] = max(value, a[i])
return result§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn max_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn max_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Performs an element wise max on each element of vector a and b,
writing the result to result.
§Pseudocode
result = [0; dims]
for i in range(dims):
result[i] = max(a[i], b[i])
return result§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn min_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn min_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Performs an element wise min on each element of vector a and the provided broadcast
value, writing the result to result.
§Pseudocode
result = [0; dims]
for i in range(dims):
result[i] = min(value, a[i])
return result§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn min_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn min_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Performs an element wise min on each element of vector a and b,
writing the result to result.
§Pseudocode
result = [0; dims]
for i in range(dims):
result[i] = min(a[i], b[i])
return result§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn eq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn eq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are equal returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] == value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 == 0.0 -> true0.0 == NaN -> falseNaN == NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn eq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn eq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is equal to element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] == b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 == 0.0 -> true0.0 == NaN -> falseNaN == NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn neq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn neq_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are not equal returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] != value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other, meaning in the case of NOT equal, they become true.
0.0 != 1.0 -> true0.0 != NaN -> trueNaN != NaN -> true
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn neq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn neq_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is not equal to element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] != b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other, meaning in the case of NOT equal, they become true.
0.0 != 1.0 -> true0.0 != NaN -> trueNaN != NaN -> true
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn lt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn lt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are less than returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] < value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 < 1.0 -> true0.0 < NaN -> falseNaN < NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn lt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn lt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is less than element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] < b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 < 1.0 -> true0.0 < NaN -> falseNaN < NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn lte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn lte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are less than or equal returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] <= value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 <= 1.0 -> true0.0 <= NaN -> falseNaN <= NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn lte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn lte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is less than or equal to element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] <= b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
0.0 <= 1.0 -> true0.0 <= NaN -> falseNaN <= NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn gt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn gt_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are less than or equal returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] > value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
1.0 > 0.0 -> true1.0 > NaN -> falseNaN > NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn gt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn gt_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is greater than element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] > b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
1.0 > 0.0 -> true1.0 > NaN -> falseNaN > NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Sourcefn gte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn gte_value<B>(dims: usize, value: Self, a: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element within vector a of size dims against a provided broadcast value
comparing if they are less than or equal returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] >= value ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
1.0 >= 0.0 -> true1.0 >= NaN -> falseNaN >= NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a or result does not match dims.
Sourcefn gte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
fn gte_vector<B>(dims: usize, a: &[Self], b: &[Self], result: &mut [B])where
for<'a> &'a mut [B]: WriteOnlyBuffer<Item = Self>,
Checks each element pair from vectors a and b of size dims comparing
if element a is greater than element b returning a mask vector of the same type.
§Pseudocode
mask = [0; dims]
for i in range(dims):
mask[i] = a[i] >= b[i] ? 1 : 0
return mask§Note on NaN handling on f32/f64 types
For f32 and f64 types, NaN values are handled as always being false in ANY comparison.
Even when compared against each other.
1.0 >= 0.0 -> true1.0 >= NaN -> falseNaN >= NaN -> false
§Result buffer
The result buffer can be either an initialized slice i.e. &mut [Self]
or it can be a slice holding potentially uninitialized data i.e. &mut [MaybeUninit<Self>].
Once the operation is complete, it is safe to assume the data written is fully initialized.
§Panics
Panics if the size of vector a, b or result does not match dims.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.