diff --git a/russell_lab/examples/algo_interpolation_lagrange.rs b/russell_lab/examples/algo_interpolation_lagrange.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/algo_interpolation_lagrange.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/pde_1d_lorene_spectral_collocation.rs b/russell_lab/examples/algo_lorene_1d_pde_spectral_collocation.rs similarity index 100% rename from russell_lab/examples/pde_1d_lorene_spectral_collocation.rs rename to russell_lab/examples/algo_lorene_1d_pde_spectral_collocation.rs diff --git a/russell_lab/examples/algo_min_bracketing.rs b/russell_lab/examples/algo_min_bracketing.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/algo_min_bracketing.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/algo_min_solver_brent.rs b/russell_lab/examples/algo_min_solver_brent.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/algo_min_solver_brent.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/numerical_jacobian.rs b/russell_lab/examples/algo_numerical_jacobian.rs similarity index 100% rename from russell_lab/examples/numerical_jacobian.rs rename to russell_lab/examples/algo_numerical_jacobian.rs diff --git a/russell_lab/examples/algo_quadrature_integrate_1d.rs b/russell_lab/examples/algo_quadrature_integrate_1d.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/algo_quadrature_integrate_1d.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/algo_root_solver_brent.rs b/russell_lab/examples/algo_root_solver_brent.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/algo_root_solver_brent.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/base_auxiliary_blas.rs b/russell_lab/examples/base_auxiliary_blas.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/base_auxiliary_blas.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/base_linear_fitting_and_stopwatch.rs b/russell_lab/examples/base_linear_fitting_and_stopwatch.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/base_linear_fitting_and_stopwatch.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/base_sort_read_table_and_formatters.rs b/russell_lab/examples/base_sort_read_table_and_formatters.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/base_sort_read_table_and_formatters.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/check_1st_and_2nd_derivatives.rs b/russell_lab/examples/check_1st_and_2nd_derivatives.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/check_1st_and_2nd_derivatives.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/fftw_simple_example.rs b/russell_lab/examples/fftw_simple_example.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/fftw_simple_example.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_bessel_functions.rs b/russell_lab/examples/math_bessel_functions.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_bessel_functions.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_beta_gamma_and_erf_functions.rs b/russell_lab/examples/math_beta_gamma_and_erf_functions.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_beta_gamma_and_erf_functions.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_complex_numbers.rs b/russell_lab/examples/math_complex_numbers.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_complex_numbers.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_composition_and_modulo.rs b/russell_lab/examples/math_composition_and_modulo.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_composition_and_modulo.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_elliptic_integral.rs b/russell_lab/examples/math_elliptic_integral.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_elliptic_integral.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/math_functions_and_chebyshev.rs b/russell_lab/examples/math_functions_and_chebyshev.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/math_functions_and_chebyshev.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/mat_cholesky.rs b/russell_lab/examples/matrix_cholesky_3x3.rs similarity index 100% rename from russell_lab/examples/mat_cholesky.rs rename to russell_lab/examples/matrix_cholesky_3x3.rs diff --git a/russell_lab/examples/matrix_cholesky.rs b/russell_lab/examples/matrix_cholesky_4x4.rs similarity index 100% rename from russell_lab/examples/matrix_cholesky.rs rename to russell_lab/examples/matrix_cholesky_4x4.rs diff --git a/russell_lab/examples/matrix_visualization.rs b/russell_lab/examples/matrix_visualization.rs new file mode 100644 index 00000000..c8e42bbd --- /dev/null +++ b/russell_lab/examples/matrix_visualization.rs @@ -0,0 +1,6 @@ +use russell_lab::*; + +fn main() -> Result<(), StrError> { + println!("TODO: EXAMPLE"); + Ok(()) +} diff --git a/russell_lab/examples/linear_system_solution.rs b/russell_lab/examples/matvec_solve_linear_system.rs similarity index 100% rename from russell_lab/examples/linear_system_solution.rs rename to russell_lab/examples/matvec_solve_linear_system.rs diff --git a/russell_lab/examples/vector_axpy_and_sum.rs b/russell_lab/examples/vector_axpy_and_sum.rs index 66f1dfbb..0f1fa314 100644 --- a/russell_lab/examples/vector_axpy_and_sum.rs +++ b/russell_lab/examples/vector_axpy_and_sum.rs @@ -1,5 +1,26 @@ use russell_lab::*; fn main() -> Result<(), StrError> { + // axpy + let u = Vector::from(&[10.0, 20.0, 30.0]); + let mut v = Vector::from(&[10.0, 20.0, 30.0]); + vec_update(&mut v, 0.1, &u)?; + let correct = "┌ ┐\n\ + │ 11 │\n\ + │ 22 │\n\ + │ 33 │\n\ + └ ┘"; + assert_eq!(format!("{}", v), correct); + + // sum + let w = Vector::filled(3, 1.0); + let mut z = Vector::new(3); + vec_add(&mut z, 1.0, &v, 100.0, &w)?; + let correct = "┌ ┐\n\ + │ 111 │\n\ + │ 122 │\n\ + │ 133 │\n\ + └ ┘"; + assert_eq!(format!("{}", z), correct); Ok(()) } diff --git a/russell_lab/examples/vector_dot_scale_and_copy.rs b/russell_lab/examples/vector_dot_scale_and_copy.rs index 66f1dfbb..8af96f40 100644 --- a/russell_lab/examples/vector_dot_scale_and_copy.rs +++ b/russell_lab/examples/vector_dot_scale_and_copy.rs @@ -1,5 +1,19 @@ use russell_lab::*; fn main() -> Result<(), StrError> { + // scale + let mut u = Vector::from(&[1.0, 2.0, 3.0]); + vec_scale(&mut u, 0.5); + let correct = "┌ ┐\n\ + │ 0.5 │\n\ + │ 1 │\n\ + │ 1.5 │\n\ + └ ┘"; + assert_eq!(format!("{}", u), correct); + + // copy + let mut v = Vector::from(&[-1.0, -2.0, -3.0]); + vec_copy(&mut v, &u)?; + assert_eq!(format!("{}", v), correct); Ok(()) } diff --git a/russell_lab/examples/vector_norms.rs b/russell_lab/examples/vector_norms.rs index 66f1dfbb..d5dac835 100644 --- a/russell_lab/examples/vector_norms.rs +++ b/russell_lab/examples/vector_norms.rs @@ -1,5 +1,11 @@ use russell_lab::*; fn main() -> Result<(), StrError> { + let u = Vector::from(&[2.0, -2.0, 2.0, -2.0, -3.0]); + assert_eq!(vec_norm(&u, Norm::One), 11.0); + assert_eq!(vec_norm(&u, Norm::Euc), 5.0); + assert_eq!(vec_norm(&u, Norm::Fro), 5.0); // same as Euc + assert_eq!(vec_norm(&u, Norm::Inf), 3.0); + assert_eq!(vec_norm(&u, Norm::Max), 3.0); // same as Inf Ok(()) }