update tests to use new ideas

This commit is contained in:
Quaternions 2024-09-09 16:55:44 -07:00
parent 53bb1522eb
commit b6d260bf2c

View File

@ -8,9 +8,9 @@ type Planar64Wide3=fixed_wide::types::I256F256;
#[test] #[test]
fn wide_vec3(){ fn wide_vec3(){
let v=Vector3::from_value(Planar64::from(3)); let v=Vector3::from_value(Planar64::from(3));
let v1=v.wide_mul_1_1(v); let v1=v*v;
let v2=v1.wide_mul_2_2(v1); let v2=v1*v1;
let v3=v2.wide_mul_4_4(v2); let v3=v2*v2;
assert_eq!(v3.array,Vector3::from_value(Planar64Wide3::from(3i128.pow(8))).array); assert_eq!(v3.array,Vector3::from_value(Planar64Wide3::from(3i128.pow(8))).array);
} }
@ -18,9 +18,9 @@ fn wide_vec3(){
#[test] #[test]
fn wide_vec3_dot(){ fn wide_vec3_dot(){
let v=Vector3::from_value(Planar64::from(3)); let v=Vector3::from_value(Planar64::from(3));
let v1=v.wide_mul_1_1(v); let v1=v*v;
let v2=v1.wide_mul_2_2(v1); let v2=v1*v1;
let v3=v2.wide_dot_4_4(v2); let v3=v2.dot(v2);
assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3)); assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3));
} }
@ -28,9 +28,9 @@ fn wide_vec3_dot(){
#[test] #[test]
fn wide_vec3_length_squared(){ fn wide_vec3_length_squared(){
let v=Vector3::from_value(Planar64::from(3)); let v=Vector3::from_value(Planar64::from(3));
let v1=v.wide_mul_1_1(v); let v1=v*v;
let v2=v1.wide_mul_2_2(v1); let v2=v1*v1;
let v3=v2.wide_length_squared(); let v3=v2.length_squared();
assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3)); assert_eq!(v3,Planar64Wide3::from(3i128.pow(8)*3));
} }
@ -49,7 +49,7 @@ fn wide_matrix_dot(){
[Planar64::from(7),Planar64::from(8)], [Planar64::from(7),Planar64::from(8)],
]); ]);
// Mat3<Vec4>.dot(Mat4<Vec2>) -> Mat3<Vec2> // Mat3<Vec4>.dot(Mat4<Vec2>) -> Mat3<Vec2>
let m_dot=lhs.wide_dot_1_1(rhs); let m_dot=lhs.dot(rhs);
//In[1]:= {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}} . {{1, 2}, {3, 4}, {5, 6}, {7, 8}} //In[1]:= {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}} . {{1, 2}, {3, 4}, {5, 6}, {7, 8}}
//Out[1]= {{50, 60}, {114, 140}, {178, 220}} //Out[1]= {{50, 60}, {114, 140}, {178, 220}}
assert_eq!( assert_eq!(