From b9cd23fe019f1dd85ed6a958321f53ee93e3de45 Mon Sep 17 00:00:00 2001 From: dymk Date: Wed, 26 Feb 2025 21:23:31 +0000 Subject: [PATCH] make build_param public --- src/lib.rs | 1 + src/matrix.rs | 2 +- src/params.rs | 12 ++++++------ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f5c4a8d..0d29cea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,6 +8,7 @@ mod model; mod params; pub use bindings::Loss; +pub use bindings::*; pub use error::Error; pub use matrix::Matrix; pub use model::Model; diff --git a/src/matrix.rs b/src/matrix.rs index 9e7aab1..222f4e5 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -29,7 +29,7 @@ impl Matrix { }); } - pub(crate) fn to_problem(&self) -> MfProblem { + pub fn to_problem(&self) -> MfProblem { let data = &self.data; let m = data.iter().map(|x| x.u).max().unwrap_or(-1) + 1; let n = data.iter().map(|x| x.v).max().unwrap_or(-1) + 1; diff --git a/src/params.rs b/src/params.rs index c07dadf..af082bf 100644 --- a/src/params.rs +++ b/src/params.rs @@ -133,7 +133,7 @@ impl Params { } // check parameters in Rust for better error message - fn build_param(&self) -> Result { + pub fn build_param(&self) -> Result { let param = self.param; if param.k < 1 { @@ -154,11 +154,11 @@ impl Params { )); } - if param.nr_iters < 1 { - return Err(Error::Parameter( - "number of iterations must be greater than zero".to_string(), - )); - } + // if param.nr_iters < 1 { + // return Err(Error::Parameter( + // "number of iterations must be greater than zero".to_string(), + // )); + // } if param.lambda_p1 < 0.0 || param.lambda_p2 < 0.0