mod mul_impl;
mod add_impl;
mod lambda;
mod map;
use crate::matrix_impl::Matrix;
#[derive(Debug, PartialEq, Eq, Clone, Default)]
pub struct Vector<T>
{
list : Vec<T>
}
impl<T> Vector<T>
{
pub fn into_col_matrix(self) -> Matrix<T> {
let mut matrix = Vec::with_capacity(self.len());
for param in self.list {
matrix.push(vec![param])
}
Matrix::from(matrix)
}
pub fn into_row_matrix(self) -> Matrix<T> {
Matrix::from(vec![self.list])
}
pub fn len(&self) -> usize {
self.list.len()
}
pub fn list(&self) -> &Vec<T> {
&self.list
}
pub fn into_inner(self) -> Vec<T> {
self.list
}
}
impl<T> From<Vec<T>> for Vector<T>
{
fn from(vec: Vec<T>) -> Self {
Vector {
list : vec
}
}
}