fixup tests
This commit is contained in:
parent
56b781fcb8
commit
990a923463
@ -1,4 +1,4 @@
|
||||
use crate::types::{Vector2,Vector3,Vector4,Matrix3,Matrix4};
|
||||
use crate::types::{Matrix3,Matrix3x2,Matrix3x4,Matrix4x2,Vector3};
|
||||
|
||||
type Planar64=fixed_wide::types::I32F32;
|
||||
type Planar64Wide1=fixed_wide::types::I64F64;
|
||||
@ -37,16 +37,16 @@ fn wide_vec3_length_squared(){
|
||||
|
||||
#[test]
|
||||
fn wide_matrix_dot(){
|
||||
let lhs=Matrix3::from([
|
||||
Vector4::from([Planar64::from(1),Planar64::from(2),Planar64::from(3),Planar64::from(4)]),
|
||||
Vector4::from([Planar64::from(5),Planar64::from(6),Planar64::from(7),Planar64::from(8)]),
|
||||
Vector4::from([Planar64::from(9),Planar64::from(10),Planar64::from(11),Planar64::from(12)]),
|
||||
let lhs=Matrix3x4::new([
|
||||
[Planar64::from(1),Planar64::from(2),Planar64::from(3),Planar64::from(4)],
|
||||
[Planar64::from(5),Planar64::from(6),Planar64::from(7),Planar64::from(8)],
|
||||
[Planar64::from(9),Planar64::from(10),Planar64::from(11),Planar64::from(12)],
|
||||
]);
|
||||
let rhs=Matrix4::from([
|
||||
Vector2::from([Planar64::from(1),Planar64::from(2)]),
|
||||
Vector2::from([Planar64::from(3),Planar64::from(4)]),
|
||||
Vector2::from([Planar64::from(5),Planar64::from(6)]),
|
||||
Vector2::from([Planar64::from(7),Planar64::from(8)]),
|
||||
let rhs=Matrix4x2::new([
|
||||
[Planar64::from(1),Planar64::from(2)],
|
||||
[Planar64::from(3),Planar64::from(4)],
|
||||
[Planar64::from(5),Planar64::from(6)],
|
||||
[Planar64::from(7),Planar64::from(8)],
|
||||
]);
|
||||
// Mat3<Vec4>.dot(Mat4<Vec2>) -> Mat3<Vec2>
|
||||
let m_dot=lhs.wide_dot_3x4_4x2_1_1(rhs);
|
||||
@ -54,20 +54,20 @@ fn wide_matrix_dot(){
|
||||
//Out[1]= {{50, 60}, {114, 140}, {178, 220}}
|
||||
assert_eq!(
|
||||
m_dot,
|
||||
Matrix3::from([
|
||||
Vector2::from([Planar64Wide1::from(50),Planar64Wide1::from(60)]),
|
||||
Vector2::from([Planar64Wide1::from(114),Planar64Wide1::from(140)]),
|
||||
Vector2::from([Planar64Wide1::from(178),Planar64Wide1::from(220)]),
|
||||
Matrix3x2::new([
|
||||
[Planar64Wide1::from(50),Planar64Wide1::from(60)],
|
||||
[Planar64Wide1::from(114),Planar64Wide1::from(140)],
|
||||
[Planar64Wide1::from(178),Planar64Wide1::from(220)],
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wide_matrix_det(){
|
||||
let m=Matrix3::from([
|
||||
Vector3::from([Planar64::from(1),Planar64::from(2),Planar64::from(3)]),
|
||||
Vector3::from([Planar64::from(4),Planar64::from(5),Planar64::from(7)]),
|
||||
Vector3::from([Planar64::from(6),Planar64::from(8),Planar64::from(9)]),
|
||||
let m=Matrix3::new([
|
||||
[Planar64::from(1),Planar64::from(2),Planar64::from(3)],
|
||||
[Planar64::from(4),Planar64::from(5),Planar64::from(7)],
|
||||
[Planar64::from(6),Planar64::from(8),Planar64::from(9)],
|
||||
]);
|
||||
// In[2]:= Det[{{1, 2, 3}, {4, 5, 7}, {6, 8, 9}}]
|
||||
// Out[2]= 7
|
||||
@ -76,19 +76,19 @@ fn wide_matrix_det(){
|
||||
|
||||
#[test]
|
||||
fn wide_matrix_adjugate(){
|
||||
let m=Matrix3::from([
|
||||
Vector3::from([Planar64::from(1),Planar64::from(2),Planar64::from(3)]),
|
||||
Vector3::from([Planar64::from(4),Planar64::from(5),Planar64::from(7)]),
|
||||
Vector3::from([Planar64::from(6),Planar64::from(8),Planar64::from(9)]),
|
||||
let m=Matrix3::new([
|
||||
[Planar64::from(1),Planar64::from(2),Planar64::from(3)],
|
||||
[Planar64::from(4),Planar64::from(5),Planar64::from(7)],
|
||||
[Planar64::from(6),Planar64::from(8),Planar64::from(9)],
|
||||
]);
|
||||
// In[6]:= Adjugate[{{1, 2, 3}, {4, 5, 7}, {6, 8, 9}}]
|
||||
// Out[6]= {{-11, 6, -1}, {6, -9, 5}, {2, 4, -3}}
|
||||
assert_eq!(
|
||||
m.wide_adjugate_3x3_1(),
|
||||
Matrix3::from([
|
||||
Vector3::from([Planar64Wide1::from(-11),Planar64Wide1::from(6),Planar64Wide1::from(-1)]),
|
||||
Vector3::from([Planar64Wide1::from(6),Planar64Wide1::from(-9),Planar64Wide1::from(5)]),
|
||||
Vector3::from([Planar64Wide1::from(2),Planar64Wide1::from(4),Planar64Wide1::from(-3)]),
|
||||
Matrix3::new([
|
||||
[Planar64Wide1::from(-11),Planar64Wide1::from(6),Planar64Wide1::from(-1)],
|
||||
[Planar64Wide1::from(6),Planar64Wide1::from(-9),Planar64Wide1::from(5)],
|
||||
[Planar64Wide1::from(2),Planar64Wide1::from(4),Planar64Wide1::from(-3)],
|
||||
])
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user