Integration With Eigen

Zoltan Padrah edited this page Aug 25, 2012 · 1 revision
Clone this wiki locally

integrating Eigen

It would be useful to integrate Eigen library in ktechlab, because the following benefits:

  • less code to maintain
  • tested solution, actively developed
The proposed equation solving method is LU, see documentation here: http://eigen.tuxfamily.org/dox/TutorialAdvancedLinearAlgebra.html#TutorialAdvLU

The decomposition is done at the construction of the LU. At this step it allocates memory for its data structures and performs LU decomposition in O(n^3^) operations.

When the solve method is called, is gives result in O(n^2^) operations.

The problems with integration:

  • The caching algorithm is not clear to me, so I just skipped it. This has performance impact
  • For nonlinear circuits, the equations must be solved more than once per step. Because the LU must be rebuilt for each iteration, it allocates memory and frees it in each step many times.
Probably an in-place LU solver would be better.

Also the fact that the equations don't change very much in each step could be exploited. If A0 * X0 = B0 from the previous iteration, in the next step (A0 + A1)*X = B0 should be solved, wheree A1 is sparse and contains small valued elements.

tuning the CPU usage

TODO: graphic here

Internally the simulator runs 1000 steps in one second. Each step takes a number of operations. So if the CPU usage is too high, the number of ticks could be reduced, so the CPU usage could be reduced.

Another possible tuning parameter can be the elapsed time in the circuit between two simulator steps. This way we could set the tradeoff between the precision (and possible convergence problems) in the circuit and the length of time interval simulated.

Still under construction