Skip to content

Commit

Permalink
Add rough laplace row major
Browse files Browse the repository at this point in the history
  • Loading branch information
skailasa committed May 9, 2024
1 parent c2d13a8 commit 3a2fa2a
Show file tree
Hide file tree
Showing 4 changed files with 239 additions and 193 deletions.
43 changes: 43 additions & 0 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,49 @@ pub(crate) fn check_dimensions_evaluate<K: Kernel, T: RlstScalar>(
);

Check warning on line 46 in src/helpers.rs

View workflow job for this annotation

GitHub Actions / Rust style checks (--features "strict")

Diff in /home/runner/work/green-kernels/green-kernels/src/helpers.rs

Check warning on line 46 in src/helpers.rs

View workflow job for this annotation

GitHub Actions / Rust style checks

Diff in /home/runner/work/green-kernels/green-kernels/src/helpers.rs
}


pub(crate) fn check_dimensions_evaluate_row_major<K: Kernel, T: RlstScalar>(
kernel: &K,
eval_type: EvalType,
sources: &[T::Real],
targets: &[T::Real],
charges: &[T],
result: &[T],
) {
assert!(
sources.len() % kernel.space_dimension() == 0,
"Length of sources {} is not a multiple of space dimension {}.",
sources.len(),
kernel.space_dimension()
);

assert!(
targets.len() % kernel.space_dimension() == 0,
"Length of targets {} is not a multiple of space dimension {}.",
sources.len(),
kernel.space_dimension()
);

let nsources = sources.len() / kernel.space_dimension();
let ntargets = targets.len() / kernel.space_dimension();

assert_eq!(
charges.len(),
nsources,
"Wrong dimension for `charges`. {} != {} ",
charges.len(),
nsources,
);

assert_eq!(
result.len(),
kernel.range_component_count(eval_type) * ntargets,
"Wrong dimension for `result`. {} != {} ",
result.len(),
ntargets * kernel.range_component_count(eval_type),
);
}

pub(crate) fn check_dimensions_assemble<K: Kernel, T: RlstScalar>(
kernel: &K,
eval_type: EvalType,
Expand Down
2 changes: 2 additions & 0 deletions src/laplace_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ mod test {
targets_y_eps[[index, 1]] += eps;
targets_z_eps[[index, 2]] += eps;
}
// println!("HERE FPP {:?} {:?} {:?} {:?}", targets_x_eps.data(), targets_x_eps[[0, 0]], targets_x_eps[[1, 0]], targets_x_eps[[2, 0]]);
// assert!(false);

let mut expected = rlst_dynamic_array2!(f64, [4, ntargets]);

Expand Down
Loading

0 comments on commit 3a2fa2a

Please sign in to comment.