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
Comments
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! |
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. |
Yes, of course, now I see! We only need one M independent of the number of timesteps.=) I really think we should do this. |
This issue appears to be stale due to non-activity and will be closed automatically |
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 coefficientsA, 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?
The text was updated successfully, but these errors were encountered: