From 2cfa7a3145a9c5a2f10ec562267150cf75b44405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Nevyho=C5=A1t=C4=9Bn=C3=BD?= Date: Mon, 29 Jan 2024 13:39:51 +0100 Subject: [PATCH] chore: reorganize the repo to workspace The plan is to move all fundamental blocks to a separate "gomez_core" crate which can be used for implementing solvers and optimizers in other libraries, without the need to import implementations in gomez. There may be further splitting done in the future. --- .github/workflows/ci.yml | 4 --- .github/workflows/publish.yml | 2 +- Cargo.toml | 28 +++---------------- .../gomez-bench}/Cargo.toml | 4 +-- .../gomez-bench}/benches/main.rs | 0 crates/gomez/Cargo.toml | 24 ++++++++++++++++ .../gomez/examples}/custom_algorithm.rs | 0 .../gomez/examples}/equations.rs | 0 .../gomez/examples}/optimization.rs | 0 {src => crates/gomez/src}/algo.rs | 0 {src => crates/gomez/src}/algo/lipo.rs | 0 {src => crates/gomez/src}/algo/nelder_mead.rs | 0 {src => crates/gomez/src}/algo/steffensen.rs | 0 .../gomez/src}/algo/trust_region.rs | 0 {src => crates/gomez/src}/analysis.rs | 0 {src => crates/gomez/src}/core.rs | 0 {src => crates/gomez/src}/core/base.rs | 0 {src => crates/gomez/src}/core/domain.rs | 0 {src => crates/gomez/src}/core/function.rs | 0 {src => crates/gomez/src}/core/optimizer.rs | 0 {src => crates/gomez/src}/core/solver.rs | 0 {src => crates/gomez/src}/core/system.rs | 0 {src => crates/gomez/src}/derivatives.rs | 0 {src => crates/gomez/src}/driver.rs | 0 {src => crates/gomez/src}/lib.rs | 0 {src => crates/gomez/src}/testing.rs | 0 26 files changed, 31 insertions(+), 31 deletions(-) rename {gomez-bench => crates/gomez-bench}/Cargo.toml (58%) rename {gomez-bench => crates/gomez-bench}/benches/main.rs (100%) create mode 100644 crates/gomez/Cargo.toml rename {examples => crates/gomez/examples}/custom_algorithm.rs (100%) rename {examples => crates/gomez/examples}/equations.rs (100%) rename {examples => crates/gomez/examples}/optimization.rs (100%) rename {src => crates/gomez/src}/algo.rs (100%) rename {src => crates/gomez/src}/algo/lipo.rs (100%) rename {src => crates/gomez/src}/algo/nelder_mead.rs (100%) rename {src => crates/gomez/src}/algo/steffensen.rs (100%) rename {src => crates/gomez/src}/algo/trust_region.rs (100%) rename {src => crates/gomez/src}/analysis.rs (100%) rename {src => crates/gomez/src}/core.rs (100%) rename {src => crates/gomez/src}/core/base.rs (100%) rename {src => crates/gomez/src}/core/domain.rs (100%) rename {src => crates/gomez/src}/core/function.rs (100%) rename {src => crates/gomez/src}/core/optimizer.rs (100%) rename {src => crates/gomez/src}/core/solver.rs (100%) rename {src => crates/gomez/src}/core/system.rs (100%) rename {src => crates/gomez/src}/derivatives.rs (100%) rename {src => crates/gomez/src}/driver.rs (100%) rename {src => crates/gomez/src}/lib.rs (100%) rename {src => crates/gomez/src}/testing.rs (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17f6328..ecd583b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -111,10 +111,6 @@ jobs: working-directory: gsl-wrapper run: cargo test --profile ${{ matrix.profile }} - - name: Run checks (benches) - working-directory: gomez-bench - run: cargo check --profile ${{ matrix.profile }} - rust-check-docs: name: Rust docs check runs-on: ubuntu-latest diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cf6d7bd..32afd50 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,4 +20,4 @@ jobs: run: cargo test - name: Publish package - run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} + run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} --package gomez diff --git a/Cargo.toml b/Cargo.toml index 3dd5273..0e59927 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,24 +1,4 @@ -[package] -name = "gomez" -version = "0.5.0" -authors = ["Petr Nevyhoštěný "] -description = "Framework and implementation for mathematical optimization and solving non-linear systems of equations." -documentation = "https://docs.rs/gomez/" -repository = "https://github.com/datamole-ai/gomez" -license = "MIT" -readme = "README.md" -keywords = ["nonlinear-equations", "optimization", "math", "science"] -categories = ["science", "mathematics"] -edition = "2021" - -[features] -testing = [] - -[dependencies] -approx = "0.5.0" -fastrand = "2.0.0" -fastrand-contrib = "0.1.0" -getset = "0.1.0" -log = "0.4.0" -nalgebra = "0.32.0" -thiserror = "1.0.0" +[workspace] +members = ["crates/*"] +exclude = ["gsl-wrapper"] +resolver = "2" diff --git a/gomez-bench/Cargo.toml b/crates/gomez-bench/Cargo.toml similarity index 58% rename from gomez-bench/Cargo.toml rename to crates/gomez-bench/Cargo.toml index 92a2b10..0df47c9 100644 --- a/gomez-bench/Cargo.toml +++ b/crates/gomez-bench/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" [dependencies] divan = "0.1.2" -gomez = { path = "..", features = ["testing"] } -gsl-wrapper = { path = "../gsl-wrapper" } +gomez = { path = "../gomez", features = ["testing"] } +gsl-wrapper = { path = "../../gsl-wrapper" } [[bench]] name = "main" diff --git a/gomez-bench/benches/main.rs b/crates/gomez-bench/benches/main.rs similarity index 100% rename from gomez-bench/benches/main.rs rename to crates/gomez-bench/benches/main.rs diff --git a/crates/gomez/Cargo.toml b/crates/gomez/Cargo.toml new file mode 100644 index 0000000..52b879f --- /dev/null +++ b/crates/gomez/Cargo.toml @@ -0,0 +1,24 @@ +[package] +name = "gomez" +version = "0.5.0" +authors = ["Petr Nevyhoštěný "] +description = "Framework and implementation for mathematical optimization and solving non-linear systems of equations." +documentation = "https://docs.rs/gomez/" +repository = "https://github.com/datamole-ai/gomez" +license = "MIT" +readme = "../../README.md" +keywords = ["nonlinear-equations", "optimization", "math", "science"] +categories = ["science", "mathematics"] +edition = "2021" + +[features] +testing = [] + +[dependencies] +approx = "0.5.0" +fastrand = "2.0.0" +fastrand-contrib = "0.1.0" +getset = "0.1.0" +log = "0.4.0" +nalgebra = "0.32.0" +thiserror = "1.0.0" diff --git a/examples/custom_algorithm.rs b/crates/gomez/examples/custom_algorithm.rs similarity index 100% rename from examples/custom_algorithm.rs rename to crates/gomez/examples/custom_algorithm.rs diff --git a/examples/equations.rs b/crates/gomez/examples/equations.rs similarity index 100% rename from examples/equations.rs rename to crates/gomez/examples/equations.rs diff --git a/examples/optimization.rs b/crates/gomez/examples/optimization.rs similarity index 100% rename from examples/optimization.rs rename to crates/gomez/examples/optimization.rs diff --git a/src/algo.rs b/crates/gomez/src/algo.rs similarity index 100% rename from src/algo.rs rename to crates/gomez/src/algo.rs diff --git a/src/algo/lipo.rs b/crates/gomez/src/algo/lipo.rs similarity index 100% rename from src/algo/lipo.rs rename to crates/gomez/src/algo/lipo.rs diff --git a/src/algo/nelder_mead.rs b/crates/gomez/src/algo/nelder_mead.rs similarity index 100% rename from src/algo/nelder_mead.rs rename to crates/gomez/src/algo/nelder_mead.rs diff --git a/src/algo/steffensen.rs b/crates/gomez/src/algo/steffensen.rs similarity index 100% rename from src/algo/steffensen.rs rename to crates/gomez/src/algo/steffensen.rs diff --git a/src/algo/trust_region.rs b/crates/gomez/src/algo/trust_region.rs similarity index 100% rename from src/algo/trust_region.rs rename to crates/gomez/src/algo/trust_region.rs diff --git a/src/analysis.rs b/crates/gomez/src/analysis.rs similarity index 100% rename from src/analysis.rs rename to crates/gomez/src/analysis.rs diff --git a/src/core.rs b/crates/gomez/src/core.rs similarity index 100% rename from src/core.rs rename to crates/gomez/src/core.rs diff --git a/src/core/base.rs b/crates/gomez/src/core/base.rs similarity index 100% rename from src/core/base.rs rename to crates/gomez/src/core/base.rs diff --git a/src/core/domain.rs b/crates/gomez/src/core/domain.rs similarity index 100% rename from src/core/domain.rs rename to crates/gomez/src/core/domain.rs diff --git a/src/core/function.rs b/crates/gomez/src/core/function.rs similarity index 100% rename from src/core/function.rs rename to crates/gomez/src/core/function.rs diff --git a/src/core/optimizer.rs b/crates/gomez/src/core/optimizer.rs similarity index 100% rename from src/core/optimizer.rs rename to crates/gomez/src/core/optimizer.rs diff --git a/src/core/solver.rs b/crates/gomez/src/core/solver.rs similarity index 100% rename from src/core/solver.rs rename to crates/gomez/src/core/solver.rs diff --git a/src/core/system.rs b/crates/gomez/src/core/system.rs similarity index 100% rename from src/core/system.rs rename to crates/gomez/src/core/system.rs diff --git a/src/derivatives.rs b/crates/gomez/src/derivatives.rs similarity index 100% rename from src/derivatives.rs rename to crates/gomez/src/derivatives.rs diff --git a/src/driver.rs b/crates/gomez/src/driver.rs similarity index 100% rename from src/driver.rs rename to crates/gomez/src/driver.rs diff --git a/src/lib.rs b/crates/gomez/src/lib.rs similarity index 100% rename from src/lib.rs rename to crates/gomez/src/lib.rs diff --git a/src/testing.rs b/crates/gomez/src/testing.rs similarity index 100% rename from src/testing.rs rename to crates/gomez/src/testing.rs