Skip to content

Commit

Permalink
full piv lu
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-quinones committed Oct 12, 2024
1 parent 1ee3003 commit bbdbb44
Show file tree
Hide file tree
Showing 4 changed files with 904 additions and 7 deletions.
58 changes: 58 additions & 0 deletions faer-traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,34 @@ macro_rules! help2 {
}};
}

#[allow(unused_macros)]
macro_rules! send2 {
($place: expr) => {
$crate::utils::send::<$C, _>($place)
};
}

#[allow(unused_macros)]
macro_rules! unsend2 {
($place: expr) => {
$crate::utils::unsend::<$C, _>($place)
};
}

#[allow(unused_macros)]
macro_rules! sync2 {
($place: expr) => {
$crate::utils::sync::<$C, _>($place)
};
}

#[allow(unused_macros)]
macro_rules! unsync2 {
($place: expr) => {
$crate::utils::unsync::<$C, _>($place)
};
}

#[allow(unused_macros)]
macro_rules! by_ref2 {
($place: expr) => {
Expand Down Expand Up @@ -1072,6 +1100,10 @@ impl<C: ComplexContainer, T: ComplexField<C>, S: Simd> SimdCtx<C, T, S> {
pub fn and_mask(&self, lhs: T::SimdMask<S>, rhs: T::SimdMask<S>) -> T::SimdMask<S> {
T::simd_and_mask(&self.0, lhs, rhs)
}
#[inline(always)]
pub fn first_true_mask(&self, value: T::SimdMask<S>) -> usize {
T::simd_first_true_mask(&self.0, value)
}

#[inline(always)]
pub unsafe fn mask_load(
Expand Down Expand Up @@ -1365,6 +1397,10 @@ impl<C: ComplexContainer, T: ComplexField<C>, S: Simd> SimdCtxCopy<C, T, S> {
T::simd_and_mask(&self.0, lhs, rhs)
}
#[inline(always)]
pub fn first_true_mask(&self, value: T::SimdMask<S>) -> usize {
T::simd_first_true_mask(&self.0, value)
}
#[inline(always)]
pub unsafe fn mask_load(
&self,
mask: T::SimdMask<S>,
Expand Down Expand Up @@ -2290,6 +2326,8 @@ pub trait ComplexField<C: ComplexContainer = Unit>:
lhs: Self::SimdMask<S>,
rhs: Self::SimdMask<S>,
) -> Self::SimdMask<S>;
fn simd_first_true_mask<S: Simd>(ctx: &Self::SimdCtx<S>, value: Self::SimdMask<S>) -> usize;

fn simd_head_mask<S: Simd>(ctx: &Self::SimdCtx<S>, len: usize) -> Self::SimdMask<S>;
unsafe fn simd_mask_load<S: Simd>(
ctx: &Self::SimdCtx<S>,
Expand Down Expand Up @@ -3037,6 +3075,11 @@ impl<C: RealContainer, T: RealField<C>> ComplexField<Complex<C>> for T {
) -> Self::SimdMask<S> {
T::simd_and_mask(ctx, lhs, rhs)
}

#[inline(always)]
fn simd_first_true_mask<S: Simd>(ctx: &Self::SimdCtx<S>, value: Self::SimdMask<S>) -> usize {
T::simd_first_true_mask(ctx, value)
}
}

impl AsRef<Unit> for Unit {
Expand Down Expand Up @@ -3453,6 +3496,11 @@ impl ComplexField for f32 {
) -> Self::SimdMask<S> {
simd.and_m32s(lhs, rhs)
}

#[inline(always)]
fn simd_first_true_mask<S: Simd>(ctx: &Self::SimdCtx<S>, value: Self::SimdMask<S>) -> usize {
ctx.first_true_m32s(value)
}
}

impl RealField for f32 {
Expand Down Expand Up @@ -3891,6 +3939,11 @@ impl ComplexField for f64 {
) -> Self::SimdMask<S> {
simd.and_m64s(lhs, rhs)
}

#[inline(always)]
fn simd_first_true_mask<S: Simd>(ctx: &Self::SimdCtx<S>, value: Self::SimdMask<S>) -> usize {
ctx.first_true_m64s(value)
}
}

impl RealField for f64 {
Expand Down Expand Up @@ -4405,6 +4458,11 @@ impl<T: EnableComplex> ComplexField for Complex<T> {
) -> Self::SimdMask<S> {
T::simd_and_mask(simd, lhs, rhs)
}

#[inline(always)]
fn simd_first_true_mask<S: Simd>(ctx: &Self::SimdCtx<S>, value: Self::SimdMask<S>) -> usize {
T::simd_first_true_mask(ctx, value)
}
}

impl EnableComplex for f32 {
Expand Down
8 changes: 4 additions & 4 deletions faer/src/linalg/cholesky/ldlt/factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ pub(crate) fn cholesky_recursion<'N, C: ComplexContainer, T: ComplexField<C>>(
ghost_tree!(FULL(MAT(HEAD, TAIL)), {
let (full, FULL) = N.full(FULL);
let j = full.from_local(j);
let (mat, MAT) = full.segment(j.into(), full.from_local_inc(j_next), FULL.MAT);
let (mat, MAT) = full.segment(j.into(), full.from_local_inc(N.end()), FULL.MAT);

let j_next = mat.idx_inc(*j_next);
let (disjoint, head, tail, _, _) = mat.split_inc(j_next, MAT.HEAD, MAT.TAIL);
Expand Down Expand Up @@ -637,8 +637,8 @@ impl Default for LdltParams {
#[inline]
fn default() -> Self {
Self {
recursion_threshold: NonZero::new(64).unwrap(),
blocksize: NonZero::new(128).unwrap(),
recursion_threshold: NonZero::new(2).unwrap(),
blocksize: NonZero::new(2).unwrap(),
}
}
}
Expand Down Expand Up @@ -776,7 +776,7 @@ mod tests {
type C = faer_traits::Unit;
type T = c64;

for n in [2, 127, 240] {
for n in [2, 4, 8, 31, 127, 240] {
with_dim!(N, n);

for llt in [false, true] {
Expand Down
Loading

0 comments on commit bbdbb44

Please sign in to comment.