Skip to main content

Grid2

Struct Grid2 

Source
pub struct Grid2<T = f64> { /* private fields */ }
Expand description

2 次元の格子の値。座標の並び x(長さ nx)・y(長さ ny)と、行優先の値 data(長さ nx·ny、行 = y)

Implementations§

Source§

impl<T> Grid2<T>

Source

pub fn new(x: Vec<f64>, y: Vec<f64>, data: Vec<T>) -> Grid2<T>

座標と行優先の値から作る(長さが合わなければ panic: 作る側の誤り)

Source

pub fn from_rows(x: Vec<f64>, y: Vec<f64>, rows: Vec<Vec<T>>) -> Grid2<T>

行の並び(rows[iy][ix])から作る

Source

pub fn nx(&self) -> usize

x の標本の数(列の数)

Source

pub fn ny(&self) -> usize

y の標本の数(行の数)

Source

pub fn x(&self) -> &[f64]

x の座標の並び

Source

pub fn y(&self) -> &[f64]

y の座標の並び

Source

pub fn data(&self) -> &[T]

行優先の値(data[iy * nx + ix])

Source

pub fn data_mut(&mut self) -> &mut [T]

Source

pub fn into_parts(self) -> (Vec<f64>, Vec<f64>, Vec<T>)

(x, y, 行優先の値) に分ける

Source

pub fn get(&self, ix: usize, iy: usize) -> &T

値 (ix, iy)

Source

pub fn row(&self, iy: usize) -> &[T]

行 iy(y = y[iy] の値の並び)

Source

pub fn rows(&self) -> impl ExactSizeIterator

行の並び(y の順)

Source

pub fn map<U>(&self, f: impl FnMut(&T) -> U) -> Grid2<U>

値ごとに f をかけた同じ座標の格子

Source§

impl<T> Grid2<T>
where T: Clone,

Source

pub fn to_rows(&self) -> Vec<Vec<T>>

行の並び(rows[iy][ix])に写す

Source§

impl Grid2

Source

pub fn max(&self) -> f64

有限の値の最大(無ければ −∞)

Trait Implementations§

Source§

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

Source§

fn clone(&self) -> Grid2<T>

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<T> Debug for Grid2<T>
where T: Debug,

Source§

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

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

impl<T> Index<usize> for Grid2<T>

行 iy(g[iy][ix] で値を引ける)

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, iy: usize) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<usize> for Grid2<T>

Source§

fn index_mut(&mut self, iy: usize) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> PartialEq for Grid2<T>
where T: PartialEq,

Source§

fn eq(&self, other: &Grid2<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<T> StructuralPartialEq for Grid2<T>
where T: PartialEq,

Auto Trait Implementations§

§

impl<T> Freeze for Grid2<T>

§

impl<T> RefUnwindSafe for Grid2<T>
where T: RefUnwindSafe,

§

impl<T> Send for Grid2<T>
where T: Send,

§

impl<T> Sync for Grid2<T>
where T: Sync,

§

impl<T> Unpin for Grid2<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Grid2<T>

§

impl<T> UnwindSafe for Grid2<T>
where 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
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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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
§

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

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.