2023-05-06 07:39:06 +00:00
|
|
|
#[macro_use]
|
|
|
|
mod common;
|
|
|
|
|
|
|
|
use common::Approx;
|
2022-08-19 04:07:05 +00:00
|
|
|
use generic_parameterize::parameterize;
|
2022-11-28 05:20:15 +00:00
|
|
|
use num_traits::real::Real;
|
2022-12-04 00:56:39 +00:00
|
|
|
use num_traits::Zero;
|
2022-08-19 04:07:05 +00:00
|
|
|
use std::fmt::Debug;
|
2022-12-05 04:24:57 +00:00
|
|
|
use std::iter::{zip, Product, Sum};
|
2022-08-19 04:07:05 +00:00
|
|
|
use std::ops;
|
2023-05-06 08:34:31 +00:00
|
|
|
use vector_victor::{Matrix, Vector};
|
2022-08-19 04:07:05 +00:00
|
|
|
|
2023-05-06 07:39:06 +00:00
|
|
|
#[parameterize(S = (i32, f32, f64, u32), M = [1,4], N = [1,4])]
|
2022-08-19 04:07:05 +00:00
|
|
|
#[test]
|
2022-11-17 06:53:53 +00:00
|
|
|
fn test_add<S: Copy + From<u16> + PartialEq + Debug, const M: usize, const N: usize>()
|
2022-08-19 04:07:05 +00:00
|
|
|
where
|
|
|
|
Matrix<S, M, N>: ops::Add<Output = Matrix<S, M, N>>,
|
|
|
|
{
|
|
|
|
let a = Matrix::<S, M, N>::fill(S::from(1));
|
|
|
|
let b = Matrix::<S, M, N>::fill(S::from(3));
|
|
|
|
let c: Matrix<S, M, N> = a + b;
|
2023-05-06 07:39:06 +00:00
|
|
|
for (_, ci) in c.elements().enumerate() {
|
2022-08-19 04:07:05 +00:00
|
|
|
assert_eq!(*ci, S::from(4));
|
|
|
|
}
|
|
|
|
}
|