Type Definition quantity::QuantityArray1
source · [−]pub type QuantityArray1<U> = QuantityArray<U, Ix1>;
Implementations
sourceimpl<U: Unit> QuantityArray1<U>
impl<U: Unit> QuantityArray1<U>
sourcepub fn linspace(
start: QuantityScalar<U>,
end: QuantityScalar<U>,
n: usize
) -> Result<Self, QuantityError>
pub fn linspace(
start: QuantityScalar<U>,
end: QuantityScalar<U>,
n: usize
) -> Result<Self, QuantityError>
Create a one-dimensional array with n evenly spaced elements from start
to end
(inclusive) if start
and end
have the same unit.
Example
let x = SIArray1::linspace(1.0 * METER, 3.0 * METER, 5)?;
assert_relative_eq!(x, &(arr1(&[1.0, 1.5, 2.0, 2.5, 3.0]) * METER));
sourcepub fn logspace(
start: QuantityScalar<U>,
end: QuantityScalar<U>,
n: usize
) -> Result<Self, QuantityError>
pub fn logspace(
start: QuantityScalar<U>,
end: QuantityScalar<U>,
n: usize
) -> Result<Self, QuantityError>
Create a one-dimensional array with n logarithmically spaced elements from start
to end
(inclusive) if start
and end
have the same unit.
Example
let x = SIArray1::logspace(1.0 * METER, 16.0 * METER, 5)?;
assert_relative_eq!(x, &(arr1(&[1.0, 2.0, 4.0, 8.0, 16.0]) * METER));
sourcepub fn from_vec(vec: Vec<QuantityScalar<U>>) -> Self
pub fn from_vec(vec: Vec<QuantityScalar<U>>) -> Self
Create a one-dimensional array from a vector of scalar quantities.
Trait Implementations
sourceimpl<U: Unit> FromIterator<Quantity<f64, U>> for QuantityArray1<U>
impl<U: Unit> FromIterator<Quantity<f64, U>> for QuantityArray1<U>
sourcefn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = QuantityScalar<U>>,
fn from_iter<I>(iter: I) -> Self where
I: IntoIterator<Item = QuantityScalar<U>>,
Creates a value from an iterator. Read more