Skip to content

Commit e49aa1f

Browse files
authored
v0.24.4 patch (#57)
* add to arrowspace config. bump version * minor changes
1 parent 83af932 commit e49aa1f

File tree

4 files changed

+70
-39
lines changed

4 files changed

+70
-39
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "arrowspace"
3-
version = "0.24.3"
3+
version = "0.24.4"
44
edition = "2024"
55
description = "Spectral vector search with taumode (λτ) indexing"
66
authors = ["Lorenzo <[email protected]>"]
@@ -26,7 +26,7 @@ exclude = [
2626

2727
[dependencies]
2828
rand = "0.9.2"
29-
smartcore = {version = "^0.4.5"}
29+
smartcore = {version = "^0.4.7"}
3030
ordered-float = "5.1.0"
3131
rayon = "1.11.0"
3232
sprs = "0.11.4"
@@ -48,7 +48,7 @@ csv = { version = "1.4.0", optional = true }
4848

4949
[dev-dependencies]
5050
criterion = "0.7.0"
51-
smartcore = {version = "^0.4.5", features = ["datasets"]}
51+
smartcore = {version = "^0.4.7", features = ["datasets"]}
5252
rand_pcg = "0.9.0"
5353
tempfile = "3.23.0"
5454
rand_xoshiro = "0.7.0"

src/builder.rs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,7 +1282,7 @@ impl ConfigValue {
12821282
pub fn as_bool(&self) -> Option<bool> {
12831283
match self {
12841284
ConfigValue::Bool(v) => Some(*v),
1285-
_ => None,
1285+
_ => panic!("called as_bool but it is not"),
12861286
}
12871287
}
12881288

@@ -1296,21 +1296,22 @@ impl ConfigValue {
12961296
None
12971297
}
12981298
}
1299-
_ => None,
1299+
_ => panic!("called as_usize but it is not"),
13001300
}
13011301
}
13021302

13031303
pub fn as_f64(&self) -> Option<f64> {
13041304
match self {
1305-
ConfigValue::F64(v) => Some(*v),
1306-
ConfigValue::OptionF64(v) => {
1307-
if v.is_some() {
1308-
Some(v.unwrap())
1309-
} else {
1310-
None
1311-
}
1312-
}
1313-
_ => None,
1305+
ConfigValue::F64(v) => match v {
1306+
val if val.is_nan() => Some(-1.0),
1307+
val => Some(*val),
1308+
},
1309+
ConfigValue::OptionF64(v) => match v {
1310+
Some(val) if val.is_nan() => Some(-1.0),
1311+
Some(val) => Some(*val),
1312+
None => None,
1313+
},
1314+
_ => panic!("called as_f64 but it is not"),
13141315
}
13151316
}
13161317

@@ -1324,7 +1325,7 @@ impl ConfigValue {
13241325
None
13251326
}
13261327
}
1327-
_ => None,
1328+
_ => panic!("called as_u64 but it is not"),
13281329
}
13291330
}
13301331

@@ -1400,6 +1401,10 @@ impl ArrowSpaceBuilder {
14001401
"use_dims_reduction".to_string(),
14011402
ConfigValue::Bool(self.use_dims_reduction),
14021403
);
1404+
config.insert(
1405+
"extra_dims_reduction".to_string(),
1406+
ConfigValue::Bool(self.extra_dims_reduction),
1407+
);
14031408
config.insert("rp_eps".to_string(), ConfigValue::F64(self.rp_eps));
14041409

14051410
config

src/core.rs

Lines changed: 47 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -416,9 +416,9 @@ impl Default for ArrowSpace {
416416
lambdas: Vec::new(),
417417
lambdas_sorted: SortedLambdas::new(),
418418
// lambdas normalisation
419-
min_lambdas: f64::NAN,
420-
max_lambdas: f64::NAN,
421-
range_lambdas: f64::NAN,
419+
min_lambdas: -1.0,
420+
max_lambdas: -1.0,
421+
range_lambdas: -1.0,
422422
// enable synthetic λ with Median τ by default
423423
taumode: TAUDEFAULT,
424424
// Clustering defaults
@@ -457,9 +457,9 @@ impl ArrowSpace {
457457
lambdas: vec![0.0; n_items], // will be computed later
458458
lambdas_sorted: SortedLambdas::new(),
459459
// lambdas normalisation
460-
min_lambdas: f64::NAN,
461-
max_lambdas: f64::NAN,
462-
range_lambdas: f64::NAN,
460+
min_lambdas: -1.0,
461+
max_lambdas: -1.0,
462+
range_lambdas: -1.0,
463463
taumode,
464464
// Clustering defaults
465465
n_clusters: 0,
@@ -634,9 +634,9 @@ impl ArrowSpace {
634634
lambdas,
635635
lambdas_sorted,
636636
// Normalization fields
637-
min_lambdas: f64::NAN,
638-
max_lambdas: f64::NAN,
639-
range_lambdas: f64::NAN,
637+
min_lambdas: -1.0,
638+
max_lambdas: -1.0,
639+
range_lambdas: -1.0,
640640
taumode,
641641
n_clusters,
642642
cluster_assignments: Vec::new(),
@@ -689,9 +689,9 @@ impl ArrowSpace {
689689
lambdas: vec![0.0; n_items], // will be computed later
690690
lambdas_sorted: SortedLambdas::new(),
691691
// lambdas normalisation
692-
min_lambdas: f64::NAN,
693-
max_lambdas: f64::NAN,
694-
range_lambdas: f64::NAN,
692+
min_lambdas: -1.0,
693+
max_lambdas: -1.0,
694+
range_lambdas: -1.0,
695695
taumode,
696696
// Clustering defaults
697697
n_clusters: 0,
@@ -763,9 +763,9 @@ impl ArrowSpace {
763763
lambdas: vec![0.0; n_items], // will be computed later
764764
lambdas_sorted: SortedLambdas::new(),
765765
// lambdas normalisation
766-
min_lambdas: f64::NAN,
767-
max_lambdas: f64::NAN,
768-
range_lambdas: f64::NAN,
766+
min_lambdas: -1.0,
767+
max_lambdas: -1.0,
768+
range_lambdas: -1.0,
769769
taumode: TAUDEFAULT,
770770
// Clustering defaults
771771
n_clusters: 0,
@@ -807,9 +807,9 @@ impl ArrowSpace {
807807
signals: sprs::CsMat::zero((0, 0)),
808808
lambdas: vec![0.0; nitems],
809809
lambdas_sorted: SortedLambdas::new(),
810-
min_lambdas: f64::NAN,
811-
max_lambdas: f64::NAN,
812-
range_lambdas: f64::NAN,
810+
min_lambdas: -1.0,
811+
max_lambdas: -1.0,
812+
range_lambdas: -1.0,
813813
taumode: TAUDEFAULT,
814814
n_clusters: 0,
815815
cluster_assignments: Vec::new(),
@@ -843,14 +843,14 @@ impl ArrowSpace {
843843
);
844844

845845
if let Some(ref proj) = self.projection_matrix {
846-
debug!(
846+
trace!(
847847
"Projecting query: {} → {} dimensions using seed-based projection",
848848
self.nfeatures,
849849
self.reduced_dim.unwrap()
850850
);
851851
proj.project(query)
852852
} else {
853-
debug!("No projection applied, returning original query");
853+
trace!("No projection applied, returning original query");
854854
query.to_vec()
855855
}
856856
}
@@ -894,7 +894,7 @@ impl ArrowSpace {
894894

895895
let lambda = sc_lambdas[best_idx];
896896

897-
debug!(
897+
trace!(
898898
"Query mapped to subcentroid {}/{} with λ={:.6} (dist={:.4})",
899899
best_idx,
900900
subcentroids.shape().0,
@@ -1447,6 +1447,19 @@ impl ArrowSpace {
14471447
config.insert("nitems".to_string(), ConfigValue::Usize(self.nitems));
14481448
config.insert("nfeatures".to_string(), ConfigValue::Usize(self.nfeatures));
14491449

1450+
config.insert(
1451+
"min_lambdas".to_string(),
1452+
ConfigValue::F64(self.min_lambdas),
1453+
);
1454+
config.insert(
1455+
"max_lambdas".to_string(),
1456+
ConfigValue::F64(self.max_lambdas),
1457+
);
1458+
config.insert(
1459+
"range_lambdas".to_string(),
1460+
ConfigValue::F64(self.range_lambdas),
1461+
);
1462+
14501463
// projection matrix
14511464
if self.projection_matrix.is_some() {
14521465
config.insert(
@@ -1497,6 +1510,19 @@ impl ArrowSpace {
14971510
ConfigValue::F64(self.cluster_radius),
14981511
);
14991512

1513+
config.insert(
1514+
"min_lambdas".to_string(),
1515+
ConfigValue::F64(self.min_lambdas),
1516+
);
1517+
config.insert(
1518+
"max_lambdas".to_string(),
1519+
ConfigValue::F64(self.max_lambdas),
1520+
);
1521+
config.insert(
1522+
"range_lambdas".to_string(),
1523+
ConfigValue::F64(self.range_lambdas),
1524+
);
1525+
15001526
config
15011527
}
15021528
}

0 commit comments

Comments
 (0)