matrix test to pass

This commit is contained in:
Quaternions 2024-08-30 13:07:56 -07:00
parent 0f0d7f7a9a
commit 88acec5659

View File

@ -1,7 +1,7 @@
use fixed_wide_traits::wide::WideMul; use fixed_wide_traits::wide::WideMul;
use fixed_wide_traits::wide::WideDot; use fixed_wide_traits::wide::WideDot;
use crate::Vector3; use crate::{Vector2,Vector3,Matrix3};
type Planar64=fixed_wide::types::I32F32; type Planar64=fixed_wide::types::I32F32;
type Planar64Wide1=fixed_wide::types::I64F64; type Planar64Wide1=fixed_wide::types::I64F64;
@ -51,15 +51,17 @@ fn wide_vec3_length_squared(){
} }
#[test] #[test]
fn wide_matrix_dot_vs_vec_of_vec_dot(){ fn wide_vec_of_vec_dot(){
let vv=Vector3::<crate::Vector2<_>>::from_value_2d(Planar64::from(3)); let vv=Vector3::<Vector2<_>>::from_value_2d(Planar64::from(3));
// do the dot product of the inner vectors multiplied component wise // do the dot product of the inner vectors multiplied component wise
// this lowers the rank of the data structure and is kind of a weird operation lol // this lowers the rank of the data structure and is kind of a weird operation lol
let vv_dot=vv.wide_dot(vv); let vv_dot=vv.wide_dot(vv);
assert_eq!(vv_dot,crate::Vector2::from_value(Planar64Wide1::from(3i128.pow(3)))); assert_eq!(vv_dot,Vector2::from_value(Planar64Wide1::from(3i128.pow(3))));
}
//let m=Matrix3::<Vector3<_>>::from_value_2d(Planar64::from(3)); #[test]
//normal matrix product fn wide_matrix_dot(){
//let m_dot=m.wide_dot(m); let m=Matrix3::<Vector3<_>>::from_value_2d(Planar64::from(3));
//assert_eq!(m_dot,Vector3::from_value(Planar64Wide1::from(3i128.pow(3)))); //normal matrix product
let m_dot=m.wide_dot(m);
assert_eq!(m_dot,Matrix3::<Vector3<_>>::from_value_2d(Planar64Wide1::from(3i128.pow(2))));
} }