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

Complex number support #567

Merged
merged 29 commits into from Mar 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7c91f2e
Use Complex instead of Real whenever possible on the base/ module.
sebcrozet Feb 23, 2019
77f048b
WIP use Complex instead of Real whenever possible on the linalg module.
sebcrozet Mar 2, 2019
010c009
Fix Schur decomposition.
sebcrozet Mar 12, 2019
e4748c6
Start fixing SVD.
sebcrozet Mar 18, 2019
2f0d95b
Fix most tests.
sebcrozet Mar 19, 2019
3edef2f
Decomposition results: return a real vector whenever applicable.
sebcrozet Mar 19, 2019
b0a9eab
Final SVD fix.
sebcrozet Mar 19, 2019
cb367a6
Fix mint tests.
sebcrozet Mar 19, 2019
fd65738
Fix icamax_full doc-test.
sebcrozet Mar 19, 2019
1001e8e
Cleanup warnings and rename Schur -> RealSchur
sebcrozet Mar 23, 2019
921a05d
Implement some BLAS opertaions involving adjoint.
sebcrozet Mar 23, 2019
ce24ea9
Remove all spurious allocation introduced by complex number support o…
sebcrozet Mar 23, 2019
3cbe605
2018 edition.
sebcrozet Mar 23, 2019
6d76249
Start switching benchmarks to criterion.
sebcrozet Mar 23, 2019
dabff33
Port bidiagonalization benchmark to criterion.
sebcrozet Mar 23, 2019
1e60bc8
Port all remaining benchmarks to criterion.
sebcrozet Mar 23, 2019
5b28c39
Rename Complex to ComplexField.
sebcrozet Mar 25, 2019
4ef4001
Rename Real to RealField.
sebcrozet Mar 25, 2019
3b6cd04
Adapt BLAS tests to complex numbers.
sebcrozet Mar 26, 2019
56f961c
Reexport Complex from num_complex.
sebcrozet Mar 26, 2019
f9995f1
Fix tests.
sebcrozet Mar 31, 2019
38ef0cb
Merge branch 'dev' into complex
sebcrozet Mar 31, 2019
ba40e8e
Fix merge errors due to the switch to rust 2018.
sebcrozet Mar 31, 2019
eddaf66
nalgebra-lapack: reuse openblas by default.
sebcrozet Mar 31, 2019
55873ca
Fix compilation with no-std.
sebcrozet Mar 31, 2019
7dbff7c
Continue reexporting the deprecated alga::general::Real trait.
sebcrozet Mar 31, 2019
86fa4be
Remove the criterion dependency and add comment to re-add it to run b…
sebcrozet Mar 31, 2019
18b9f82
Fix warnings.
sebcrozet Mar 31, 2019
94a8bab
Uncomment the fast renormalization of Rotation2.
sebcrozet Mar 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 16 additions & 2 deletions Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "nalgebra"
version = "0.17.2"
version = "0.17.3"
authors = [ "Sébastien Crozet <developer@crozet.re>" ]

description = "Linear algebra library with transformations and statically-sized or dynamically-sized matrices."
Expand All @@ -11,6 +11,7 @@ readme = "README.md"
categories = [ "science" ]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
license = "BSD-3-Clause"
edition = "2018"

exclude = ["/ci/*", "/.travis.yml", "/Makefile"]

Expand All @@ -26,7 +27,7 @@ arbitrary = [ "quickcheck" ]
serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ]
abomonation-serialize = [ "abomonation" ]
sparse = [ ]
debug = [ ]
debug = [ "approx/num-complex", "rand/std" ]
alloc = [ ]
io = [ "pest", "pest_derive" ]

Expand All @@ -53,6 +54,19 @@ alga = { git = "https://github.com/rustsim/alga", branch = "dev" }
[dev-dependencies]
serde_json = "1.0"
rand_xorshift = "0.1"
### Uncomment this line before running benchmarks.
### We can't just let this uncommented because that would breack
### compilation for #[no-std] because of the terrible Cargo bug
### https://github.com/rust-lang/cargo/issues/4866
#criterion = "0.2.10"

[workspace]
members = [ "nalgebra-lapack", "nalgebra-glm" ]

[[bench]]
name = "nalgebra_bench"
harness = false
path = "benches/lib.rs"

[profile.bench]
lto = true
42 changes: 18 additions & 24 deletions benches/common/macros.rs
Expand Up @@ -2,56 +2,52 @@

macro_rules! bench_binop(
($name: ident, $t1: ty, $t2: ty, $binop: ident) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
use rand::SeedableRng;
let mut rng = IsaacRng::seed_from_u64(0);
let a = rng.gen::<$t1>();
let b = rng.gen::<$t2>();

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
a.$binop(b)
})
}));
}
}
);

macro_rules! bench_binop_ref(
($name: ident, $t1: ty, $t2: ty, $binop: ident) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
use rand::SeedableRng;
let mut rng = IsaacRng::seed_from_u64(0);
let a = rng.gen::<$t1>();
let b = rng.gen::<$t2>();

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
a.$binop(&b)
})
}));
}
}
);

macro_rules! bench_binop_fn(
($name: ident, $t1: ty, $t2: ty, $binop: path) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
use rand::SeedableRng;
let mut rng = IsaacRng::seed_from_u64(0);
let a = rng.gen::<$t1>();
let b = rng.gen::<$t2>();

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
$binop(&a, &b)
})
}));
}
}
);

macro_rules! bench_unop_na(
($name: ident, $t: ty, $unop: ident) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
const LEN: usize = 1 << 13;

use rand::SeedableRng;
Expand All @@ -60,21 +56,20 @@ macro_rules! bench_unop_na(
let elems: Vec<$t> = (0usize .. LEN).map(|_| rng.gen::<$t>()).collect();
let mut i = 0;

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
i = (i + 1) & (LEN - 1);

unsafe {
test::black_box(na::$unop(elems.get_unchecked(i)))
}
})
}));
}
}
);

macro_rules! bench_unop(
($name: ident, $t: ty, $unop: ident) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
const LEN: usize = 1 << 13;

use rand::SeedableRng;
Expand All @@ -83,21 +78,20 @@ macro_rules! bench_unop(
let mut elems: Vec<$t> = (0usize .. LEN).map(|_| rng.gen::<$t>()).collect();
let mut i = 0;

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
i = (i + 1) & (LEN - 1);

unsafe {
test::black_box(elems.get_unchecked_mut(i).$unop())
}
})
}));
}
}
);

macro_rules! bench_construction(
($name: ident, $constructor: path, $( $args: ident: $types: ty),*) => {
#[bench]
fn $name(bh: &mut Bencher) {
fn $name(bh: &mut criterion::Criterion) {
const LEN: usize = 1 << 13;

use rand::SeedableRng;
Expand All @@ -106,14 +100,14 @@ macro_rules! bench_construction(
$(let $args: Vec<$types> = (0usize .. LEN).map(|_| rng.gen::<$types>()).collect();)*
let mut i = 0;

bh.iter(|| {
bh.bench_function(stringify!($name), move |bh| bh.iter(|| {
i = (i + 1) & (LEN - 1);

unsafe {
let res = $constructor($(*$args.get_unchecked(i),)*);
test::black_box(res)
}
})
}));
}
}
);