[package]
name = "sublinear"
version = "0.3.0"
edition = "2021"
authors = ["rUv <github.com/ruvnet>"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/ruvnet/sublinear-time-solver"
description = "High-performance sublinear-time solver for asymmetric diagonally dominant systems"
keywords = ["linear-algebra", "sparse-matrix", "solver", "sublinear", "wasm"]
categories = ["mathematics", "science", "wasm"]
# crates.io publish surface. Use `include` (not just `exclude`) so npm/
# WASM artifacts can never silently push the tarball past the 10 MB cap
# again. Anything we want on docs.rs / crates.io must appear in this list.
include = [
    "src/**/*.rs",
    "benches/*.rs",
    "Cargo.toml",
    "README.md",
    "LICENSE",
    "CHANGELOG.md",
    "BENCHMARK.md",
    "docs/adr/*.md",
]

[lib]
name = "sublinear_solver"
crate-type = ["cdylib", "rlib"]

[dependencies]
# Core dependencies
nalgebra = { version = "0.32", features = ["serde-serialize"], default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }
thiserror = "1.0"
log = "0.4"
rand = { version = "0.8", features = ["small_rng", "std_rng", "std"], default-features = false }
fnv = "1.0"
num-traits = "0.2"
num-complex = "0.4"
bit-set = "0.5"
lazy_static = { version = "1.4", optional = true }

# Optional WASM dependencies
wasm-bindgen = { version = "0.2", features = ["serde-serialize"], optional = true }
web-sys = { version = "0.3", features = ["console", "Window", "Performance", "PerformanceEntry"], optional = true }
js-sys = { version = "0.3", optional = true }
serde-wasm-bindgen = { version = "0.6", optional = true }
console_error_panic_hook = { version = "0.1", optional = true }
wee_alloc = { version = "0.4", optional = true }
getrandom = { version = "0.2", features = ["js"], optional = true }
fastrand = { version = "2.0", optional = true }

# Optional CLI dependencies
clap = { version = "4.0", features = ["derive"], optional = true }
tokio = { version = "1.0", features = ["full"], optional = true }
axum = { version = "0.7", optional = true }
serde_json = { version = "1.0", optional = true }

# Dashboard dependencies
chrono = { version = "0.4", features = ["serde"], optional = true }
csv = { version = "1.3", optional = true }
bincode = { version = "1.3", optional = true }
base64 = { version = "0.22", optional = true }
serde_yaml = { version = "0.9", optional = true }
rmp-serde = { version = "1.1", optional = true }
hostname = { version = "0.3", optional = true }
num_cpus = { version = "1.16", optional = true }

# Optional performance dependencies
wide = { version = "0.7", optional = true }
rayon = { version = "1.7", optional = true }
env_logger = { version = "0.10", optional = true }
approx = { version = "0.5.1", features = ["std"] }
nanosecond-scheduler = "0.1.1"
uuid = { version = "1.6", features = ["v4"], optional = true }
colored = { version = "2.0", optional = true }

[dev-dependencies]
criterion = { version = "0.5" }
proptest = { version = "1.0" }

# Force compatible getrandom version for WASM
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.2", features = ["js"] }


[features]
default = ["std", "serde"]
std = ["env_logger", "lazy_static"]
serde = ["dep:serde"]
wasm = ["wasm-bindgen", "web-sys", "js-sys", "serde-wasm-bindgen", "console_error_panic_hook", "getrandom/js", "fastrand", "rand/getrandom"]
wee_alloc = ["dep:wee_alloc"]
cli = ["clap", "tokio", "axum", "serde_json", "uuid", "colored"]
dashboard = ["chrono", "csv", "bincode", "base64", "serde_yaml", "rmp-serde", "hostname", "num_cpus", "tokio", "serde_json"]
simd = ["wide"]
parallel = ["rayon", "std"]

[[bench]]
name = "solver_benchmarks"
harness = false
# Criterion is a dev-dependency, not a feature — the previous
# `required-features = ["criterion"]` was a silent no-op that
# cargo warned about ("invalid feature `criterion`"). Benchmarks
# always link criterion via dev-dependencies, so no gate is needed.

[profile.release]
lto = true
codegen-units = 1
panic = "abort"
opt-level = 3

[profile.release-wasm]
inherits = "release"
opt-level = "s"
lto = "fat"

[profile.bench]
inherits = "release"
debug = true
