Struct extendr_api::scalar::rcplx_full::Rcplx

source ·
#[repr(transparent)]
pub struct Rcplx(c64);
Expand description

Rcplx is a wrapper for f64 in the context of an R’s complex vector.

Rcplx has a special NA value, obtained from R headers via R_NaReal.

Rcplx has the same footprint as R’s complex value allowing us to use it in zero copy slices.

Tuple Fields§

§0: c64

Implementations§

source§

impl Rcplx

source

pub fn new(re: f64, im: f64) -> Self

source

pub fn is_nan(&self) -> bool

source

pub fn is_infinite(&self) -> bool

source

pub fn re(&self) -> Rfloat

source

pub fn im(&self) -> Rfloat

Trait Implementations§

source§

impl Add<Complex<f64>> for Rcplx

source§

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

Add two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the + operator.
source§

impl Add<Rcplx> for &Rcplx

source§

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

Add two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the + operator.
source§

impl Add<Rcplx> for c64

source§

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

Add two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the + operator.
source§

impl Add for Rcplx

source§

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

Add two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the + operator.
source§

impl AddAssign<Complex<f64>> for &mut Rcplx

source§

fn add_assign(&mut self, other: c64)

Add two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl AddAssign<Complex<f64>> for Rcplx

source§

fn add_assign(&mut self, other: c64)

Add two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl AddAssign<Rcplx> for &mut Rcplx

source§

fn add_assign(&mut self, other: Rcplx)

Add two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl AddAssign<Rcplx> for Option<c64>

source§

fn add_assign(&mut self, other: Rcplx)

Add two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl AddAssign for Rcplx

source§

fn add_assign(&mut self, other: Rcplx)

Add two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl<'a> AsTypedSlice<'a, Rcplx> for Robj
where Self: 'a,

source§

fn as_typed_slice(&self) -> Option<&'a [Rcplx]>

source§

fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rcplx]>

source§

impl CanBeNA for Rcplx

use extendr_api::prelude::*;
test! {
    assert!((<Rcplx>::na()).is_na());
}
source§

fn is_na(&self) -> bool

Return true is the is a NA value.

source§

fn na() -> Self

Construct a NA.

source§

impl Clone for Rcplx

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Rcplx

source§

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

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

impl Default for Rcplx

use extendr_api::prelude::*;
test! {
    assert_eq!(<Rcplx>::default(), <c64>::default());
}
source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Div<Complex<f64>> for Rcplx

source§

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

Divide two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the / operator.
source§

impl Div<Rcplx> for &Rcplx

source§

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

Divide two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the / operator.
source§

impl Div<Rcplx> for c64

source§

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

Divide two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the / operator.
source§

impl Div for Rcplx

source§

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

Divide two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the / operator.
source§

impl DivAssign<Complex<f64>> for &mut Rcplx

source§

fn div_assign(&mut self, other: c64)

Divide two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl DivAssign<Complex<f64>> for Rcplx

source§

fn div_assign(&mut self, other: c64)

Divide two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl DivAssign<Rcplx> for &mut Rcplx

source§

fn div_assign(&mut self, other: Rcplx)

Divide two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl DivAssign<Rcplx> for Option<c64>

source§

fn div_assign(&mut self, other: Rcplx)

Divide two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl DivAssign for Rcplx

source§

fn div_assign(&mut self, other: Rcplx)

Divide two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl From<&Complex<f64>> for Rcplx

source§

fn from(v: &c64) -> Self

Converts to this type from the input type.
source§

impl From<(Rfloat, Rfloat)> for Rcplx

source§

fn from(val: (Rfloat, Rfloat)) -> Self

Converts to this type from the input type.
source§

impl From<(f64, f64)> for Rcplx

source§

fn from(val: (f64, f64)) -> Self

Converts to this type from the input type.
source§

impl From<Complex<f64>> for Rcplx

source§

fn from(v: c64) -> Self

Converts to this type from the input type.
source§

impl From<Option<&Complex<f64>>> for Rcplx

source§

fn from(v: Option<&c64>) -> Self

Converts to this type from the input type.
source§

impl From<Option<Complex<f64>>> for Rcplx

source§

fn from(v: Option<c64>) -> Self

Converts to this type from the input type.
source§

impl From<Rcomplex> for Rcplx

source§

fn from(val: Rcomplex) -> Self

Converts to this type from the input type.
source§

impl From<Rcplx> for Option<c64>

source§

fn from(val: Rcplx) -> Self

Converts to this type from the input type.
source§

impl From<Rfloat> for Rcplx

source§

fn from(val: Rfloat) -> Self

Converts to this type from the input type.
source§

impl From<f64> for Rcplx

source§

fn from(val: f64) -> Self

Converts to this type from the input type.
source§

impl FromIterator<Rcplx> for Complexes

source§

fn from_iter<T: IntoIterator<Item = Rcplx>>(iter: T) -> Self

A more generalised iterator collector for small vectors. Generates a non-ALTREP vector.

source§

impl Mul<Complex<f64>> for Rcplx

source§

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

Multiply two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the * operator.
source§

impl Mul<Rcplx> for &Rcplx

source§

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

Multiply two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the * operator.
source§

impl Mul<Rcplx> for c64

source§

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

Multiply two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the * operator.
source§

impl Mul for Rcplx

source§

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

Multiply two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the * operator.
source§

impl MulAssign<Complex<f64>> for &mut Rcplx

source§

fn mul_assign(&mut self, other: c64)

Multiply two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl MulAssign<Complex<f64>> for Rcplx

source§

fn mul_assign(&mut self, other: c64)

Multiply two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl MulAssign<Rcplx> for &mut Rcplx

source§

fn mul_assign(&mut self, other: Rcplx)

Multiply two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl MulAssign<Rcplx> for Option<c64>

source§

fn mul_assign(&mut self, other: Rcplx)

Multiply two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl MulAssign for Rcplx

source§

fn mul_assign(&mut self, other: Rcplx)

Multiply two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl Neg for &Rcplx

source§

fn neg(self) -> Self::Output

Negate a Rcplx value.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl Neg for Rcplx

source§

fn neg(self) -> Self::Output

Negate a Rcplx value.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl PartialEq<Complex<f64>> for Rcplx

use extendr_api::prelude::*;
test! {
    assert!(<Rcplx>::default().eq(&<c64>::default()));
}
source§

fn eq(&self, other: &c64) -> bool

NA always fails.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<Rcplx> for c64

use extendr_api::prelude::*;
test! {
    assert!(<c64>::default().eq(&<Rcplx>::default()));
}
source§

fn eq(&self, other: &Rcplx) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq<f64> for Rcplx

source§

fn eq(&self, other: &f64) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialEq for Rcplx

use extendr_api::prelude::*;
test! {
    assert!(<Rcplx>::default().eq(&<Rcplx>::default()));
    assert!(!<Rcplx>::na().eq(&<Rcplx>::na()));
}
source§

fn eq(&self, other: &Rcplx) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Scalar<Complex<f64>> for Rcplx

source§

fn inner(&self) -> c64

source§

fn new(val: c64) -> Self

source§

impl Sub<Complex<f64>> for Rcplx

source§

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

Subtract two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl Sub<Rcplx> for &Rcplx

source§

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

Subtract two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl Sub<Rcplx> for c64

source§

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

Subtract two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl Sub for Rcplx

source§

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

Subtract two Rcplx values or an option of c64.

§

type Output = Rcplx

The resulting type after applying the - operator.
source§

impl SubAssign<Complex<f64>> for &mut Rcplx

source§

fn sub_assign(&mut self, other: c64)

Subtract two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl SubAssign<Complex<f64>> for Rcplx

source§

fn sub_assign(&mut self, other: c64)

Subtract two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl SubAssign<Rcplx> for &mut Rcplx

source§

fn sub_assign(&mut self, other: Rcplx)

Subtract two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl SubAssign<Rcplx> for Option<c64>

source§

fn sub_assign(&mut self, other: Rcplx)

Subtract two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl SubAssign for Rcplx

source§

fn sub_assign(&mut self, other: Rcplx)

Subtract two Rcplx values or an option of c64, modifying the left-hand side in place. Overflows to NA.

source§

impl<'a> Sum<&'a Rcplx> for Rcplx

source§

fn sum<I: Iterator<Item = &'a Rcplx>>(iter: I) -> Rcplx

Yields NA on overflow if NAs present.

use extendr_api::prelude::*;
use std::iter::Sum;
test! {
    let z =Rcplx::default();
    let x = (0..100).map(|_| &z);
    assert_eq!(<Rcplx as Sum<& Rcplx>>::sum(x), <Rcplx>::default());
}
source§

impl Sum for Rcplx

source§

fn sum<I: Iterator<Item = Rcplx>>(iter: I) -> Rcplx

Yields NA on overflow if NAs present.

use extendr_api::prelude::*;
use std::iter::Sum;
test! {
    let x = (0..100).map(|x| Rcplx::default());
    assert_eq!(<Rcplx as Sum>::sum(x), <Rcplx>::default());
}
source§

impl ToVectorValue for &Rcplx

source§

fn sexptype() -> SEXPTYPE

source§

fn to_complex(&self) -> Rcomplex

source§

fn to_real(&self) -> f64
where Self: Sized,

source§

fn to_integer(&self) -> i32
where Self: Sized,

source§

fn to_logical(&self) -> i32
where Self: Sized,

source§

fn to_raw(&self) -> u8
where Self: Sized,

source§

fn to_sexp(&self) -> SEXP
where Self: Sized,

source§

impl ToVectorValue for Rcplx

source§

fn sexptype() -> SEXPTYPE

source§

fn to_complex(&self) -> Rcomplex

source§

fn to_real(&self) -> f64
where Self: Sized,

source§

fn to_integer(&self) -> i32
where Self: Sized,

source§

fn to_logical(&self) -> i32
where Self: Sized,

source§

fn to_raw(&self) -> u8
where Self: Sized,

source§

fn to_sexp(&self) -> SEXP
where Self: Sized,

source§

impl TryFrom<&Robj> for Rcplx

§

type Error = Error

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

fn try_from(robj: &Robj) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<Robj> for Rcplx

§

type Error = Error

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

fn try_from(robj: Robj) -> Result<Self>

Performs the conversion.
source§

impl Copy for Rcplx

Auto Trait Implementations§

§

impl Freeze for Rcplx

§

impl RefUnwindSafe for Rcplx

§

impl Send for Rcplx

§

impl Sync for Rcplx

§

impl Unpin for Rcplx

§

impl UnwindSafe for Rcplx

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<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> IntoRobj for T
where Robj: From<T>,

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

impl<T> Boilerplate for T
where T: Copy + Send + Sync + Debug + PartialEq + 'static,