/// Builds a swirlchoron group. This is the diploid group construction from
/// "On Quaternions and Octonions" by John H. Conway and Derek A. Smith.
///
/// This method allows to specify a homomorphism between both rotation
/// groups and some abstract group.
///
/// # Panics
/// This method will panic if the groups are not 3-dimensional.
///
/// # Safety
/// Both groups must be rotation groups, and the passed functions must be
/// group homomorphisms.
Builds a swirlchoron group. This is the diploid group construction from
"On Quaternions and Octonions" by John H. Conway and Derek A. Smith.

This method allows to specify a homomorphism between both rotation
groups and some abstract group.
Builds a swirlchoron group . This is the diploid group construction from " On Quaternions and Octonions " by John H . Conway and Derek A . Smith . This method allows to specify a homomorphism between both rotation groups and some abstract group .
pub unsafe fn swirl_hom<
        U: GroupItem + 'static, //why static?
        J: Iterator<Item = Matrix<T>>,
        A: FnMut(&Matrix<T>) -> U,
        B: FnMut(&Matrix<T>) -> U,
    >(
        self,
        g: Group<J>,
        mut alpha: A,
        mut beta: B,
    ) -> Group<impl Iterator<Item = Matrix<T>>> {
        assert_eq!(self.dim, 3);
        assert_eq!(g.dim, 3);
        Group::new(
            4,
            (
                self.map(|mat| (alpha(&mat), mat_to_quat(&mat)))
                    .collect::<Vec<_>>(),
                g.map(|mat| (beta(&mat), mat_to_quat(&mat)))
                    .collect::<Vec<_>>(),
            )
                .into_pairs()
                .filter_map(|(alpha, q), (beta, r)| {
                    (alpha.eq(beta)).then(|| {
                        let prod = mat_from_quats(q.quaternion(), r.quaternion());
                        array::IntoIter::new([-&prod, prod])
                    })
                })
                .flatten(),
        )
    }
pub unsafe fn swirl_hom < U : GroupItem + ' static , //why static? J : Iterator < Item = Matrix < T > > , A : FnMut ( & Matrix < T > ) -> U , B : FnMut ( & Matrix < T > ) -> U , > ( self , g : Group < J > , mut alpha : A , mut beta : B , ) -> Group < impl Iterator < Item = Matrix < T > > > { assert_eq ! ( self dim 3 ) ; assert_eq ! ( g dim 3 ) ; Group :: new ( 4 , ( self . map ( | mat | ( alpha ( & mat ) , mat_to_quat ( & mat ) ) ) . collect :: < Vec < _ > > ( ) , g . map ( | mat | ( beta ( & mat ) , mat_to_quat ( & mat ) ) ) . collect :: < Vec < _ > > ( ) , ) . into_pairs ( ) . filter_map ( | ( alpha , q ) , ( beta , r ) | { ( alpha . eq ( beta ) ) . then ( | | { let prod = mat_from_quats ( q . quaternion ( ) , r . quaternion ( ) ) ; array :: IntoIter :: new ( [ - & prod , prod ] ) } ) } ) . flatten ( ) , ) }
Builds a swirlchoron group.
Builds a swirlchoron group .
self
g
Group<J>
alpha
A
beta
B
panics
This method will panic if the groups are not 3-dimensional.
This method will panic if the groups are not 3 - dimensional .
safety
Both groups must be rotation groups, and the passed functions must be
group homomorphisms.
Both groups must be rotation groups and the passed functions must be group homomorphisms .