Skip to main content

Kernel

Struct Kernel 

Source
pub struct Kernel { /* private fields */ }
Expand description

One resolved mathematical definition and its captured numerical policies.

Implementations§

Source§

impl Kernel

Source

pub fn resolve<K: Formula<N>, const N: usize>( object: K, variant: Variant, types: [DType; N], ) -> Result<Self, Error>

Source

pub fn circle( code: i64, inverse: bool, real_part: bool, variant: Variant, types: [DType; 1], ) -> Result<Option<Self>, Error>

Source

pub fn new<K: Formula<N>, const N: usize>(object: K, variant: Variant) -> Self

Source

pub fn try_resolve<K: Formula<N>, const N: usize>( object: K, variant: Variant, types: [DType; N], ) -> Result<Option<Self>, Error>

Source

pub fn of( op: Op, variant: Variant, types: &[DType], ) -> Result<Option<Self>, Error>

op resolved for arguments of types types in variant, as Kernel::try_resolve resolves its object: Ok(None) where it has no body for them, or types doesn’t hold one type per argument. Non-generic, so every formula’s kernel code compiles in rustymath alone.

Source

pub fn slope( op: Op, side: usize, variant: Variant, types: &[DType], ) -> Result<Option<Self>, Error>

The kernel of op’s partial in its argument side (derivative::Slope), whose arguments are op’s and then op’s result, one type each in types, resolved as Kernel::of resolves op. Ok(None) also where op takes three arguments.

Source

pub fn arity(&self) -> usize

Source

pub fn result_dtype(&self) -> DType

Source

pub fn variant(&self) -> Variant

The resolved computing dtype and numerical policies.

Source

pub fn with_checked(self, checked: bool) -> Self

Select whether this operation reports item errors.

Source

pub fn input_policy(&self) -> Option<Policy>

Source

pub fn selected_input(&self) -> Option<usize>

Source

pub fn ordered(self, classes: &[Option<i32>], types: &[DType]) -> Self

Resolve an order-only operation on disjoint logical domains, before numeric promotion.

Source

pub fn exact(&self, args: &[BigRational]) -> Result<Option<BigRational>, Error>

Source

pub fn has_exact(&self) -> bool

Source

pub fn integers(&self, args: &[i64]) -> Result<i64, Error>

The formula on one item of each integer argument, at the kernel’s integer computing width, with its checked or wrapping variant. A Boolean computing kind reads 0 and 1.

Source

pub fn real(&self, args: &[f64], settings: Settings) -> Result<f64, Error>

Source

pub fn complex( &self, args: &[Complex64], settings: Settings, ) -> Result<Complex64, Error>

Source

pub fn may_raise(&self) -> bool

Whether checked execution can record a numeric data error, for arguments that hold any values of their types.

Source

pub fn may_raise_on(&self, narrowed: &[Range]) -> bool

Whether checked execution can record a numeric data error where each argument holds values of its type within its range in narrowed, such as a constant’s own value or the nonnegative numbers.

Source

pub fn range_on(&self, narrowed: &[Range], same: bool) -> Range

The result bound on arguments within narrowed. same says both arguments denote one value, enabling the formula’s same-input fact.

Source

pub fn partials( &self, ops: &dyn Ops<f64, V = Slot, B = Slot, I = Slot, W = Slot>, x: &[Slot], result: Slot, needed: &[bool], output: &mut [Option<Slot>], )

Source

pub fn range(&self, x: &[Range]) -> Range

Source

pub fn identity(&self) -> Option<f64>

Source

pub fn kept(&self, constants: &[Option<f64>]) -> Option<usize>

The argument that a dyadic call returns unchanged where constants gives the arguments that are one number, 0 for the left and 1 for the right, from the formula’s identities: x+0 and 0+x keep x, x-0 keeps x, and 0-x keeps nothing.

Source

pub fn fold(&self) -> Option<Reduce>

The reduction by which a fold through this kernel combines its items, as reduction gives it at the kernel’s variant.

Source

pub fn inverse_fold(&self) -> Option<Reduce>

The reduction that an unseeded right fold by this formula runs as an alternating one, as - runs as an alternating +.

Source

pub fn truth_table(&self) -> Option<u8>

Source

pub fn total_dtype(&self) -> Option<DType>

Source

pub fn fold_dtype(&self, input: DType, len: usize, seed: Option<DType>) -> DType

Source

pub fn scan_dtype(&self, seeded: bool) -> DType

The scan’s result dtype. A seeded comparison stores only Boolean results; without a seed, each lane retains its original first item. Native reductions can accumulate at a wider type.

Source

pub fn product_dtype(&self, fold: &Kernel, plan: &ProductPlan) -> DType

The dtype of this map kernel’s product with fold over plan: its native product’s result where one runs (product_for), and otherwise fold’s total of this kernel’s results along the contracted axes (fold_dtype), as a fold of them gives.

Source

pub fn map( &self, inputs: &[Read<'_>], range: Range<usize>, settings: Settings, output: &mut Buffer, ) -> Result<(), Error>

Source

pub fn map_ready( &self, inputs: &[View<'_>], n: usize, settings: Settings, output: MapOutput<'_, '_>, ) -> Result<(), Error>

Appends n results from ready inputs into output. A one-item view broadcasts; every other view contains n items.

Source

pub fn fold_pieces( &self, dims: [usize; 3], seed: Seed<'_>, direction: Direction, settings: Settings, pieces: &Pieces<'_>, output: &mut Buffer, ) -> Result<(), Error>

Source

pub fn scan( &self, dims: [usize; 3], seed: Seed<'_>, direction: Direction, settings: Settings, input: Read<'_>, output: &mut Buffer, ) -> Result<(), Error>

Source

pub fn adjacent( &self, dims: [usize; 3], seed: Option<Read<'_>>, flip: bool, settings: Settings, input: Read<'_>, output: &mut Buffer, ) -> Result<(), Error>

Each item of input, an array of shape dims, combined with the item a row before it along the middle axis, and each lane’s first row with seed, or kept as it is without one, as an inverse scan runs: flip swaps the arguments, so the earlier item comes second. The results take output‘s dtype, so a comparison’s 0s and 1s and an unseeded first row keep the items’ type where the caller asks for it.

Source

pub fn fold_read( &self, shape: &[usize], axis: Option<usize>, seed: Seed<'_>, direction: Direction, settings: Settings, input: Read<'_>, output: &mut Buffer, ) -> Result<Option<Vec<Steps>>, Error>

Folds along axis of input, an array of shape, or all its items for None, into output. Whole-array commutative folds may read a contiguous block in storage order; ordered folds retain logical order. A returned order reads output in the result’s order, for folds that stay in their source’s order (Buffer::ordered).

Trait Implementations§

Source§

impl Clone for Kernel

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Kernel

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Kernel

§

impl !UnwindSafe for Kernel

§

impl Forget for Kernel

§

impl Freeze for Kernel

§

impl Send for Kernel

§

impl Sync for Kernel

§

impl Unpin for Kernel

§

impl UnsafeUnpin for Kernel

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.