Skip to content

Commit 52f794f

Browse files
authored
Merge pull request #37 from ABouttefeux/evo/update
1.61 const update ande dependecies update
2 parents d67c15d + 697f1a7 commit 52f794f

File tree

17 files changed

+86
-59
lines changed

17 files changed

+86
-59
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
# v0.2.1
3+
4+
- add const on multiple functions where applicable
5+
- update nalgebra to 0.31.0
6+
- update num-traits to 0.2.15
7+
- update rayon to 1.5.3
8+
9+
210
# v0.2.0
311

412
First release

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lattice-qcd-rs"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Aliénore Bouttefeux <[email protected]>"]
55
edition = "2021"
66
readme = "README.md"
@@ -10,6 +10,7 @@ description = "Lattice QCD simulation"
1010
keywords = ["QCD", "Lattice", "Monte-Carlo", "chromodynamics"]
1111
publish = true
1212
license = "MIT OR Apache-2.0"
13+
rust-version = "1.61"
1314

1415
[lib]
1516
path = "src/lib.rs"
@@ -24,15 +25,15 @@ default = ["serde-serialize"]
2425
members = ["procedural_macro"]
2526

2627
[dependencies]
27-
nalgebra = { version = "0.31", features = ["serde-serialize"] }
28+
nalgebra = { version = "0.31.0", features = ["serde-serialize"] }
2829
approx = "0.5.1"
29-
num-traits = "0.2.14"
30+
num-traits = "0.2.15"
3031
rand = "0.8.5"
3132
rand_distr = "0.4.3"
3233
crossbeam = "0.8.1"
33-
rayon = "1.5.1"
34+
rayon = "1.5.3"
3435
serde = { version = "1.0", features = ["derive"], optional = true }
35-
lattice_qcd_rs-procedural_macro = {path = "procedural_macro", version = "0.2.0"}
36+
lattice_qcd_rs-procedural_macro = {path = "procedural_macro", version = "0.2.1"}
3637

3738
[dev-dependencies]
3839
criterion = "0.3.5"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Check out my other repo [plaquette](https://github.com/ABouttefeux/plaquette), a
3333

3434
## Usage
3535

36-
Add `lattice_qcd_rs = { version = "0.2.0", git = "https://github.com/ABouttefeux/lattice_qcd_rs" }` into your `cargo.toml`.
36+
Add `lattice_qcd_rs = { version = "0.2.1", git = "https://github.com/ABouttefeux/lattice_qcd_rs" }` into your `cargo.toml`.
3737
The set of features are
3838
- `serde-serialize` on by default permit the use of serde on some structure
3939
- `no-overflow-test` usage interns to desable overflow test for coverage.

procedural_macro/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
# v0.2.1
3+
4+
- update quote to 1.0.19
5+
- update syn to 1.0.98
6+
- update proc-macro2 to 1.0.39
7+
8+
# v0.2.0
9+
10+
First release

procedural_macro/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "lattice_qcd_rs-procedural_macro"
3-
version = "0.2.0"
3+
version = "0.2.1"
44
authors = ["Aliénore Bouttefeux <[email protected]>"]
55
edition = "2021"
66
description = "Set of procedural macro for the main library lattice_qcd_rs"
@@ -12,9 +12,9 @@ publish = true
1212
proc-macro = true
1313

1414
[dependencies]
15-
quote = "1.0.17"
16-
syn = "1.0.90"
17-
proc-macro2 = "1.0.36"
15+
quote = "1.0.19"
16+
syn = "1.0.98"
17+
proc-macro2 = "1.0.39"
1818

1919
[dev-dependencies]
2020
version-sync = "0.9.4"

procedural_macro/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Procedural macro for lattice_qcd_rs v0.2.0
1+
# Procedural macro for lattice_qcd_rs v0.2.1
22

33
![](https://img.shields.io/badge/language-Rust-orange)
44
![License](https://img.shields.io/badge/license-MIT_OR_Apache--2.0-blue.svg)

procedural_macro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#![warn(clippy::missing_errors_doc)]
3030
#![warn(missing_docs)]
3131
#![forbid(unsafe_code)]
32-
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs-procedural_macro/0.2.0")]
32+
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs-procedural_macro/0.2.1")]
3333

3434
/// Only contains the version test.
3535
#[cfg(test)]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#![warn(clippy::missing_errors_doc)]
3030
#![warn(missing_docs)]
3131
#![forbid(unsafe_code)]
32-
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs/0.2.0")]
32+
#![doc(html_root_url = "https://docs.rs/lattice_qcd_rs/0.2.1")]
3333

3434
extern crate approx;
3535
extern crate crossbeam;

src/number.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ where
1919
D: num_traits::sign::Unsigned + std::cmp::Ord + Copy,
2020
{
2121
/// Get tje integer part of the number
22-
pub fn integer(&self) -> I {
22+
pub const fn integer(&self) -> I {
2323
self.integer
2424
}
2525

2626
/// Get the decimal part of the number as it is stored (as raw data)
27-
pub fn decimal(&self) -> D {
27+
pub const fn decimal(&self) -> D {
2828
self.decimal
2929
}
3030
}

src/simulation/monte_carlo/heat_bath.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,12 @@ pub struct HeatBathSweep<Rng: rand::Rng> {
4848

4949
impl<Rng: rand::Rng> HeatBathSweep<Rng> {
5050
/// Create a new Self form a rng.
51-
pub fn new(rng: Rng) -> Self {
51+
pub const fn new(rng: Rng) -> Self {
5252
Self { rng }
5353
}
5454

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

6566
/// Get a reference to the rng.
66-
pub fn rng(&self) -> &Rng {
67+
pub const fn rng(&self) -> &Rng {
6768
&self.rng
6869
}
6970

src/simulation/monte_carlo/hybrid.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ where
103103
}
104104

105105
/// Getter for the reference hold by self.
106-
pub fn data(&self) -> &MC {
106+
pub const fn data(&self) -> &MC {
107107
self.data
108108
}
109109
}
@@ -344,20 +344,20 @@ where
344344
{
345345
getter!(
346346
/// get the first method
347-
pub,
347+
pub const,
348348
method_1,
349349
MC1
350350
);
351351

352352
getter!(
353353
/// get the second method
354-
pub,
354+
pub const,
355355
method_2,
356356
MC2
357357
);
358358

359359
/// Create a new Self from two methods
360-
pub fn new(method_1: MC1, method_2: MC2) -> Self {
360+
pub const fn new(method_1: MC1, method_2: MC2) -> Self {
361361
Self {
362362
method_1,
363363
method_2,
@@ -366,6 +366,7 @@ where
366366
}
367367

368368
/// Deconstruct the structure ang gives back both methods
369+
#[allow(clippy::missing_const_for_fn)] // false positive
369370
pub fn deconstruct(self) -> (MC1, MC2) {
370371
(self.method_1, self.method_2)
371372
}

src/simulation/monte_carlo/hybrid_monte_carlo.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ where
8989
{
9090
getter!(
9191
/// Get a ref to the rng.
92-
pub rng() -> Rng
92+
pub const rng() -> Rng
9393
);
9494

9595
project!(
9696
/// Get the integrator.
97-
pub internal.integrator() -> &I
97+
pub const internal.integrator() -> &I
9898
);
9999

100100
project_mut!(
@@ -104,20 +104,20 @@ where
104104

105105
project!(
106106
/// Get `delta_t`.
107-
pub internal.delta_t() -> Real
107+
pub const internal.delta_t() -> Real
108108
);
109109

110110
project!(
111111
/// Get the number of steps.
112-
pub internal.number_of_steps() -> usize
112+
pub const internal.number_of_steps() -> usize
113113
);
114114

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

136136
/// Get the last probably of acceptance of the random change.
137+
#[allow(clippy::missing_const_for_fn)] // false positive
137138
pub fn rng_owned(self) -> Rng {
138139
self.rng
139140
}
@@ -219,27 +220,27 @@ where
219220
{
220221
getter!(
221222
/// Get the integrator.
222-
pub,
223+
pub const,
223224
integrator,
224225
I
225226
);
226227

227228
getter_copy!(
228229
/// Get `delta_t`.
229-
pub,
230+
pub const,
230231
delta_t,
231232
Real
232233
);
233234

234235
getter_copy!(
235236
/// Get the number of steps.
236-
pub,
237+
pub const,
237238
number_of_steps,
238239
usize
239240
);
240241

241242
/// see [HybridMonteCarlo::new]
242-
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
243+
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
243244
Self {
244245
delta_t,
245246
number_of_steps,
@@ -340,14 +341,14 @@ where
340341
{
341342
getter!(
342343
/// Get a ref to the rng.
343-
pub,
344+
pub const,
344345
rng,
345346
Rng
346347
);
347348

348349
project!(
349350
/// Get the integrator.
350-
pub,
351+
pub const,
351352
integrator,
352353
internal,
353354
&I
@@ -363,15 +364,15 @@ where
363364

364365
project!(
365366
/// Get `delta_t`.
366-
pub,
367+
pub const,
367368
delta_t,
368369
internal,
369370
Real
370371
);
371372

372373
project!(
373374
/// Get the number of steps.
374-
pub,
375+
pub const,
375376
number_of_steps,
376377
internal,
377378
usize
@@ -382,7 +383,7 @@ where
382383
/// - number_of_steps is the number of time
383384
/// - integrator is the method to solve the equation of motion
384385
/// - rng, a random number generator
385-
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
386+
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I, rng: Rng) -> Self {
386387
Self {
387388
internal: HybridMonteCarloInternalDiagnostics::<
388389
LatticeStateEFSyncDefault<State, D>,
@@ -399,16 +400,17 @@ where
399400
}
400401

401402
/// Get the last probably of acceptance of the random change.
402-
pub fn prob_replace_last(&self) -> Real {
403+
pub const fn prob_replace_last(&self) -> Real {
403404
self.internal.prob_replace_last()
404405
}
405406

406407
/// Get if last step has accepted the replacement.
407-
pub fn has_replace_last(&self) -> bool {
408+
pub const fn has_replace_last(&self) -> bool {
408409
self.internal.has_replace_last()
409410
}
410411

411412
/// Get the last probably of acceptance of the random change.
413+
#[allow(clippy::missing_const_for_fn)] // false positive
412414
pub fn rng_owned(self) -> Rng {
413415
self.rng
414416
}
@@ -493,27 +495,27 @@ where
493495
{
494496
getter!(
495497
/// Get the integrator.
496-
pub,
498+
pub const,
497499
integrator,
498500
I
499501
);
500502

501503
getter_copy!(
502504
/// Get `delta_t`.
503-
pub,
505+
pub const,
504506
delta_t,
505507
Real
506508
);
507509

508510
getter_copy!(
509511
/// Get the number of steps.
510-
pub,
512+
pub const,
511513
number_of_steps,
512514
usize
513515
);
514516

515517
/// see [HybridMonteCarlo::new]
516-
pub fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
518+
pub const fn new(delta_t: Real, number_of_steps: usize, integrator: I) -> Self {
517519
Self {
518520
delta_t,
519521
number_of_steps,
@@ -525,12 +527,12 @@ where
525527
}
526528

527529
/// Get the last probably of acceptance of the random change.
528-
pub fn prob_replace_last(&self) -> Real {
530+
pub const fn prob_replace_last(&self) -> Real {
529531
self.prob_replace_last
530532
}
531533

532534
/// Get if last step has accepted the replacement.
533-
pub fn has_replace_last(&self) -> bool {
535+
pub const fn has_replace_last(&self) -> bool {
534536
self.has_replace_last
535537
}
536538

0 commit comments

Comments
 (0)