Skip to content

Commit

Permalink
Fix asserts in Equation methods gUx() & gUt()
Browse files Browse the repository at this point in the history
  • Loading branch information
andrei-punko committed Oct 24, 2024
1 parent f56db3a commit b812034
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/java/by/andd3dfx/math/pde/equation/Equation.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,10 @@ public void sUx(String fileName, double[] x) {
* @return U(x) slice
*/
protected Matrix gUt(int it) {
int N = solution.getN();
assert (0 <= it && it < N);
int M = solution.getM();
assert (0 <= it && it < M);

int N = solution.getN();
var matrix = new Matrix(2, N);
for (int i = 0; i < N; i++) {
matrix.setX(i, area.x().x(i));
Expand All @@ -199,9 +200,10 @@ protected Matrix gUt(double t) {
* @return U(t) slice
*/
protected Matrix gUx(int ix) {
int M = solution.getM();
assert (0 <= ix && ix < M);
int N = solution.getN();
assert (0 <= ix && ix < N);

int M = solution.getM();
var matrix = new Matrix(2, M);
for (int i = 0; i <= M; i++) {
matrix.setX(i, area.t().x(i));
Expand Down

0 comments on commit b812034

Please sign in to comment.