Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn examples into crates #387

Merged
merged 8 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 7 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: cargo test -p argmin-math --no-default-features --features "primitives"
- name: argmin-math (vec)
run: cargo test -p argmin-math --no-default-features --features "vec"
# ndarray without linalg, without serde
# ndarray without linalg
- name: argmin-math (ndarray_latest-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-nolinalg"
- name: argmin-math (ndarray_v0_15-nolinalg)
Expand All @@ -85,7 +85,7 @@ jobs:
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-nolinalg"
- name: argmin-math (ndarray_v0_13-nolinalg)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-nolinalg"
# ndarray with linalg, without serde
# ndarray with linalg
- name: argmin-math (ndarray_latest)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml
- name: argmin-math (ndarray_v0_15)
Expand All @@ -94,25 +94,7 @@ jobs:
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml
- name: argmin-math (ndarray_v0_13)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml
# ndarray without linalg, with serde
- name: argmin-math (ndarray_latest-nolinalg-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_latest-nolinalg-serde"
- name: argmin-math (ndarray_v0_15-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_15-nolinalg-serde"
- name: argmin-math (ndarray_v0_14-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_14-nolinalg-serde"
- name: argmin-math (ndarray_v0_13-serde)
run: cargo test -p argmin-math --no-default-features --features "ndarray_v0_13-nolinalg-serde"
# ndarray with linalg, with serde
- name: argmin-math (ndarray_latest-serde)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_15)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_14)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml --features serde
- name: argmin-math (ndarray_v0_13)
run: cargo test --manifest-path ./argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml --features serde
# nalgebra without serde
# nalgebra
- name: argmin-math (nalgebra_latest)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_latest"
- name: argmin-math (nalgebra_v0_32)
Expand All @@ -123,17 +105,6 @@ jobs:
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_30"
- name: argmin-math (nalgebra_v0_29)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_29"
# nalgebra with serde
- name: argmin-math (nalgebra_latest-serde)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_latest-serde"
- name: argmin-math (nalgebra_v0_32-serde)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_32-serde"
- name: argmin-math (nalgebra_v0_31-serde)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_31-serde"
- name: argmin-math (nalgebra_v0_30-serde)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_30-serde"
- name: argmin-math (nalgebra_v0_29-serde)
run: cargo test -p argmin-math --no-default-features --features "nalgebra_v0_29-serde"

clippy:
runs-on: ubuntu-latest
Expand All @@ -144,7 +115,7 @@ jobs:
with:
components: clippy
- name: Clippy (argmin-math)
run: cargo clippy -p argmin-math --all-targets --features "primitives,vec,nalgebra_latest-serde,ndarray_latest-serde" -- -D warnings
run: cargo clippy -p argmin-math --all-targets --features "primitives,vec,nalgebra_latest,ndarray_latest" -- -D warnings
- name: Clippy (argmin) without default features
run: cargo clippy -p argmin --all-targets --no-default-features -- -D warnings
- name: Clippy (argmin) with default features
Expand Down Expand Up @@ -190,11 +161,11 @@ jobs:
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build target wasm32-unknown-unknown
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --target wasm32-unknown-unknown --features wasm-bindgen
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --target wasm32-unknown-unknown --features wasm-bindgen
- name: Build target wasm32-wasi with feature wasm-bindgen
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --target wasm32-wasi --features wasm-bindgen
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --target wasm32-wasi --features wasm-bindgen
- name: Build target wasm32-unknown-emscripten
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --target wasm32-unknown-emscripten --no-default-features --features wasm-bindgen
run: cargo build --workspace --exclude argmin-observer-spectator --exclude spectator --exclude argmin-observer-paramwriter --exclude "example-*" --target wasm32-unknown-emscripten --no-default-features --features wasm-bindgen

cargo-deny:
runs-on: ubuntu-latest
Expand Down
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ members = [
"argmin-math",
"observers/*",
"tools/spectator",

"examples/*",
]

exclude = [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
|
<a href="https://github.com/argmin-rs/argmin/tree/argmin-v0.9.0/argmin/examples">Examples (latest release)</a>
|
<a href="https://github.com/argmin-rs/argmin/tree/main/argmin/examples">Examples (main branch)</a>
<a href="https://github.com/argmin-rs/argmin/tree/main/examples">Examples (main branch)</a>
</p>

<p align="center">
Expand Down
17 changes: 2 additions & 15 deletions argmin-math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ approx = "0.5.0"

[features]
default = ["primitives", "vec"]
latest_all = ["primitives", "vec", "nalgebra_latest-serde", "ndarray_latest-serde"]
latest_all = ["primitives", "vec", "nalgebra_latest", "ndarray_latest"]

# primitives
primitives = ["num-complex_0_4"]
Expand All @@ -60,42 +60,29 @@ vec = ["primitives", "num-complex_0_4"]
# nalgebra
nalgebra_all = ["primitives"]
nalgebra_latest = ["nalgebra_v0_32"]
nalgebra_latest-serde = ["nalgebra_v0_32-serde"]
nalgebra_v0_32 = ["nalgebra_0_32", "num-complex_0_4", "nalgebra_all"]
nalgebra_v0_32-serde = ["nalgebra_v0_32", "nalgebra_0_32/serde-serialize"]
nalgebra_v0_31 = ["nalgebra_0_31", "num-complex_0_4", "nalgebra_all"]
nalgebra_v0_31-serde = ["nalgebra_v0_31", "nalgebra_0_31/serde-serialize"]
nalgebra_v0_30 = ["nalgebra_0_30", "num-complex_0_4", "nalgebra_all"]
nalgebra_v0_30-serde = ["nalgebra_v0_30", "nalgebra_0_30/serde-serialize"]
nalgebra_v0_29 = ["nalgebra_0_29", "num-complex_0_4", "nalgebra_all"]
nalgebra_v0_29-serde = ["nalgebra_v0_29", "nalgebra_0_29/serde-serialize"]

# ndarray
ndarray_all = ["primitives"]
ndarray_latest = ["ndarray_v0_15"]

## With `ndarray-linalg`
ndarray_latest-serde = ["ndarray_v0_15-serde"]
ndarray_v0_15 = ["ndarray_0_15", "ndarray-linalg_0_16", "num-complex_0_4", "ndarray_all"]
ndarray_v0_15-serde = ["ndarray_v0_15", "ndarray_0_15/serde-1"]
ndarray_v0_14 = ["ndarray_0_14", "ndarray-linalg_0_13", "num-complex_0_3", "ndarray_all"]
ndarray_v0_14-serde = ["ndarray_v0_14", "ndarray_0_14/serde-1"]
ndarray_v0_13 = ["ndarray_0_13", "ndarray-linalg_0_12", "num-complex_0_2", "ndarray_all"]
ndarray_v0_13-serde = ["ndarray_v0_13", "ndarray_0_13/serde-1"]

## Without `ndarray-linalg`
ndarray_latest-nolinalg = ["ndarray_v0_15-nolinalg"]
ndarray_latest-nolinalg-serde = ["ndarray_v0_15-nolinalg-serde"]
ndarray_v0_15-nolinalg = ["ndarray_0_15", "num-complex_0_4", "ndarray_all"]
ndarray_v0_15-nolinalg-serde = ["ndarray_v0_15-nolinalg", "ndarray_0_15/serde-1"]
ndarray_v0_14-nolinalg = ["ndarray_0_14", "num-complex_0_3", "ndarray_all"]
ndarray_v0_14-nolinalg-serde = ["ndarray_v0_14-nolinalg", "ndarray_0_14/serde-1"]
ndarray_v0_13-nolinalg = ["ndarray_0_13", "num-complex_0_2", "ndarray_all"]
ndarray_v0_13-nolinalg-serde = ["ndarray_v0_13-nolinalg", "ndarray_0_13/serde-1"]

[badges]
maintenance = { status = "actively-developed" }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
features = ["primitives", "vec", "ndarray_latest-serde", "nalgebra_latest-serde"]
features = ["primitives", "vec", "ndarray_latest", "nalgebra_latest"]
5 changes: 2 additions & 3 deletions argmin-math/ndarray-linalg-tests/ndarray_0_13/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
argmin-math = { path = "../../", version = "*", features = [
"ndarray_v0_13",
] }
ndarray = { version = "0.13", default-features = false }
Expand All @@ -20,7 +20,6 @@ approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_13-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
[workspace]
5 changes: 2 additions & 3 deletions argmin-math/ndarray-linalg-tests/ndarray_0_14/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", default-features=false, features = [
argmin-math = { path = "../../", version = "*", default-features=false, features = [
"ndarray_v0_14",
] }
ndarray = { version = "0.14", default-features = false }
Expand All @@ -22,7 +22,6 @@ approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_14-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
[workspace]
5 changes: 2 additions & 3 deletions argmin-math/ndarray-linalg-tests/ndarray_0_15/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
argmin-math = { path = "../../", version = "*", features = [
"ndarray_v0_15",
] }
ndarray = { version = "0.15", default-features = false }
Expand All @@ -20,7 +20,6 @@ approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_v0_15-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
[workspace]
5 changes: 2 additions & 3 deletions argmin-math/ndarray-linalg-tests/ndarray_latest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dev-dependencies]
argmin-math = { path = "../../", version = "0.3", features = [
argmin-math = { path = "../../", version = "*", features = [
"ndarray_latest",
] }
ndarray = { version = "0.15", default-features = false }
Expand All @@ -20,7 +20,6 @@ approx = "0.5.0"
rand = "*" # Should unify with whatever is currently used in argmin itself

[features]
serde = ["argmin-math/ndarray_latest-serde"]

# To make it explicit that this package is not part of the overall argmin workspace for the purpose of dependency unification
[workspace]
[workspace]
19 changes: 1 addition & 18 deletions argmin-math/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,12 @@
//! |---------------------------------|---------|--------------------------------------------------------------------|
//! | `ndarray_latest` | no | latest supported version |
//! | `ndarray_latest-nolinalg` | no | latest supported version without `ndarray-linalg` |
//! | `ndarray_latest-serde` | no | latest supported version + serde support |
//! | `ndarray_latest-nolinalg-serde` | no | latest supported version without `ndarray-linalg` + serde support |
//! | `ndarray_v0_15` | no | version 0.15 with ndarray-linalg 0.16 |
//! | `ndarray_v0_15-nolinalg` | no | version 0.15 without `ndarray-linalg` |
//! | `ndarray_v0_15-serde` | no | version 0.15 with ndarray-linalg 0.16 + serde support |
//! | `ndarray_v0_15-nolinalg-serde` | no | version 0.15 without `ndarray-linalg` + serde support |
//! | `ndarray_v0_14` | no | version 0.14 with ndarray-linalg 0.13 |
//! | `ndarray_v0_14-nolinalg` | no | version 0.14 without `ndarray-linalg` |
//! | `ndarray_v0_14-serde` | no | version 0.14 with ndarray-linalg 0.13 + serde support |
//! | `ndarray_v0_14-nolinalg-serde` | no | version 0.14 without `ndarray-linalg` + serde support |
//! | `ndarray_v0_13` | no | version 0.13 with ndarray-linalg 0.12 |
//! | `ndarray_v0_13-nolinalg` | no | version 0.13 without `ndarray-linalg` |
//! | `ndarray_v0_13-serde` | no | version 0.13 with ndarray-linalg 0.12 + serde support |
//! | `ndarray_v0_13-nolinalg-serde` | no | version 0.13 without `ndarray-linalg` + serde support |
//!
//! Note that the `*-nolinalg*` features do NOT pull in `ndarray-linalg` as a dependency. This
//! avoids linking against a BLAS library. This will however disable the implementation of
Expand All @@ -78,15 +70,10 @@
//! | Feature | Default | Comment |
//! |------------------------|---------|------------------------------------------|
//! | `nalgebra_latest` | no | latest supported version |
//! | `nalgebra_latest-serde`| no | latest supported version + serde support |
//! | `nalgebra_v0_32` | no | version 0.32 |
//! | `nalgebra_v0_32-serde` | no | version 0.32 + serde support |
//! | `nalgebra_v0_31` | no | version 0.31 |
//! | `nalgebra_v0_31-serde` | no | version 0.31 + serde support |
//! | `nalgebra_v0_30` | no | version 0.30 |
//! | `nalgebra_v0_30-serde` | no | version 0.30 + serde support |
//! | `nalgebra_v0_29` | no | version 0.29 |
//! | `nalgebra_v0_29-serde` | no | version 0.29 + serde support |
//!
//!
//! ## Choosing a backend
Expand All @@ -97,10 +84,6 @@
//! respective backend. It is however recommended to explicitly specify the desired version instead
//! of using any of the `*latest*` features (see section about semantic versioning below).
//!
//! Note that `argmin` by default compiles with `serde` support. Therefore, unless `serde` is
//! deliberately turned off in `argmin`, it is necessary to activate the `serde` support in
//! `argmin-math` as well.
//!
//! The default features `primitives` and `vec` can be turned off in order to only compile the
//! trait definitions. If another backend is chosen, `primitives` will automatically be turned on
//! again.
Expand All @@ -111,7 +94,7 @@
//!
//! ```toml
//! [dependencies]
#![doc = concat!("argmin-math = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"ndarray_latest-serde\"] }")]
#![doc = concat!("argmin-math = { version = \"", env!("CARGO_PKG_VERSION"), "\", features = [\"ndarray_latest\"] }")]
//! ```
//!
//! # Semantic versioning
Expand Down
Loading
Loading