Skip to content

Commit

Permalink
References for 'BlueBrain/nmodl#1419'.
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions Bot committed Sep 3, 2024
1 parent 58cbef1 commit beee4bf
Show file tree
Hide file tree
Showing 9 changed files with 72 additions and 18 deletions.
10 changes: 8 additions & 2 deletions global/neuron/thread_newton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions kinetic/coreneuron/X2Y.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions kinetic/coreneuron/side_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions kinetic/neuron/X2Y.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions kinetic/neuron/side_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions solve/neuron/derivimplicit_array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions solve/neuron/derivimplicit_scalar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions steady_state/coreneuron/minipump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,9 +265,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down
10 changes: 8 additions & 2 deletions steady_state/neuron/minipump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,15 @@ EIGEN_DEVICE_FUNC bool is_converged(const Eigen::Matrix<double, N, 1>& X,
const Eigen::Matrix<double, N, N>& J,
const Eigen::Matrix<double, N, 1>& F,
double eps) {
double square_eps = eps*eps;
for (Eigen::Index i = 0; i < N; ++i) {
double square_error = J(i, Eigen::all).cwiseAbs2() * (eps * X).cwiseAbs2();
if (F(i) * F(i) > square_error) {
double square_error = 0.0;
for(Eigen::Index j = 0; j < N; ++j) {
double JX = J(i, j) * X(j);
square_error += JX*JX;
}

if (F(i) * F(i) > square_eps*square_error) {
return false;
}
}
Expand Down

0 comments on commit beee4bf

Please sign in to comment.