Skip to main content

Scalar

Struct Scalar 

Source
pub struct Scalar<B: Backend, T: Element>(/* private fields */);
Expand description

A scalar of element type T on backend B.

On Native it is a T; on Trace it is a traced value. It is Copy on both backends.

§Examples

use ruxla_core::{Backend, F32, Native};

fn hypot<B: Backend>(x: F32<B>, y: F32<B>) -> F32<B> {
    (x * x + y * y).sqrt()
}
assert_eq!(hypot::<Native>(F32::new(3.0), F32::new(4.0)).value(), 5.0);

Implementations§

Source§

impl<B: Backend, T: Element> Scalar<B, T>

Source

pub fn new(v: T) -> Self

A constant.

Source

pub fn from_repr(r: B::Scalar<T>) -> Self

Wraps a backend value.

Source

pub fn repr(self) -> B::Scalar<T>

Returns the backend value.

Source

pub fn eq(self, other: impl Into<Self>) -> Bool<B>

self == other.

Source

pub fn ne(self, other: impl Into<Self>) -> Bool<B>

self != other.

Source

pub fn lt(self, other: impl Into<Self>) -> Bool<B>

self < other.

Source

pub fn le(self, other: impl Into<Self>) -> Bool<B>

self <= other.

Source

pub fn gt(self, other: impl Into<Self>) -> Bool<B>

self > other.

Source

pub fn ge(self, other: impl Into<Self>) -> Bool<B>

self >= other.

Source

pub fn max(self, other: impl Into<Self>) -> Self

The maximum, propagating NaN (logical or for booleans).

Source

pub fn min(self, other: impl Into<Self>) -> Self

The minimum, propagating NaN (logical and for booleans).

Source

pub fn cast<U: Element>(self) -> Scalar<B, U>

Converts to another element type, as lax.convert_element_type.

Source

pub fn bitcast<U: Element>(self) -> Scalar<B, U>

Reinterprets the bits as another type of the same size.

Source

pub fn to_array(self) -> Array<B, T>

The value as an array of rank 0.

Source§

impl<T: Element> Scalar<Native, T>

Source

pub fn value(self) -> T

Returns the value.

Source§

impl<B: Backend, T: Numeric> Scalar<B, T>

Source

pub fn abs(self) -> Scalar<B, T::Real>

|x| (signed integers wrap around; unsigned integers are returned unchanged; the magnitude of a complex number is real).

Source

pub fn sign(self) -> Self

-1, 0, or 1 (x / |x| for complex numbers).

Source

pub fn square(self) -> Self

x * x.

Source

pub fn integer_pow(self, y: i32) -> Self

x^y for a static integer y (lax.integer_pow).

Source§

impl<B: Backend, T: Num> Scalar<B, T>

Source

pub fn clamp(self, lo: impl Into<Self>, hi: impl Into<Self>) -> Self

Clamps to [lo, hi], propagating NaN.

Source§

impl<B: Backend, T: ComplexFloat> Scalar<B, T>

Source

pub fn complex( re: impl Into<Scalar<B, T::Real>>, im: impl Into<Scalar<B, T::Real>>, ) -> Self

A complex number from its real and imaginary parts (lax.complex).

Source

pub fn real(self) -> Scalar<B, T::Real>

The real part.

Source

pub fn imag(self) -> Scalar<B, T::Real>

The imaginary part.

Source

pub fn conj(self) -> Self

The complex conjugate.

Source

pub fn angle(self) -> Scalar<B, T::Real>

The argument (atan2(imag, real), as jnp.angle).

Source§

impl<B: Backend, T: Inexact> Scalar<B, T>

Source

pub fn exp(self) -> Self

e^x.

Source

pub fn expm1(self) -> Self

e^x - 1.

Source

pub fn ln(self) -> Self

Natural logarithm (the principal value for complex numbers).

Source

pub fn ln_1p(self) -> Self

log(1 + x).

Source

pub fn sqrt(self) -> Self

Square root (the principal value for complex numbers).

Source

pub fn rsqrt(self) -> Self

1 / sqrt(x).

Source

pub fn sin(self) -> Self

Sine.

Source

pub fn cos(self) -> Self

Cosine.

Source

pub fn tan(self) -> Self

Tangent.

Source

pub fn tanh(self) -> Self

Hyperbolic tangent.

Source

pub fn logistic(self) -> Self

The logistic sigmoid.

Source

pub fn pow(self, y: impl Into<Self>) -> Self

self^y.

Source§

impl<B: Backend, T: Float> Scalar<B, T>

Source

pub fn floor(self) -> Self

Round toward negative infinity.

Source

pub fn ceil(self) -> Self

Round toward positive infinity.

Source

pub fn round(self) -> Self

Round to the nearest integer, halfway cases away from zero.

Source

pub fn round_even(self) -> Self

Round to the nearest integer, halfway cases to even.

Source

pub fn cbrt(self) -> Self

Cube root.

Source

pub fn erf_inv(self) -> Self

The inverse error function.

Source

pub fn lgamma(self) -> Self

The logarithm of the absolute value of the gamma function.

Source

pub fn digamma(self) -> Self

The digamma function.

Source

pub fn erf(self) -> Self

The error function.

Source

pub fn erfc(self) -> Self

The complementary error function.

Source

pub fn atan2(self, x: impl Into<Self>) -> Self

atan2(self, x).

Source

pub fn is_finite(self) -> Bool<B>

Whether the value is neither infinite nor NaN.

Trait Implementations§

Source§

impl<B: Backend, T: Numeric> Add for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
Source§

impl<B: Backend, T: Numeric> Add<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the + operation. Read more
Source§

impl<B: Backend, T: Numeric> Add<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Array<B, T>) -> Array<B, T>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, Complex<f32>>> for c64

Source§

type Output = Scalar<B, Complex<f32>>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, c64>) -> Scalar<B, c64>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, Complex<f64>>> for c128

Source§

type Output = Scalar<B, Complex<f64>>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, c128>) -> Scalar<B, c128>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, bf16>> for bf16

Source§

type Output = Scalar<B, bf16>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, bf16>) -> Scalar<B, bf16>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, f16>> for f16

Source§

type Output = Scalar<B, f16>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, f16>) -> Scalar<B, f16>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, f32>> for f32

Source§

type Output = Scalar<B, f32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, f32>) -> Scalar<B, f32>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, f64>> for f64

Source§

type Output = Scalar<B, f64>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, f64>) -> Scalar<B, f64>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, i8>> for i8

Source§

type Output = Scalar<B, i8>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, i8>) -> Scalar<B, i8>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, i16>> for i16

Source§

type Output = Scalar<B, i16>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, i16>) -> Scalar<B, i16>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, i32>> for i32

Source§

type Output = Scalar<B, i32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, i32>) -> Scalar<B, i32>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, i64>> for i64

Source§

type Output = Scalar<B, i64>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, i64>) -> Scalar<B, i64>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, u8>> for u8

Source§

type Output = Scalar<B, u8>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, u8>) -> Scalar<B, u8>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, u16>> for u16

Source§

type Output = Scalar<B, u16>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, u16>) -> Scalar<B, u16>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, u32>> for u32

Source§

type Output = Scalar<B, u32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, u32>) -> Scalar<B, u32>

Performs the + operation. Read more
Source§

impl<B: Backend> Add<Scalar<B, u64>> for u64

Source§

type Output = Scalar<B, u64>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Scalar<B, u64>) -> Scalar<B, u64>

Performs the + operation. Read more
Source§

impl<B: Backend, T: Numeric> Add<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self

Performs the + operation. Read more
Source§

impl<B: Backend, T: Element> ArrayLike<B, T> for Scalar<B, T>

Source§

fn into_array(self) -> Array<B, T>

Converts to an array.
Source§

fn with_array<R>(self, f: impl FnOnce(&Array<B, T>) -> R) -> R

Calls f with the array, without copying a borrowed array.
Source§

impl<B: Backend, T: Element> BitAnd for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self

Performs the & operation. Read more
Source§

impl<B: Backend, T: Element> BitAnd<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the & operation. Read more
Source§

impl<B: Backend, T: Element> BitAnd<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Array<B, T>) -> Array<B, T>

Performs the & operation. Read more
Source§

impl<B: Backend, T: Element> BitAnd<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: T) -> Self

Performs the & operation. Read more
Source§

impl<B: Backend, T: Element> BitOr for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self

Performs the | operation. Read more
Source§

impl<B: Backend, T: Element> BitOr<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the | operation. Read more
Source§

impl<B: Backend, T: Element> BitOr<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Array<B, T>) -> Array<B, T>

Performs the | operation. Read more
Source§

impl<B: Backend, T: Element> BitOr<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: T) -> Self

Performs the | operation. Read more
Source§

impl<B: Backend, T: Element> BitXor for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Self) -> Self

Performs the ^ operation. Read more
Source§

impl<B: Backend, T: Element> BitXor<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the ^ operation. Read more
Source§

impl<B: Backend, T: Element> BitXor<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: Array<B, T>) -> Array<B, T>

Performs the ^ operation. Read more
Source§

impl<B: Backend, T: Element> BitXor<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: T) -> Self

Performs the ^ operation. Read more
Source§

impl<B: Backend, T: Element> Clone for Scalar<B, T>

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<B: Backend, T: Element> Copy for Scalar<B, T>

Source§

impl<B: Backend, T: Element> Debug for Scalar<B, T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<B: Backend, T: Numeric> Div for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Self) -> Self

Performs the / operation. Read more
Source§

impl<B: Backend, T: Numeric> Div<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the / operation. Read more
Source§

impl<B: Backend, T: Numeric> Div<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Array<B, T>) -> Array<B, T>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, Complex<f32>>> for c64

Source§

type Output = Scalar<B, Complex<f32>>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, c64>) -> Scalar<B, c64>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, Complex<f64>>> for c128

Source§

type Output = Scalar<B, Complex<f64>>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, c128>) -> Scalar<B, c128>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, bf16>> for bf16

Source§

type Output = Scalar<B, bf16>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, bf16>) -> Scalar<B, bf16>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, f16>> for f16

Source§

type Output = Scalar<B, f16>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, f16>) -> Scalar<B, f16>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, f32>> for f32

Source§

type Output = Scalar<B, f32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, f32>) -> Scalar<B, f32>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, f64>> for f64

Source§

type Output = Scalar<B, f64>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, f64>) -> Scalar<B, f64>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, i8>> for i8

Source§

type Output = Scalar<B, i8>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, i8>) -> Scalar<B, i8>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, i16>> for i16

Source§

type Output = Scalar<B, i16>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, i16>) -> Scalar<B, i16>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, i32>> for i32

Source§

type Output = Scalar<B, i32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, i32>) -> Scalar<B, i32>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, i64>> for i64

Source§

type Output = Scalar<B, i64>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, i64>) -> Scalar<B, i64>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, u8>> for u8

Source§

type Output = Scalar<B, u8>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, u8>) -> Scalar<B, u8>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, u16>> for u16

Source§

type Output = Scalar<B, u16>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, u16>) -> Scalar<B, u16>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, u32>> for u32

Source§

type Output = Scalar<B, u32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, u32>) -> Scalar<B, u32>

Performs the / operation. Read more
Source§

impl<B: Backend> Div<Scalar<B, u64>> for u64

Source§

type Output = Scalar<B, u64>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Scalar<B, u64>) -> Scalar<B, u64>

Performs the / operation. Read more
Source§

impl<B: Backend, T: Numeric> Div<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self

Performs the / operation. Read more
Source§

impl<B: Backend, I: Int> From<Scalar<B, I>> for Index<B>

Source§

fn from(s: Scalar<B, I>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend, T: Element> From<Scalar<B, T>> for Array<B, T>

Source§

fn from(s: Scalar<B, T>) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend, T: Element> From<T> for Scalar<B, T>

Source§

fn from(v: T) -> Self

Converts to this type from the input type.
Source§

impl<B: Backend, T: Numeric> Mul for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
Source§

impl<B: Backend, T: Numeric> Mul<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the * operation. Read more
Source§

impl<B: Backend, T: Numeric> Mul<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Array<B, T>) -> Array<B, T>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, Complex<f32>>> for c64

Source§

type Output = Scalar<B, Complex<f32>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, c64>) -> Scalar<B, c64>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, Complex<f64>>> for c128

Source§

type Output = Scalar<B, Complex<f64>>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, c128>) -> Scalar<B, c128>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, bf16>> for bf16

Source§

type Output = Scalar<B, bf16>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, bf16>) -> Scalar<B, bf16>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, f16>> for f16

Source§

type Output = Scalar<B, f16>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, f16>) -> Scalar<B, f16>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, f32>> for f32

Source§

type Output = Scalar<B, f32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, f32>) -> Scalar<B, f32>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, f64>> for f64

Source§

type Output = Scalar<B, f64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, f64>) -> Scalar<B, f64>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, i8>> for i8

Source§

type Output = Scalar<B, i8>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, i8>) -> Scalar<B, i8>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, i16>> for i16

Source§

type Output = Scalar<B, i16>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, i16>) -> Scalar<B, i16>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, i32>> for i32

Source§

type Output = Scalar<B, i32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, i32>) -> Scalar<B, i32>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, i64>> for i64

Source§

type Output = Scalar<B, i64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, i64>) -> Scalar<B, i64>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, u8>> for u8

Source§

type Output = Scalar<B, u8>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, u8>) -> Scalar<B, u8>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, u16>> for u16

Source§

type Output = Scalar<B, u16>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, u16>) -> Scalar<B, u16>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, u32>> for u32

Source§

type Output = Scalar<B, u32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, u32>) -> Scalar<B, u32>

Performs the * operation. Read more
Source§

impl<B: Backend> Mul<Scalar<B, u64>> for u64

Source§

type Output = Scalar<B, u64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Scalar<B, u64>) -> Scalar<B, u64>

Performs the * operation. Read more
Source§

impl<B: Backend, T: Numeric> Mul<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self

Performs the * operation. Read more
Source§

impl<B: Backend, T: Numeric> Neg for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self

Performs the unary - operation. Read more
Source§

impl<B: Backend, T: Element> Not for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self

Performs the unary ! operation. Read more
Source§

impl<B: Backend, T: Num> Rem for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Self) -> Self

Performs the % operation. Read more
Source§

impl<B: Backend, T: Num> Rem<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the % operation. Read more
Source§

impl<B: Backend, T: Num> Rem<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: Array<B, T>) -> Array<B, T>

Performs the % operation. Read more
Source§

impl<B: Backend, T: Num> Rem<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: T) -> Self

Performs the % operation. Read more
Source§

impl<B: Backend, T: Int> Shl for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: Self) -> Self

Performs the << operation. Read more
Source§

impl<B: Backend, T: Int> Shl<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: T) -> Self

Performs the << operation. Read more
Source§

impl<B: Backend, T: Int> Shr for Scalar<B, T>

Source§

fn shr(self, rhs: Self) -> Self

A logical shift for unsigned types and an arithmetic shift for signed types, as Rust’s >>.

Source§

type Output = Scalar<B, T>

The resulting type after applying the >> operator.
Source§

impl<B: Backend, T: Int> Shr<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: T) -> Self

Performs the >> operation. Read more
Source§

impl<B: Backend, T: Numeric> Sub for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self

Performs the - operation. Read more
Source§

impl<B: Backend, T: Numeric> Sub<&Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Array<B, T>) -> Array<B, T>

Performs the - operation. Read more
Source§

impl<B: Backend, T: Numeric> Sub<Array<B, T>> for Scalar<B, T>

Source§

type Output = Array<B, T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Array<B, T>) -> Array<B, T>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, Complex<f32>>> for c64

Source§

type Output = Scalar<B, Complex<f32>>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, c64>) -> Scalar<B, c64>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, Complex<f64>>> for c128

Source§

type Output = Scalar<B, Complex<f64>>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, c128>) -> Scalar<B, c128>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, bf16>> for bf16

Source§

type Output = Scalar<B, bf16>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, bf16>) -> Scalar<B, bf16>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, f16>> for f16

Source§

type Output = Scalar<B, f16>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, f16>) -> Scalar<B, f16>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, f32>> for f32

Source§

type Output = Scalar<B, f32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, f32>) -> Scalar<B, f32>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, f64>> for f64

Source§

type Output = Scalar<B, f64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, f64>) -> Scalar<B, f64>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, i8>> for i8

Source§

type Output = Scalar<B, i8>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, i8>) -> Scalar<B, i8>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, i16>> for i16

Source§

type Output = Scalar<B, i16>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, i16>) -> Scalar<B, i16>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, i32>> for i32

Source§

type Output = Scalar<B, i32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, i32>) -> Scalar<B, i32>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, i64>> for i64

Source§

type Output = Scalar<B, i64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, i64>) -> Scalar<B, i64>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, u8>> for u8

Source§

type Output = Scalar<B, u8>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, u8>) -> Scalar<B, u8>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, u16>> for u16

Source§

type Output = Scalar<B, u16>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, u16>) -> Scalar<B, u16>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, u32>> for u32

Source§

type Output = Scalar<B, u32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, u32>) -> Scalar<B, u32>

Performs the - operation. Read more
Source§

impl<B: Backend> Sub<Scalar<B, u64>> for u64

Source§

type Output = Scalar<B, u64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Scalar<B, u64>) -> Scalar<B, u64>

Performs the - operation. Read more
Source§

impl<B: Backend, T: Numeric> Sub<T> for Scalar<B, T>

Source§

type Output = Scalar<B, T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self

Performs the - operation. Read more
Source§

impl<B: Backend, T: Element> Tree<B> for Scalar<B, T>

Source§

type On<C: Backend> = Scalar<C, T>

The same structure on backend C.
Source§

fn flatten(&self, leaves: &mut Vec<B::Leaf>)

Appends the leaves, in order.
Source§

fn unflatten_like(&self, leaves: &mut dyn Iterator<Item = B::Leaf>) -> Self

Builds a value of the same structure from leaves.
Source§

fn rebuild<C: Backend>( &self, leaves: &mut dyn Iterator<Item = C::Leaf>, ) -> Scalar<C, T>

Builds a value of the same structure on backend C from leaves (static fields are copied from self).
Source§

fn def(&self) -> TreeDef

Describes the structure.
Source§

fn select(pred: Bool<B>, on_true: &Self, on_false: &Self) -> Self

Selects on_true or on_false leaf by leaf.

Auto Trait Implementations§

§

impl<B, T> Freeze for Scalar<B, T>
where <B as Backend>::Scalar<T>: Freeze,

§

impl<B, T> RefUnwindSafe for Scalar<B, T>
where <B as Backend>::Scalar<T>: RefUnwindSafe,

§

impl<B, T> Send for Scalar<B, T>
where <B as Backend>::Scalar<T>: Send,

§

impl<B, T> Sync for Scalar<B, T>
where <B as Backend>::Scalar<T>: Sync,

§

impl<B, T> Unpin for Scalar<B, T>
where <B as Backend>::Scalar<T>: Unpin,

§

impl<B, T> UnsafeUnpin for Scalar<B, T>
where <B as Backend>::Scalar<T>: UnsafeUnpin,

§

impl<B, T> UnwindSafe for Scalar<B, T>
where <B as Backend>::Scalar<T>: UnwindSafe,

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
§

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

§

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<B, T> IntoIndices<B> for T
where B: Backend, T: Into<Index<B>>,

Source§

fn into_indices(self) -> Indices<B>

The components.
§

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.