Next: Solution of Conductance Equations. Up: Hsolve as a Virtual Previous: Hsolve as a Virtual Contents

## Solution of The Cable Equation.

The solution of the matrix that emerges from the spatial discretization of the cable equation is done by looping over the byte-code in an array called `funcs`. The number of entries in this array is given by the field `nfuncs`:

        genesis > showfield solve nfuncs
        [ /Purkinje/solve ]
        nfuncs               = 25810

The `funcs` array contains the actual code to be executed and also encodes the structure of the matrix (which corresponds to the morphology of the neuron). Remember that this matrix is inverted in two phases that are known as forward elimination and backward substitution. If we disassemble a small part of the `funcs` array, we get something like the following:

        genesis > printfuncs solve 0 20
        00000 :: 0    0             FOBA_ELIM    0
        00002 :: 1                  SET_DIAG
        00003 :: 0    2             FOBA_ELIM    2
        00005 :: 2                  SKIP_DIAG
        00006 :: 0    6             FOBA_ELIM    6
        00008 :: 1                  SET_DIAG
        00009 :: 0    4             FOBA_ELIM    4
        00011 :: 0    8             FOBA_ELIM    8
        00013 :: 2                  SKIP_DIAG
        00014 :: 0   12             FOBA_ELIM   12
        00016 :: 1                  SET_DIAG
        00017 :: 0   10             FOBA_ELIM   10
        00019 :: 0   14             FOBA_ELIM   14

The first `FOBA_ELIM` opcode tells that the coefficient at offset `0` should be eliminated from the matrix. Since we are at the start of the `funcs` array, `hsolve` knows that it is in the process of forward elimination (the opcode `FOBA_ELIM` encodes forward elimination as well as backward substitution).

Second the `SET_DIAG` opcode calculates a new value for the coefficient on the diagonal of the matrix.

The `SKIP_DIAG` opcode calculates a new value for the coefficient on the diagonal of the matrix, but then skips on to the next row in the matrix. This means that we are dealing with a tip of a dendrite. At positions 9 and 11 we encounter two consecutive elimination steps. This a witness of a branch point in the morphology of the neuron.

Note that the coefficients to be eliminated, are found in the `ravals` and `results` arrays. When walking over the `funcs` array, `hsolve` also automatically sweeps through these two data arrays.

The separation between forward elimination and backward substitution is done with a `FINISH` opcode:

        genesis > printfuncs solve 12164 12171
        12164 :: 1                  SET_DIAG
        12165 :: 0 9092             FOBA_ELIM 9092
        12167 :: 7                  FINISH
        12168 :: 0 9094             FOBA_ELIM 9094
        12170 :: 6                  CALC_RESULTS
        12171 :: 0 9092             FOBA_ELIM 9092

After the `FINISH` opcode, `hsolve` starts the backward substitution cycle (so from then on the `FOBA_ELIM` opcode encodes a backward substitution operation. Finally the `CALC_RESULTS` operation tells that all coefficients from the current row have been eliminated and that the final result for that row can be calculated. There are yet some other opcodes that are used for symmetric compartments. These are not discussed.

The emulation of this byte-code is done in the source file `hines_solve.c`.

Next: Solution of Conductance Equations. Up: Hsolve as a Virtual Previous: Hsolve as a Virtual Contents