pub struct Vector<T> {
pub content: Vec<T>,
/* private fields */
}
Expand description
Math Vector
Fields
content: Vec<T>
Implementations
Create the Vector
Examples
use lemonmath::vectors::Vector;
let x = Vector::new(vec![1.0, 2.0, 3.0, 4.0, 5.0], true);
assert_eq!(x.content, vec![1.0, 2.0, 3.0, 4.0, 5.0]);
Push new values into the vector
Examples
use lemonmath::vectors::Vector;
let mut vector = Vector::new(vec![1.0, 2.0, 3.0, 4.0, 5.0], true);
vector.push(6.0);
assert_eq!(vector.content, vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0]);
Switch between column and row vector
Examples
use lemonmath::vectors::Vector;
let mut vector1 = Vector::new(vec![1.0, 2.0, 3.0, 4.0, 5.0], true);
let vector2 = Vector::new(vec![1.0, 2.0, 3.0, 4.0, 5.0], false);
vector1.transpose();
assert_eq!(format!("{}", vector1), format!("{}", vector2));
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for Vector<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Vector<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more