Skip to content

Commit 629fefc

Browse files
committed
Revert "partition for vec"
This reverts commit 0f8fe04.
1 parent 0f8fe04 commit 629fefc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+77
-3484
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,4 @@ num-complex = "0.4.6"
1919
[dev-dependencies]
2020
rand = "0.8"
2121

22-
[features]
23-
default = []
24-
vectors = []
25-
2622
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Rust scientific computing for single and multi-variable calculus
99
## Salient Features
1010

1111
- Written in pure, safe rust
12-
- no-std friendly with zero heap allocations and no panics
12+
- no-std with zero heap allocations and no panics
1313
- Trait-based generic implementation to support floating point and complex numbers
1414
- Fully documented with code examples
1515
- Comprehensive suite of tests for full code coverage, including all possible error conditions
@@ -25,16 +25,9 @@ Rust scientific computing for single and multi-variable calculus
2525
- Approximation of any given equation to a linear or quadratic mode
2626

2727

28-
_Note: As of version 0.5.0, the crate structure has changed. In order to accomodate std::Vec, the crate has been partitioned to "core" and "vec". By default, no-std is enabled with zero heap allocations. These modules live in "core". An optional feature "vectors" can be enabled to access modules in "vec" that use std::Vec instead of rust static arrays. For the difference in usage, consult the test examples. To use the vectors feature, paste this in your Cargo.toml:_
29-
30-
```toml
31-
[dependencies]
32-
multicalc = {version = "*", features = ["vectors"] } #Replace "*" with version number
33-
```
34-
35-
3628
## Table of Contents
3729

30+
3831
- [1. Single total derivatives](#1-single-total-derivatives)
3932
- [2. Single partial derivatives](#2-single-partial-derivatives)
4033
- [3. Double total derivatives](#3-double-total-derivatives)

src/core/approximation/linear_approximation.rs renamed to src/approximation/linear_approximation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::core::numerical_derivative::single_derivative as single_derivative;
2-
use crate::core::numerical_derivative::mode as mode;
1+
use crate::numerical_derivative::single_derivative as single_derivative;
2+
use crate::numerical_derivative::mode as mode;
33
use crate::utils::error_codes::ErrorCode;
44
use num_complex::ComplexFloat;
55

@@ -86,7 +86,7 @@ impl<T: ComplexFloat, const NUM_VARS: usize> LinearApproximationResult<T, NUM_VA
8686
///
8787
///example function is x + y^2 + z^3, which we want to linearize. First define the function:
8888
///```
89-
///use multicalc::core::approximation::linear_approximation;
89+
///use multicalc::approximation::linear_approximation;
9090
///
9191
///let function_to_approximate = | args: &[f64; 3] | -> f64
9292
///{

src/core/approximation/quadratic_approximation.rs renamed to src/approximation/quadratic_approximation.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use crate::core::numerical_derivative::mode as mode;
2-
use crate::core::numerical_derivative::single_derivative as single_derivative;
3-
use crate::core::numerical_derivative::hessian as hessian;
1+
use crate::numerical_derivative::mode as mode;
2+
use crate::numerical_derivative::single_derivative as single_derivative;
3+
use crate::numerical_derivative::hessian as hessian;
44
use crate::utils::error_codes::ErrorCode;
55
use num_complex::ComplexFloat;
66

@@ -98,7 +98,7 @@ impl<T: ComplexFloat, const NUM_VARS: usize> QuadraticApproximationResult<T, NUM
9898
///
9999
///example function is e^(x/2) + sin(y) + 2.0*z, which we want to approximate. First define the function:
100100
///```
101-
///use multicalc::core::approximation::quadratic_approximation;
101+
///use multicalc::approximation::quadratic_approximation;
102102
///
103103
///let function_to_approximate = | args: &[f64; 3] | -> f64
104104
///{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::core::approximation::linear_approximation;
2-
use crate::core::approximation::quadratic_approximation;
1+
use crate::approximation::linear_approximation;
2+
use crate::approximation::quadratic_approximation;
33
use rand::Rng;
44

55
#[test]

src/core/mod.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,8 @@
33

44
#![no_std]
55

6-
#[cfg(feature = "vectors")]
7-
extern crate std;
8-
9-
pub mod core;
106
pub mod utils;
11-
12-
#[cfg(feature = "vectors")]
13-
pub mod vec;
7+
pub mod numerical_integration;
8+
pub mod numerical_derivative;
9+
pub mod approximation;
10+
pub mod vector_field;

src/core/numerical_derivative/double_derivative.rs renamed to src/numerical_derivative/double_derivative.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::core::numerical_derivative::single_derivative;
2-
use crate::core::numerical_derivative::mode as mode;
1+
use crate::numerical_derivative::single_derivative;
2+
use crate::numerical_derivative::mode as mode;
33
use crate::utils::error_codes::ErrorCode;
44
use num_complex::ComplexFloat;
55

@@ -19,7 +19,7 @@ use num_complex::ComplexFloat;
1919
///// We also need to define the point at which we want to differentiate. Assuming our point x = 5.0
2020
///// if we then want to differentiate this function over x with a step size of 0.001, we would use:
2121
///
22-
/// use multicalc::core::numerical_derivative::double_derivative;
22+
/// use multicalc::numerical_derivative::double_derivative;
2323
///
2424
/// let val = double_derivative::get_total(&my_func, //<- our closure
2525
/// 5.0); //<- point around which we want to differentiate
@@ -40,7 +40,7 @@ use num_complex::ComplexFloat;
4040
/// //point of interest is x = (5.0 + 2.5i)
4141
/// let point = num_complex::c64(5.0, 2.5);
4242
///
43-
/// use multicalc::core::numerical_derivative::double_derivative;
43+
/// use multicalc::numerical_derivative::double_derivative;
4444
///
4545
/// let val = double_derivative::get_total(&my_func, //<- our closure
4646
/// point); //<- point around which we want to differentiate
@@ -99,7 +99,7 @@ pub fn get_total_custom<T: ComplexFloat, const NUM_VARS: usize>(func: &dyn Fn(&[
9999
///
100100
///// if we then want to partially differentiate this function first over x then y, for (x, y, z) = (1.0, 2.0, 3.0) with a step size of 0.001, we would use:
101101
///
102-
/// use multicalc::core::numerical_derivative::double_derivative;
102+
/// use multicalc::numerical_derivative::double_derivative;
103103
///
104104
/// let val = double_derivative::get_partial(&my_func, //<- our closure
105105
/// &[0, 1], //<- idx, index of variables we want to differentiate
@@ -121,7 +121,7 @@ pub fn get_total_custom<T: ComplexFloat, const NUM_VARS: usize>(func: &dyn Fn(&[
121121
/// //point of interest is (x, y, z) = (1.0 + 4.0i, 2.0 + 2.5i, 3.0 + 0.0i)
122122
/// let point = [num_complex::c64(1.0, 4.0), num_complex::c64(2.0, 2.5), num_complex::c64(3.0, 0.0)];
123123
///
124-
/// use multicalc::core::numerical_derivative::double_derivative;
124+
/// use multicalc::numerical_derivative::double_derivative;
125125
///
126126
/// let val = double_derivative::get_partial(&my_func, //<- our closure
127127
/// &[0, 1], //<- idx, index of variables we want to differentiate
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use crate::core::numerical_derivative::double_derivative as double_derivative;
2-
use crate::core::numerical_derivative::mode as mode;
1+
use crate::numerical_derivative::double_derivative as double_derivative;
2+
use crate::numerical_derivative::mode as mode;
33
use crate::utils::error_codes::ErrorCode;
44
use num_complex::ComplexFloat;
55

@@ -14,7 +14,7 @@ use num_complex::ComplexFloat;
1414
///
1515
/// assume our function is y*sin(x) + 2*x*e^y. First define the function
1616
/// ```
17-
/// use multicalc::core::numerical_derivative::hessian;
17+
/// use multicalc::numerical_derivative::hessian;
1818
/// let my_func = | args: &[f64; 2] | -> f64
1919
/// {
2020
/// return args[1]*args[0].sin() + 2.0*args[0]*args[1].exp();
@@ -27,7 +27,7 @@ use num_complex::ComplexFloat;
2727
///
2828
/// the above example can also be extended to complex numbers:
2929
///```
30-
/// use multicalc::core::numerical_derivative::hessian;
30+
/// use multicalc::numerical_derivative::hessian;
3131
/// let my_func = | args: &[num_complex::Complex64; 2] | -> num_complex::Complex64
3232
/// {
3333
/// return args[1]*args[0].sin() + 2.0*args[0]*args[1].exp();

0 commit comments

Comments
 (0)