Skip to content
This repository was archived by the owner on Mar 25, 2025. It is now read-only.

Fix (NON)LINEAR block with explicit SOLVEFOR#1326

Merged
JCGoran merged 2 commits into
masterfrom
jelic/fix_linear_solvefor
Jun 20, 2024
Merged

Fix (NON)LINEAR block with explicit SOLVEFOR#1326
JCGoran merged 2 commits into
masterfrom
jelic/fix_linear_solvefor

Conversation

@JCGoran

@JCGoran JCGoran commented Jun 18, 2024

Copy link
Copy Markdown
Contributor

The (NON)LINEAR block in NMODL was not accounting for the SOLVEFOR variables, which means that something like the following would fail (when used with sympy --analytic):

STATE {
    x
    y
    z
}
LINEAR lin SOLVEFOR x, y {
    ~ 3 * x = v - y
    ~ x = z * y - 5
}

because the SOLVEFOR variables were not accounted for, only the STATE ones, which caused the solver to think this was a nonlinear system due to the presence of the z * y term in the second equation (i.e. the solver would try to solve the system for all STATE variables instead of just the ones specified in SOLVEFOR).

bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Jun 18, 2024
@JCGoran JCGoran requested review from 1uc and pramodk June 18, 2024 11:18
@codecov

codecov Bot commented Jun 18, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 85.37%. Comparing base (5ff221d) to head (df4a608).

Files Patch % Lines
src/visitors/sympy_solver_visitor.cpp 84.21% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1326      +/-   ##
==========================================
- Coverage   85.37%   85.37%   -0.01%     
==========================================
  Files         178      178              
  Lines       13440    13458      +18     
==========================================
+ Hits        11475    11490      +15     
- Misses       1965     1968       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bbpbuildbot

This comment has been minimized.

Comment thread src/visitors/sympy_solver_visitor.cpp Outdated
bbpadministrator pushed a commit to BlueBrain/nmodl-references that referenced this pull request Jun 19, 2024
@JCGoran JCGoran changed the title Fix LINEAR block with explicit SOLVEFOR Fix (NON)LINEAR block with explicit SOLVEFOR Jun 19, 2024
@JCGoran

JCGoran commented Jun 19, 2024

Copy link
Copy Markdown
Contributor Author

It seems that, according to the docs, you can also use SOLVEFOR in KINETIC, which I believe requires modifying some other visitor (which one?):
https://github.com/neuronsimulator/nrn/blob/386212697752a52a083b7611a07ab4030d9cb3f0/src/nmodl/simultan.cpp#L372-L389

@bbpbuildbot

Copy link
Copy Markdown
Collaborator

Logfiles from GitLab pipeline #217825 (:no_entry:) have been uploaded here!

Status and direct links:

@JCGoran JCGoran requested a review from 1uc June 20, 2024 08:19
@JCGoran JCGoran merged commit de8e623 into master Jun 20, 2024
@JCGoran JCGoran deleted the jelic/fix_linear_solvefor branch June 20, 2024 10:02
JCGoran added a commit to neuronsimulator/nrn that referenced this pull request Mar 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants