Skip to content

Commit

Permalink
Simplify MultiRootSolverChevy
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmech committed Jun 26, 2024
1 parent 6ea38b1 commit 5d6371b
Show file tree
Hide file tree
Showing 2 changed files with 119 additions and 177 deletions.
6 changes: 3 additions & 3 deletions russell_lab/examples/algo_multi_root_solver_cheby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ fn main() -> Result<(), StrError> {
println!("N = {}", nn);

// find all roots in the interval
let mut solver = MultiRootSolverCheby::new(nn)?;
let solver = MultiRootSolverCheby::new();
let roots = Vector::from(&solver.find(&interp)?);
let f_at_roots = roots.get_mapped(|x| f(x, args).unwrap());
println!("roots =\n{}", roots);
println!("f @ roots =\n{}", print_vec_exp(&f_at_roots));

// polish the roots
let mut roots_polished = Vector::new(roots.dim());
solver.polish_roots_newton(roots_polished.as_mut_data(), roots.as_data(), xa, xb, args, f)?;
let mut roots_polished = roots.clone();
solver.polish_roots_newton(roots_polished.as_mut_data(), xa, xb, args, f)?;
let f_at_roots_polished = roots_polished.get_mapped(|x| f(x, args).unwrap());
println!("polished roots =\n{}", roots_polished);
println!("f @ polished roots =\n{}", print_vec_exp(&f_at_roots_polished));
Expand Down
Loading

0 comments on commit 5d6371b

Please sign in to comment.