Skip to content

Commit 824c4e5

Browse files
committed
Update samba & nalgebra
1 parent e47185c commit 824c4e5

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ rand = { version = "0.8", optional = true }
2323

2424
num-traits = { version = "0.2", default-features = false, features = ["std"], optional = true }
2525

26-
nalgebra = { version = "0.32", optional = true }
26+
nalgebra = { version = "0.33", optional = true }
2727

28-
simba = { version = "0.8", optional = true, default-features = false }
28+
simba = { version = "0.9", optional = true, default-features = false }
2929
approx = { version = "0.5", optional = true, default-features = false }
3030
rug = { version = "1.15", optional = true }
3131

src/regression.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ pub mod arbitrary_linear_algebra {
984984
/// The default precision.
985985
///
986986
/// This is thread-local.
987-
pub static DEFAULT_PRECISION: RefCell<u32> = RefCell::new(256);
987+
pub static DEFAULT_PRECISION: RefCell<u32> = const { RefCell::new(256) };
988988
}
989989
/// Set the default precision **for this thread**.
990990
pub fn set_default_precision(new: u32) {
@@ -1022,6 +1022,24 @@ pub mod arbitrary_linear_algebra {
10221022
rug::Float::with_val(default_precision(), element).into()
10231023
}
10241024
}
1025+
impl simba::scalar::SupersetOf<f32> for FloatWrapper {
1026+
fn is_in_subset(&self) -> bool {
1027+
self.0.prec() <= 24
1028+
}
1029+
fn to_subset(&self) -> Option<f32> {
1030+
if simba::scalar::SupersetOf::<f32>::is_in_subset(self) {
1031+
Some(self.0.to_f32())
1032+
} else {
1033+
None
1034+
}
1035+
}
1036+
fn to_subset_unchecked(&self) -> f32 {
1037+
self.0.to_f32()
1038+
}
1039+
fn from_subset(element: &f32) -> Self {
1040+
rug::Float::with_val(default_precision(), element).into()
1041+
}
1042+
}
10251043
impl simba::scalar::SubsetOf<Self> for FloatWrapper {
10261044
fn to_superset(&self) -> Self {
10271045
self.clone()
@@ -1052,10 +1070,7 @@ pub mod arbitrary_linear_algebra {
10521070
type Element = FloatWrapper;
10531071
type SimdBool = bool;
10541072

1055-
#[inline(always)]
1056-
fn lanes() -> usize {
1057-
1
1058-
}
1073+
const LANES: usize = 1;
10591074

10601075
#[inline(always)]
10611076
fn splat(val: Self::Element) -> Self {

0 commit comments

Comments
 (0)