Skip to content

Commit

Permalink
chore: add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
morenol committed Nov 19, 2024
1 parent 8b6f5a5 commit bc591d6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/algorithm/neighbour/fastpair.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub struct FastPair<'a, T: RealNumber + FloatNumber, M: Array2<T>> {
impl<'a, T: RealNumber + FloatNumber, M: Array2<T>> FastPair<'a, T, M> {
///
/// Constructor
/// Instantiate and inizialise the algorithm
/// Instantiate and initialize the algorithm
///
pub fn new(m: &'a M) -> Result<Self, Failed> {
if m.shape().0 < 3 {
Expand Down
2 changes: 1 addition & 1 deletion src/linalg/basic/arrays.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ pub trait Array1<T: Debug + Display + Copy + Sized>: MutArrayView1<T> + Sized +
result
}

///
/// check if two arrays are approximately equal
fn approximate_eq(&self, other: &Self, error: T) -> bool
where
T: Number + RealNumber,
Expand Down
2 changes: 0 additions & 2 deletions src/optimization/first_order/gradient_descent.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO: missing documentation

use std::default::Default;

use crate::linalg::basic::arrays::Array1;
Expand Down
1 change: 0 additions & 1 deletion src/optimization/first_order/lbfgs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl Default for LBFGS {
}
}

///
impl LBFGS {
///
fn two_loops<T: FloatNumber + RealNumber, X: Array1<T>>(&self, state: &mut LBFGSState<T, X>) {
Expand Down
10 changes: 5 additions & 5 deletions src/optimization/first_order/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
///
///
pub mod gradient_descent;
///
pub mod lbfgs;
Expand All @@ -11,9 +11,9 @@ use crate::numbers::floatnum::FloatNumber;
use crate::optimization::line_search::LineSearchMethod;
use crate::optimization::{DF, F};

///
/// First-order optimization is a class of algorithms that use the first derivative of a function to find optimal solutions.
pub trait FirstOrderOptimizer<T: FloatNumber> {
///
/// run first order optimization
fn optimize<'a, X: Array1<T>, LS: LineSearchMethod<T>>(
&self,
f: &F<'_, T, X>,
Expand All @@ -23,13 +23,13 @@ pub trait FirstOrderOptimizer<T: FloatNumber> {
) -> OptimizerResult<T, X>;
}

///
/// Result of optimization
#[derive(Debug, Clone)]
pub struct OptimizerResult<T: FloatNumber, X: Array1<T>> {
///
pub x: X,
///
pub f_x: T,
///
/// number of iterations
pub iterations: usize,
}
6 changes: 2 additions & 4 deletions src/optimization/line_search.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
// TODO: missing documentation

use crate::optimization::FunctionOrder;
use num_traits::Float;

///
/// Line search method is an iterative approach to find a local minimum of a multidimensional nonlinear function using the function's gradients
pub trait LineSearchMethod<T: Float> {
///
fn search(
Expand All @@ -16,7 +14,7 @@ pub trait LineSearchMethod<T: Float> {
) -> LineSearchResult<T>;
}

///
/// Line search result
#[derive(Debug, Clone)]
pub struct LineSearchResult<T: Float> {
///
Expand Down
2 changes: 0 additions & 2 deletions src/optimization/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO: missing documentation

///
pub mod first_order;
///
Expand Down

0 comments on commit bc591d6

Please sign in to comment.