Skip to content

Commit

Permalink
Merge pull request #37 from ABouttefeux/evo/update
Browse files Browse the repository at this point in the history
1.61 const update ande dependecies update
  • Loading branch information
ABouttefeux authored Jun 19, 2022
2 parents d67c15d + 697f1a7 commit 52f794f
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 59 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

# v0.2.1

- add const on multiple functions where applicable
- update nalgebra to 0.31.0
- update num-traits to 0.2.15
- update rayon to 1.5.3


# v0.2.0

First release
Expand Down
11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lattice-qcd-rs"
version = "0.2.0"
version = "0.2.1"
authors = ["Aliénore Bouttefeux <alienore.bouttefeux@gmail.com>"]
edition = "2021"
readme = "README.md"
Expand All @@ -10,6 +10,7 @@ description = "Lattice QCD simulation"
keywords = ["QCD", "Lattice", "Monte-Carlo", "chromodynamics"]
publish = true
license = "MIT OR Apache-2.0"
rust-version = "1.61"

[lib]
path = "src/lib.rs"
Expand All @@ -24,15 +25,15 @@ default = ["serde-serialize"]
members = ["procedural_macro"]

[dependencies]
nalgebra = { version = "0.31", features = ["serde-serialize"] }
nalgebra = { version = "0.31.0", features = ["serde-serialize"] }
approx = "0.5.1"
num-traits = "0.2.14"
num-traits = "0.2.15"
rand = "0.8.5"
rand_distr = "0.4.3"
crossbeam = "0.8.1"
rayon = "1.5.1"
rayon = "1.5.3"
serde = { version = "1.0", features = ["derive"], optional = true }
lattice_qcd_rs-procedural_macro = {path = "procedural_macro", version = "0.2.0"}
lattice_qcd_rs-procedural_macro = {path = "procedural_macro", version = "0.2.1"}

[dev-dependencies]
criterion = "0.3.5"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Check out my other repo [plaquette](https://github.com/ABouttefeux/plaquette), a

## Usage

Add `lattice_qcd_rs = { version = "0.2.0", git = "https://github.com/ABouttefeux/lattice_qcd_rs" }` into your `cargo.toml`.
Add `lattice_qcd_rs = { version = "0.2.1", git = "https://github.com/ABouttefeux/lattice_qcd_rs" }` into your `cargo.toml`.
The set of features are
- `serde-serialize` on by default permit the use of serde on some structure
- `no-overflow-test` usage interns to desable overflow test for coverage.
Expand Down
10 changes: 10 additions & 0 deletions procedural_macro/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

# v0.2.1

- update quote to 1.0.19
- update syn to 1.0.98
- update proc-macro2 to 1.0.39

# v0.2.0

First release
8 changes: 4 additions & 4 deletions procedural_macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lattice_qcd_rs-procedural_macro"
version = "0.2.0"
version = "0.2.1"
authors = ["Aliénore Bouttefeux <alienore.bouttefeux@gmail.com>"]
edition = "2021"
description = "Set of procedural macro for the main library lattice_qcd_rs"
Expand All @@ -12,9 +12,9 @@ publish = true
proc-macro = true

[dependencies]
quote = "1.0.17"
syn = "1.0.90"
proc-macro2 = "1.0.36"
quote = "1.0.19"
syn = "1.0.98"
proc-macro2 = "1.0.39"

[dev-dependencies]
version-sync = "0.9.4"
2 changes: 1 addition & 1 deletion procedural_macro/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Procedural macro for lattice_qcd_rs v0.2.0
# Procedural macro for lattice_qcd_rs v0.2.1

![](https://img.shields.io/badge/language-Rust-orange)
![License](https://img.shields.io/badge/license-MIT_OR_Apache--2.0-blue.svg)
Expand Down
2 changes: 1 addition & 1 deletion procedural_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#![warn(clippy::missing_errors_doc)]
#![warn(missing_docs)]
#![forbid(unsafe_code)]
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs-procedural_macro/0.2.0")]
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs-procedural_macro/0.2.1")]

/// Only contains the version test.
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#![warn(clippy::missing_errors_doc)]
#![warn(missing_docs)]
#![forbid(unsafe_code)]
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs/0.2.0")]
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs/0.2.1")]

extern crate approx;
extern crate crossbeam;
Expand Down
4 changes: 2 additions & 2 deletions src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ where
D: num_traits::sign::Unsigned + std::cmp::Ord + Copy,
{
/// Get tje integer part of the number
pub fn integer(&self) -> I {
pub const fn integer(&self) -> I {
self.integer
}

/// Get the decimal part of the number as it is stored (as raw data)
pub fn decimal(&self) -> D {
pub const fn decimal(&self) -> D {
self.decimal
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/simulation/monte_carlo/heat_bath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ pub struct HeatBathSweep<Rng: rand::Rng> {

impl<Rng: rand::Rng> HeatBathSweep<Rng> {
/// Create a new Self form a rng.
pub fn new(rng: Rng) -> Self {
pub const fn new(rng: Rng) -> Self {
Self { rng }
}

/// Absorbed self and return the RNG as owned. It essentially deconstruct the structure.
#[allow(clippy::missing_const_for_fn)] // false positive
pub fn rng_owned(self) -> Rng {
self.rng
}
Expand All @@ -63,7 +64,7 @@ impl<Rng: rand::Rng> HeatBathSweep<Rng> {
}

/// Get a reference to the rng.
pub fn rng(&self) -> &Rng {
pub const fn rng(&self) -> &Rng {
&self.rng
}

Expand Down
9 changes: 5 additions & 4 deletions src/simulation/monte_carlo/hybrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ where
}

/// Getter for the reference hold by self.
pub fn data(&self) -> &MC {
pub const fn data(&self) -> &MC {
self.data
}
}
Expand Down Expand Up @@ -344,20 +344,20 @@ where
{
getter!(
/// get the first method
pub,
pub const,
method_1,
MC1
);

getter!(
/// get the second method
pub,
pub const,
method_2,
MC2
);

/// Create a new Self from two methods
pub fn new(method_1: MC1, method_2: MC2) -> Self {
pub const fn new(method_1: MC1, method_2: MC2) -> Self {
Self {
method_1,
method_2,
Expand All @@ -366,6 +366,7 @@ where
}

/// Deconstruct the structure ang gives back both methods
#[allow(clippy::missing_const_for_fn)] // false positive
pub fn deconstruct(self) -> (MC1, MC2) {
(self.method_1, self.method_2)
}
Expand Down
46 changes: 24 additions & 22 deletions src/simulation/monte_carlo/hybrid_monte_carlo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ where
{
getter!(
/// Get a ref to the rng.
pub rng() -> Rng
pub const rng() -> Rng
);

project!(
/// Get the integrator.
pub internal.integrator() -> &I
pub const internal.integrator() -> &I
);

project_mut!(
Expand All @@ -104,20 +104,20 @@ where

project!(
/// Get `delta_t`.
pub internal.delta_t() -> Real
pub const internal.delta_t() -> Real
);

project!(
/// Get the number of steps.
pub internal.number_of_steps() -> usize
pub const internal.number_of_steps() -> usize
);

/// gives the following parameter for the HCM :
/// - delta_t is the step size per integration of the equation of motion
/// - number_of_steps is the number of time
/// - integrator is the methods to solve the equation of motion
/// - rng, a random number generator
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
Self {
internal: HybridMonteCarloInternal::<LatticeStateEFSyncDefault<State, D>, I, D>::new(
delta_t,
Expand All @@ -134,6 +134,7 @@ where
}

/// Get the last probably of acceptance of the random change.
#[allow(clippy::missing_const_for_fn)] // false positive
pub fn rng_owned(self) -> Rng {
self.rng
}
Expand Down Expand Up @@ -219,27 +220,27 @@ where
{
getter!(
/// Get the integrator.
pub,
pub const,
integrator,
I
);

getter_copy!(
/// Get `delta_t`.
pub,
pub const,
delta_t,
Real
);

getter_copy!(
/// Get the number of steps.
pub,
pub const,
number_of_steps,
usize
);

/// see [HybridMonteCarlo::new]
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
Self {
delta_t,
number_of_steps,
Expand Down Expand Up @@ -340,14 +341,14 @@ where
{
getter!(
/// Get a ref to the rng.
pub,
pub const,
rng,
Rng
);

project!(
/// Get the integrator.
pub,
pub const,
integrator,
internal,
&I
Expand All @@ -363,15 +364,15 @@ where

project!(
/// Get `delta_t`.
pub,
pub const,
delta_t,
internal,
Real
);

project!(
/// Get the number of steps.
pub,
pub const,
number_of_steps,
internal,
usize
Expand All @@ -382,7 +383,7 @@ where
/// - number_of_steps is the number of time
/// - integrator is the method to solve the equation of motion
/// - rng, a random number generator
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
Self {
internal: HybridMonteCarloInternalDiagnostics::<
LatticeStateEFSyncDefault<State, D>,
Expand All @@ -399,16 +400,17 @@ where
}

/// Get the last probably of acceptance of the random change.
pub fn prob_replace_last(&self) -> Real {
pub const fn prob_replace_last(&self) -> Real {
self.internal.prob_replace_last()
}

/// Get if last step has accepted the replacement.
pub fn has_replace_last(&self) -> bool {
pub const fn has_replace_last(&self) -> bool {
self.internal.has_replace_last()
}

/// Get the last probably of acceptance of the random change.
#[allow(clippy::missing_const_for_fn)] // false positive
pub fn rng_owned(self) -> Rng {
self.rng
}
Expand Down Expand Up @@ -493,27 +495,27 @@ where
{
getter!(
/// Get the integrator.
pub,
pub const,
integrator,
I
);

getter_copy!(
/// Get `delta_t`.
pub,
pub const,
delta_t,
Real
);

getter_copy!(
/// Get the number of steps.
pub,
pub const,
number_of_steps,
usize
);

/// see [HybridMonteCarlo::new]
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
Self {
delta_t,
number_of_steps,
Expand All @@ -525,12 +527,12 @@ where
}

/// Get the last probably of acceptance of the random change.
pub fn prob_replace_last(&self) -> Real {
pub const fn prob_replace_last(&self) -> Real {
self.prob_replace_last
}

/// Get if last step has accepted the replacement.
pub fn has_replace_last(&self) -> bool {
pub const fn has_replace_last(&self) -> bool {
self.has_replace_last
}

Expand Down
Loading

0 comments on commit 52f794f

Please sign in to comment.