Fixed Subset for Matrix

This commit is contained in:
Yuri Edward 2021-10-21 15:56:07 +02:00
parent 4466fb2514
commit b91ead7971

View File

@ -5,7 +5,7 @@ use simba::simd::PrimitiveSimdValue;
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::dimension::{DimNameAdd, DimNameSum, U1}; use crate::base::dimension::{DimNameAdd, DimNameSum, U1};
use crate::base::{Const, DefaultAllocator, DimName, OMatrix, OVector, SVector, Scalar}; use crate::base::{Const, DefaultAllocator, OMatrix, OVector, SVector, Scalar};
use crate::geometry::{Scale, SuperTCategoryOf, TAffine, Transform}; use crate::geometry::{Scale, SuperTCategoryOf, TAffine, Transform};
use crate::Point; use crate::Point;
@ -77,8 +77,6 @@ where
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
+ Allocator<T1, DimNameSum<Const<D>, U1>, U1> + Allocator<T1, DimNameSum<Const<D>, U1>, U1>
+ Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>, + Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
// + Allocator<T1, D>
// + Allocator<T2, D>
{ {
#[inline] #[inline]
fn to_superset(&self) -> OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> { fn to_superset(&self) -> OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> {
@ -87,14 +85,17 @@ where
#[inline] #[inline]
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool { fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
let id = m.generic_slice((0, 0), (DimNameSum::<Const<D>, U1>::name(), Const::<D>)); if m[(D, D)] != T2::one() {
return false;
// Scalar types agree. }
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) && for i in 0..D + 1 {
// The block part does nothing. for j in 0..D + 1 {
id.is_identity(T2::zero()) && if i != j && m[(i, j)] != T2::zero() {
// The normalization factor is one. return false;
m[(D, D)] == T2::one() }
}
}
return true;
} }
#[inline] #[inline]