[−][src]Module peroxide::traits::pointer
Pointer toolbox
Redox
Type
ⓘThis example is not tested
pub struct Redox<T: Vector> { data: Box<T> }
Description
Operation with Vec<_>
is too bothered. For example, next code generates error.
ⓘThis example deliberately fails to compile
#[macro_use] extern crate peroxide; use peroxide::prelude::*; fn main() { let a = c!(1, 2, 3); assert_eq!(a * 2f64 - 1f64, c!(1, 3, 5)); }
Because we can't implement Mul<Vec<f64>> for f64
and vice versa.
Redox<T: Vector>
makes the situation easy.
Usage
ox()
:Vector
toRedox<T: Vector>
red()
:Redox<T: Vector>
toT
(Ofcourse,T
should be sized)
#[macro_use] extern crate peroxide; use peroxide::fuga::*; fn main() { let a = c!(1, 2, 3); assert_eq!((a.ox() * 2f64 - 1f64).red(), c!(1, 3, 5)); }
ox()
and red()
come from oxidation and reduction.
Structs
Redox |
Traits
MatrixPtr | Pointer for col or row |
Oxide |