removed some unnecessary code

This commit is contained in:
Joshua Smith 2022-03-25 19:14:51 -05:00
parent d4cba8f76f
commit bffc316f87
1 changed files with 2 additions and 54 deletions

View File

@ -118,7 +118,8 @@ impl<T:RealField, const D: usize> Rotation<T,D> where
pub fn general_pow(self, t:T) -> Self { pub fn general_pow(self, t:T) -> Self {
if D<=1 { return self; } if D<=1 { return self; }
// println!("r:{}", self); println!("r:{}", self);
println!("{}", self.clone().into_inner().hessenberg().unpack_h());
//taking the (real) schur form is guaranteed to produce a block-diagonal matrix //taking the (real) schur form is guaranteed to produce a block-diagonal matrix
//where each block is either a 1 (if there's no rotation in that axis) or a 2x2 //where each block is either a 1 (if there's no rotation in that axis) or a 2x2
@ -165,56 +166,3 @@ impl<T:RealField, const D: usize> Rotation<T,D> where
} }
} }
#[cfg(test)]
mod tests {
use super::*;
use std::f64::consts::PI;
const EPS: f64 = 2E-10;
#[test]
fn rot_pow() {
let r1 = Rotation2::new(0.0);
let r2 = Rotation2::new(PI/4.0);
let r3 = Rotation2::new(PI/2.0);
assert_relative_eq!(r1.general_pow(0.5), r1, epsilon=EPS);
assert_relative_eq!(r3.general_pow(0.5), r2, epsilon=EPS);
}
#[test]
fn basis_rot() {
const D:usize = 4;
let basis_blades = |n| (0..n).flat_map(
move |i| (i..n).map(move |j| (i,j))
).filter(|(i,j)| i!=j);
for (i1,j1) in basis_blades(D) {
for (i2,j2) in basis_blades(D) {
if i1==i2 || j1==j2 || i1==j2 || j1==i2 { continue; }
let r1 = Rotation::<_,D>::basis_rot(i1,j1,PI/4.0) *
Rotation::<_,D>::basis_rot(i2,j2,PI/4.0);
let r2 = Rotation::<_,D>::basis_rot(i1,j1,PI/2.0) *
Rotation::<_,D>::basis_rot(i2,j2,PI/2.0);
println!("{}{}",r1,r2);
assert_relative_eq!(r2.general_pow(0.5), r1, epsilon=EPS);
}
}
}
}