Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorize calculation of axial currents #148

Open
espenhgn opened this issue Oct 6, 2019 · 4 comments
Open

Vectorize calculation of axial currents #148

espenhgn opened this issue Oct 6, 2019 · 4 comments

Comments

@espenhgn
Copy link
Collaborator

espenhgn commented Oct 6, 2019

The calculation of axial currents (Algorithm 1 in https://doi.org/10.3389/fninf.2018.00092) is linear, that is, the I = A*V_1 + B*V_2 + C*... where the coefficients A, B, C, ... are computed from the corresponding compartment axial resistivity. The calculation of axial currents from membrane voltages can be reformulated as I = MV where V is a matrix with all voltages, M a sparse matrix with the corresponding coefficients that can be computed once. The calculation of axial currents can then be computed very fast without explicit for loops.

@solveignaess, does this sound feasible?

@espenhgn espenhgn added this to the v2.1 milestone Oct 6, 2019
@solveignaess
Copy link
Contributor

Yes, I think this sounds feasible. However, finding the axial resistance is not so straightforward (needs to be set specifically for first or last segment in a section, and for segments attached to more than one segment), and I think some looping might be necessary in order to do this. But I don't think we need to loop through all segments of each section, so it seems like we can save time here!

@espenhgn
Copy link
Collaborator Author

Constructing the sparse matrix M will indeed involve nested for-loops I agree, but it only needs to be computed once, and wouldn't be slow relative to the time it takes to solve for membrane voltages and transmembrane currents in a typical simulation.

@solveignaess
Copy link
Contributor

Yes, of course, now I see! We only need one M independent of the number of timesteps.=) I really think we should do this.

@github-actions
Copy link

This issue appears to be stale due to non-activity and will be closed automatically

@github-actions github-actions bot closed this as completed Dec 3, 2020
@espenhgn espenhgn reopened this Feb 3, 2021
@espenhgn espenhgn modified the milestones: v2.2, v2.3 Feb 3, 2021
@espenhgn espenhgn added this to To do in v2.3 via automation Feb 3, 2021
@github-actions github-actions bot closed this as completed Mar 6, 2021
v2.3 automation moved this from To do to Done Mar 6, 2021
@espenhgn espenhgn reopened this Mar 6, 2021
v2.3 automation moved this from Done to In progress Mar 6, 2021
@github-actions github-actions bot closed this as completed Apr 6, 2021
v2.3 automation moved this from In progress to Done Apr 6, 2021
@espenhgn espenhgn reopened this Apr 6, 2021
v2.3 automation moved this from Done to In progress Apr 6, 2021
@github-actions github-actions bot closed this as completed May 7, 2021
v2.3 automation moved this from In progress to Done May 7, 2021
@espenhgn espenhgn reopened this Jun 16, 2021
v2.3 automation moved this from Done to In progress Jun 16, 2021
v2.3 automation moved this from In progress to Done Jul 17, 2021
@espenhgn espenhgn reopened this Mar 11, 2022
v2.3 automation moved this from Done to In progress Mar 11, 2022
v2.3 automation moved this from In progress to Done Apr 11, 2022
@espenhgn espenhgn reopened this Aug 2, 2022
v2.3 automation moved this from Done to In progress Aug 2, 2022
@espenhgn espenhgn modified the milestones: v2.3, v2.3.1 Dec 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v2.3
In progress
Development

No branches or pull requests

2 participants