extendr_api::scalar::rcplx_full

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

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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.

Source§

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.

Source§

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.

Source§

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.

Source§

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

Source§

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

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

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

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

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