pub struct Line<P> { /* private fields */ }
Expand description
A contiguous list of elements that supports auto-vectorized operations.
Implementations§
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn __expand_new(
_context: &mut CubeContext,
val: P::ExpandType,
) -> ExpandElementTyped<Self>
pub fn __expand_new( _context: &mut CubeContext, val: P::ExpandType, ) -> ExpandElementTyped<Self>
Expand function of Self::new.
Source§impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Line<P>
impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Line<P>
Sourcepub fn fill(self, value: P) -> Self
pub fn fill(self, value: P) -> Self
Fill the line with the given value.
If you want to fill the line with different values, consider using the index API instead.
let mut line = Line::<u32>::empty(2);
line[0] = 1;
line[1] = 2;
Sourcepub fn __expand_fill(
context: &mut CubeContext,
line: ExpandElementTyped<Self>,
value: ExpandElementTyped<P>,
) -> ExpandElementTyped<Self>
pub fn __expand_fill( context: &mut CubeContext, line: ExpandElementTyped<Self>, value: ExpandElementTyped<P>, ) -> ExpandElementTyped<Self>
Expand function of fill.
Source§impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Line<P>
impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Line<P>
Sourcepub fn empty(size: u32) -> Self
pub fn empty(size: u32) -> Self
Create an empty line of the given size.
Note that a line can’t change in size once it’s fixed.
Sourcepub fn __expand_empty(
context: &mut CubeContext,
length: ExpandElementTyped<u32>,
) -> ExpandElementTyped<Self>
pub fn __expand_empty( context: &mut CubeContext, length: ExpandElementTyped<u32>, ) -> ExpandElementTyped<Self>
Expand function of empty.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn size(&self) -> u32
pub fn size(&self) -> u32
Get the number of individual elements a line contains.
The size is available at comptime and may be used in combination with the comptime macro.
// The if statement is going to be executed at comptime.
if comptime!(line.size() == 1) {
}
Sourcepub fn __expand_size(
context: &mut CubeContext,
element: ExpandElementTyped<P>,
) -> u32
pub fn __expand_size( context: &mut CubeContext, element: ExpandElementTyped<P>, ) -> u32
Expand function of size.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn equal(self, _other: Self) -> Line<bool>
pub fn equal(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being equal to the second line.
Sourcepub fn __expand_equal(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_equal( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn not_equal(self, _other: Self) -> Line<bool>
pub fn not_equal(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being not equal to the second line.
Sourcepub fn __expand_not_equal(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_not_equal( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn less_than(self, _other: Self) -> Line<bool>
pub fn less_than(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being less than the second line.
Sourcepub fn __expand_less_than(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_less_than( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn greater_than(self, _other: Self) -> Line<bool>
pub fn greater_than(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being greater than the second line.
Sourcepub fn __expand_greater_than(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_greater_than( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn less_equal(self, _other: Self) -> Line<bool>
pub fn less_equal(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being less than or equal to the second line.
Sourcepub fn __expand_less_equal(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_less_equal( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Source§impl<P: CubePrimitive> Line<P>
impl<P: CubePrimitive> Line<P>
Sourcepub fn greater_equal(self, _other: Self) -> Line<bool>
pub fn greater_equal(self, _other: Self) -> Line<bool>
Return a new line with the element-wise comparison of the first line being greater than or equal to the second line.
Sourcepub fn __expand_greater_equal(
context: &mut CubeContext,
lhs: ExpandElementTyped<Self>,
rhs: ExpandElementTyped<Self>,
) -> ExpandElementTyped<Line<bool>>
pub fn __expand_greater_equal( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Line<bool>>
Expand function of $name.
Trait Implementations§
Source§impl<P: CubePrimitive + Abs> Abs for Line<P>
impl<P: CubePrimitive + Abs> Abs for Line<P>
fn abs(x: Self) -> Self
fn __expand_abs( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P> AddAssign for Line<P>where
P: CubePrimitive + AddAssign,
impl<P> AddAssign for Line<P>where
P: CubePrimitive + AddAssign,
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
+=
operation. Read moreSource§impl<P> BitAndAssign for Line<P>where
P: CubePrimitive + BitAndAssign,
impl<P> BitAndAssign for Line<P>where
P: CubePrimitive + BitAndAssign,
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
&=
operation. Read moreSource§impl<P> BitOrAssign for Line<P>where
P: CubePrimitive + BitOrAssign,
impl<P> BitOrAssign for Line<P>where
P: CubePrimitive + BitOrAssign,
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
|=
operation. Read moreSource§impl<P> BitXorAssign for Line<P>where
P: CubePrimitive + BitXorAssign,
impl<P> BitXorAssign for Line<P>where
P: CubePrimitive + BitXorAssign,
Source§fn bitxor_assign(&mut self, rhs: Self)
fn bitxor_assign(&mut self, rhs: Self)
^=
operation. Read moreSource§impl<P: CubePrimitive + Ceil> Ceil for Line<P>
impl<P: CubePrimitive + Ceil> Ceil for Line<P>
fn ceil(x: Self) -> Self
fn __expand_ceil( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Clamp> Clamp for Line<P>
impl<P: CubePrimitive + Clamp> Clamp for Line<P>
Source§fn clamp(input: Self, min_value: Self, max_value: Self) -> Self
fn clamp(input: Self, min_value: Self, max_value: Self) -> Self
fn __expand_clamp( context: &mut CubeContext, input: Self::ExpandType, min_value: Self::ExpandType, max_value: Self::ExpandType, ) -> Self::ExpandType
Source§impl<P: CubePrimitive> Clone for Line<P>
impl<P: CubePrimitive> Clone for Line<P>
Source§impl<P: CubePrimitive + Cos> Cos for Line<P>
impl<P: CubePrimitive + Cos> Cos for Line<P>
fn cos(x: Self) -> Self
fn __expand_cos( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + CountOnes> CountOnes for Line<P>
impl<P: CubePrimitive + CountOnes> CountOnes for Line<P>
fn count_ones(x: Self) -> u32
fn __expand_count_ones( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<u32>
Source§impl<P> CubeIndexMut<ExpandElementTyped<u32>> for Line<P>
impl<P> CubeIndexMut<ExpandElementTyped<u32>> for Line<P>
fn cube_idx_mut(&mut self, _i: ExpandElementTyped<u32>) -> &mut Self::Output
Source§impl<P> CubeIndexMut<u32> for Line<P>
impl<P> CubeIndexMut<u32> for Line<P>
fn cube_idx_mut(&mut self, _i: u32) -> &mut Self::Output
Source§impl<P: CubePrimitive> CubePrimitive for Line<P>
impl<P: CubePrimitive> CubePrimitive for Line<P>
Source§fn as_elem(context: &CubeContext) -> Elem
fn as_elem(context: &CubeContext) -> Elem
Source§fn as_elem_native() -> Option<Elem>
fn as_elem_native() -> Option<Elem>
Source§fn as_elem_native_unchecked() -> Elem
fn as_elem_native_unchecked() -> Elem
fn from_expand_elem(elem: ExpandElement) -> Self::ExpandType
Source§impl<P: CubePrimitive> CubeType for Line<P>
impl<P: CubePrimitive> CubeType for Line<P>
type ExpandType = ExpandElementTyped<Line<P>>
Source§fn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
fn init(context: &mut CubeContext, expand: Self::ExpandType) -> Self::ExpandType
Source§impl<P> DivAssign for Line<P>where
P: CubePrimitive + DivAssign,
impl<P> DivAssign for Line<P>where
P: CubePrimitive + DivAssign,
Source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
/=
operation. Read moreSource§impl<N: Numeric> Dot for Line<N>
impl<N: Numeric> Dot for Line<N>
fn dot(self, _rhs: Self) -> Self
fn __expand_dot( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Erf> Erf for Line<P>
impl<P: CubePrimitive + Erf> Erf for Line<P>
fn erf(x: Self) -> Self
fn __expand_erf( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Exp> Exp for Line<P>
impl<P: CubePrimitive + Exp> Exp for Line<P>
fn exp(x: Self) -> Self
fn __expand_exp( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive> ExpandElementBaseInit for Line<P>
impl<P: CubePrimitive> ExpandElementBaseInit for Line<P>
fn init_elem(context: &mut CubeContext, elem: ExpandElement) -> ExpandElement
Source§impl<P: CubePrimitive + Floor> Floor for Line<P>
impl<P: CubePrimitive + Floor> Floor for Line<P>
fn floor(x: Self) -> Self
fn __expand_floor( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Into<ExpandElementTyped<Line<P>>> for Line<P>
impl<P: CubePrimitive + Into<ExpandElementTyped<P>>> Into<ExpandElementTyped<Line<P>>> for Line<P>
Source§fn into(self) -> ExpandElementTyped<Self>
fn into(self) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive> IntoRuntime for Line<P>
impl<P: CubePrimitive> IntoRuntime for Line<P>
fn __expand_runtime_method(self, context: &mut CubeContext) -> Self::ExpandType
Source§fn runtime(self) -> Self
fn runtime(self) -> Self
Source§impl<P: CubePrimitive + Log> Log for Line<P>
impl<P: CubePrimitive + Log> Log for Line<P>
fn log(x: Self) -> Self
fn __expand_log( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Log1p> Log1p for Line<P>
impl<P: CubePrimitive + Log1p> Log1p for Line<P>
fn log1p(x: Self) -> Self
fn __expand_log1p( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Max> Max for Line<P>
impl<P: CubePrimitive + Max> Max for Line<P>
fn max(self, _rhs: Self) -> Self
fn __expand_max( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Min> Min for Line<P>
impl<P: CubePrimitive + Min> Min for Line<P>
fn min(self, _rhs: Self) -> Self
fn __expand_min( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Self>
Source§impl<P> MulAssign for Line<P>where
P: CubePrimitive + MulAssign,
impl<P> MulAssign for Line<P>where
P: CubePrimitive + MulAssign,
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
*=
operation. Read moreSource§impl<P> PartialOrd for Line<P>where
P: CubePrimitive + PartialOrd,
impl<P> PartialOrd for Line<P>where
P: CubePrimitive + PartialOrd,
Source§impl<P: CubePrimitive + Powf> Powf for Line<P>
impl<P: CubePrimitive + Powf> Powf for Line<P>
fn powf(self, _rhs: Self) -> Self
fn __expand_powf( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Recip> Recip for Line<P>
impl<P: CubePrimitive + Recip> Recip for Line<P>
fn recip(x: Self) -> Self
fn __expand_recip( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Remainder> Remainder for Line<P>
impl<P: CubePrimitive + Remainder> Remainder for Line<P>
fn rem(self, _rhs: Self) -> Self
fn __expand_rem( context: &mut CubeContext, lhs: ExpandElementTyped<Self>, rhs: ExpandElementTyped<Self>, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + ReverseBits> ReverseBits for Line<P>
impl<P: CubePrimitive + ReverseBits> ReverseBits for Line<P>
fn reverse_bits(x: Self) -> Self
fn __expand_reverse_bits( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Round> Round for Line<P>
impl<P: CubePrimitive + Round> Round for Line<P>
fn round(x: Self) -> Self
fn __expand_round( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P> ShlAssign for Line<P>where
P: CubePrimitive + ShlAssign,
impl<P> ShlAssign for Line<P>where
P: CubePrimitive + ShlAssign,
Source§fn shl_assign(&mut self, rhs: Self)
fn shl_assign(&mut self, rhs: Self)
<<=
operation. Read moreSource§impl<P> ShrAssign for Line<P>where
P: CubePrimitive + ShrAssign,
impl<P> ShrAssign for Line<P>where
P: CubePrimitive + ShrAssign,
Source§fn shr_assign(&mut self, rhs: Self)
fn shr_assign(&mut self, rhs: Self)
>>=
operation. Read moreSource§impl<P: CubePrimitive + Sin> Sin for Line<P>
impl<P: CubePrimitive + Sin> Sin for Line<P>
fn sin(x: Self) -> Self
fn __expand_sin( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + Sqrt> Sqrt for Line<P>
impl<P: CubePrimitive + Sqrt> Sqrt for Line<P>
fn sqrt(x: Self) -> Self
fn __expand_sqrt( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P> SubAssign for Line<P>where
P: CubePrimitive + SubAssign,
impl<P> SubAssign for Line<P>where
P: CubePrimitive + SubAssign,
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
-=
operation. Read moreSource§impl<P: CubePrimitive + Tanh> Tanh for Line<P>
impl<P: CubePrimitive + Tanh> Tanh for Line<P>
fn tanh(x: Self) -> Self
fn __expand_tanh( context: &mut CubeContext, x: Self::ExpandType, ) -> ExpandElementTyped<Self>
Source§impl<P: CubePrimitive + NumCast> ToPrimitive for Line<P>
impl<P: CubePrimitive + NumCast> ToPrimitive for Line<P>
Source§fn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned.Source§fn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned.Source§fn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned.Source§fn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned.Source§fn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned.Source§fn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned.Source§fn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read moreSource§fn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned.Source§fn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned.Source§fn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned.Source§fn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned.Source§fn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read more