Commit 92212040 authored by SirBlueRabbit's avatar SirBlueRabbit
Browse files

refactored parameter struct

parent 879ba8e1
......@@ -10,8 +10,6 @@ output = "test"
[model]
target_volume = 100
eps = 0.02
[model.parameters]
kappa_0 = 0.0
kappa_3 = 3.0
......
......@@ -28,14 +28,9 @@ const VERTICES: [[usize; 2]; 12] = [
#[derive(Clone, Copy, Debug, Deserialize)]
pub struct Model {
parameters: Parameters,
weights: Weights,
pub target_volume: usize,
eps: f32,
}
#[derive(Clone, Copy, Debug, Deserialize)]
pub struct Parameters {
weights: Weights,
kappa_0: f32,
kappa_3: f32,
}
......@@ -137,13 +132,13 @@ impl Model {
shard: usize,
stars: usize,
) -> Self {
let parameters = Parameters { kappa_0, kappa_3 };
let weights = Weights { shard, stars };
Model {
parameters,
weights,
target_volume,
eps,
kappa_0,
kappa_3,
weights,
}
}
......@@ -159,8 +154,8 @@ impl Model {
fn ratio(&self, dn3: usize, dn0: usize) -> Box<[f32]> {
let n = self.target_volume;
let eps = self.eps;
let k0 = self.parameters.kappa_0;
let k3 = self.parameters.kappa_3;
let k0 = self.kappa_0;
let k3 = self.kappa_3;
(0..=(2 * n))
.into_iter()
.map(|n3| {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment