Trait ha_ndarray::CType

source ·
pub trait CType: PartialEq + PartialOrd + Copy + Send + Sync + Display + Debug + 'static {
    type Float: Float;

    const TYPE: &'static str;
    const MAX: Self;
    const MIN: Self;
    const ZERO: Self;
    const ONE: Self;
    const IS_FLOAT: bool;
Show 14 methods // Required methods fn from_f64(float: f64) -> Self; fn from_float(float: Self::Float) -> Self; fn abs(self) -> Self; fn add(self, other: Self) -> Self; fn div(self, other: Self) -> Self; fn mul(self, other: Self) -> Self; fn sub(self, other: Self) -> Self; fn rem(self, other: Self) -> Self; fn min(l: Self, r: Self) -> Self; fn max(l: Self, r: Self) -> Self; fn pow(self, exp: Self) -> Self; fn round(self) -> Self; fn to_f64(self) -> f64; fn to_float(self) -> Self::Float;
}
Expand description

A numeric type supported by ha-ndarray

Required Associated Types§

source

type Float: Float

The floating-point type used to represent this type in floating-point-only operations.

Required Associated Constants§

source

const TYPE: &'static str

The C-language type name of this data type.

source

const MAX: Self

The maximum value of this data type.

source

const MIN: Self

The minimum value of this data type.

source

const ZERO: Self

The zero value of this data type.

source

const ONE: Self

The one value of this data type.

source

const IS_FLOAT: bool

Whether this is a floating-point data type.

Required Methods§

source

fn from_f64(float: f64) -> Self

Construct an instance of this type from a f64.

source

fn from_float(float: Self::Float) -> Self

Construct an instance of this type from an instance of its floating-point type.

source

fn abs(self) -> Self

Construct an instance of this type from a f64.

source

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

Add two instances of this type.

source

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

Divide two instances of this type.

source

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

Multiply two instances of this type.

source

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

Subtract two instances of this type.

source

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

Compute the remainder of self.div(other).

source

fn min(l: Self, r: Self) -> Self

Return the minimum of two values of this type.

source

fn max(l: Self, r: Self) -> Self

Return the maximum of two values of this type.

source

fn pow(self, exp: Self) -> Self

Raise this value to the power of the given exponent.

source

fn round(self) -> Self

Round this value to the nearest integer.

source

fn to_f64(self) -> f64

Return the minimum of two values of this type.

source

fn to_float(self) -> Self::Float

Convert this value to a floating-point value.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CType for f32

source§

const TYPE: &'static str = "float"

source§

const MAX: Self = 3.40282347E+38f32

source§

const MIN: Self = -3.40282347E+38f32

source§

const ZERO: Self = 0f32

source§

const ONE: Self = 1f32

source§

const IS_FLOAT: bool = true

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: Self) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> Self

source§

impl CType for f64

source§

const TYPE: &'static str = "double"

source§

const MAX: Self = 1.7976931348623157E+308f64

source§

const MIN: Self = -1.7976931348623157E+308f64

source§

const ZERO: Self = 0f64

source§

const ONE: Self = 1f64

source§

const IS_FLOAT: bool = true

§

type Float = f64

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: Self) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> Self

source§

impl CType for i8

source§

const TYPE: &'static str = "char"

source§

const MAX: Self = 127i8

source§

const MIN: Self = -128i8

source§

const ZERO: Self = 0i8

source§

const ONE: Self = 1i8

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for i16

source§

const TYPE: &'static str = "short"

source§

const MAX: Self = 32_767i16

source§

const MIN: Self = -32_768i16

source§

const ZERO: Self = 0i16

source§

const ONE: Self = 1i16

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for i32

source§

const TYPE: &'static str = "int"

source§

const MAX: Self = 2_147_483_647i32

source§

const MIN: Self = -2_147_483_648i32

source§

const ZERO: Self = 0i32

source§

const ONE: Self = 1i32

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for i64

source§

const TYPE: &'static str = "long"

source§

const MAX: Self = 9_223_372_036_854_775_807i64

source§

const MIN: Self = -9_223_372_036_854_775_808i64

source§

const ZERO: Self = 0i64

source§

const ONE: Self = 1i64

source§

const IS_FLOAT: bool = false

§

type Float = f64

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f64) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f64

source§

impl CType for u8

source§

const TYPE: &'static str = "uchar"

source§

const MAX: Self = 255u8

source§

const MIN: Self = 0u8

source§

const ZERO: Self = 0u8

source§

const ONE: Self = 1u8

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for u16

source§

const TYPE: &'static str = "ushort"

source§

const MAX: Self = 65_535u16

source§

const MIN: Self = 0u16

source§

const ZERO: Self = 0u16

source§

const ONE: Self = 1u16

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for u32

source§

const TYPE: &'static str = "uint"

source§

const MAX: Self = 4_294_967_295u32

source§

const MIN: Self = 0u32

source§

const ZERO: Self = 0u32

source§

const ONE: Self = 1u32

source§

const IS_FLOAT: bool = false

§

type Float = f32

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f32) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f32

source§

impl CType for u64

source§

const TYPE: &'static str = "ulong"

source§

const MAX: Self = 18_446_744_073_709_551_615u64

source§

const MIN: Self = 0u64

source§

const ZERO: Self = 0u64

source§

const ONE: Self = 1u64

source§

const IS_FLOAT: bool = false

§

type Float = f64

source§

fn from_f64(float: f64) -> Self

source§

fn from_float(float: f64) -> Self

source§

fn abs(self) -> Self

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn min(l: Self, r: Self) -> Self

source§

fn max(l: Self, r: Self) -> Self

source§

fn pow(self, exp: Self) -> Self

source§

fn round(self) -> Self

source§

fn to_f64(self) -> f64

source§

fn to_float(self) -> f64

Implementors§