## [Ktechlab-devel] Converting to Eigen - patch for revision, ver.1

 [Ktechlab-devel] Converting to Eigen - patch for revision, ver.1 From: P Zoltan - 2009-08-09 11:59:41 Attachments: convert-to-eigen-00.path.bz2 ``` Hi, here is a patch that makes ktechlab to use Eigen for calculations, so the internal matrix implementation can be removed. Steps to use: 1. patch the source. If it fails, tell me, because I haven't tested the patch :D 2. download and extract eigen somewhere. I've used version 2.0.3. (Note: see a comment in the patch about an eigen bug -- we should use a newer version when we import eigen in ktechlab ) 3. in kdevelop, in the automake manager, add the path of the extraced eigen sources to the includes. This should be done for all subfolders... 4. compile 5. run Known problems: - the caching and changed/unchanged flags probabily don't work as they should - when inserting a reactive element in the circuit, the cpu usage will increase to 100% after a time. Probable causes are that eigen uses great precision calculation, so the circuit will never enter in steady state. Or just some caching problem... Todos: - test it :D - we'll have to define _clearly_ the algorithms and data structures used in the cirucit solving process. Currently I don't know how the A, b changed flags should work and what is the purpose of CNode and CBranch classes, how/when the iterations shoud be done, and so on... Here is the sketch of the algorithm (should be extended...): if a component is added, removed, connected, ... in the circuitdocument: split the document in circuits, by connectivity create elementset from the circuit create the matrix corresponding to the elements a step in the simulator: if the circuit contains nonlinear elements solve the cirucit by iterations in each iteration call the handler of nonlinear elements recreate the LU of the eqation matrix update nodes (why?) run logic (here -- why?) check for convergence else solve as a linear system run logic (where are the components updated?) All the above shoudl be clearly defined, an only after, starting to test/refactor the implementation ```