aboutsummaryrefslogtreecommitdiff
path: root/src/tsp_approx.rs
diff options
context:
space:
mode:
authorLia Lenckowski <lialenck@protonmail.com>2024-11-25 01:33:42 +0100
committerLia Lenckowski <lialenck@protonmail.com>2024-11-25 01:33:42 +0100
commit6a2d5e2241b73039ae09b627c30841248d887a79 (patch)
tree8242692c4b8b087f4fc2323ad09c7b7a63075c9b /src/tsp_approx.rs
parent4195f3e742bec7ed0ef1b193a725ea7335a547ef (diff)
downloadembeddings-sort-6a2d5e2241b73039ae09b627c30841248d887a79.tar
embeddings-sort-6a2d5e2241b73039ae09b627c30841248d887a79.tar.bz2
embeddings-sort-6a2d5e2241b73039ae09b627c30841248d887a79.tar.zst
implement rust side of flag that ignores failing embeddings
Diffstat (limited to 'src/tsp_approx.rs')
-rw-r--r--src/tsp_approx.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tsp_approx.rs b/src/tsp_approx.rs
index 097fee7..4484b91 100644
--- a/src/tsp_approx.rs
+++ b/src/tsp_approx.rs
@@ -403,6 +403,12 @@ pub(crate) fn tsp<M>(
where
M: MetricElem,
{
+ match embeds.len() {
+ 0 => return (vec![], 0.0),
+ 1 => return (vec![0], 0.0),
+ _ => (),
+ }
+
let bar = ProgressBar::new_spinner();
bar.set_style(ProgressStyle::with_template("{spinner} {msg}").unwrap());
bar.enable_steady_tick(std::time::Duration::from_millis(100));