-
Content Count
3711 -
Joined
-
Last visited
-
Days Won
185
Everything posted by David Heffernan
-
Enums and generics
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I do this; [Names( 'Curvature', 'Bend angle' )] TPreBendSpecifiedBy = ( pbsCurvature, pbsBendAngle ); and then I can write: Assert(Enum.Name(pbsCurvature) = 'Curvature')) Of course this requires some library code behind it, but it's pretty convenient. -
Boolean short-circuit with function calls
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
I can’t see past // must call all functions, defeat short circuit evaluation aVal := A(); bVal := B(); cVal := C(); Result := aVal or bVal or cVal; I don’t care for temporarily disabling short circuit evaluation. I’d rather have the predictability of one rule for expression evaluation. Mix and match adds an impedance to understanding for the reader. -
How to extend/add helpers to for record function?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Yes. This is what I said in my earlier comments. -
How to extend/add helpers to for record function?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
The helper is on the node. So you’d need to call vNode.ToInteger(‘Id’). I think you could do with a better name for the helper function. -
How to extend/add helpers to for record function?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
You have to pass the attribute name to the helper function. Also, don't call GetAttribute twice. Store the return value in a local variable. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
ARPACK is recommended for extracting a small number of eigen vectors from a huge problem. LAPACK has effective methods for extracting all solutions using a direct method. Neither are easy to use from Delphi. I have done so but it isn't for the faint of heart. Especially ARPACK. The famous C++ Eigen library is very capable though and easy to use. I'd suggest you wrap that in a DLL. Start in Matlab to prove that it can do the calculation sufficiently quickly for a typical matrix that you will work with. Then write a C++ program in Eigen to solve the same problems. Does that work effectively? Then, and only then, try to wrap it up to be called from Delphi. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
It wasn't aimed at the OP. It was aimed at all the misleading posters who guessed and speculated. In my opinion it is those posts that are harmful to the OP's chance of progress. This topic requires knowledge of numerical methods for solving eigenproblems. Most of the posts have not lived up to that. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
Why does anybody think that all this guessing would be useful? Does anybody have much experience of success when guessing? Solving eigen problems is a very challenging numerical problem. Does anybody really believe that good solutions arise from guesswork? I am frankly embarrassed by this thread. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
It is practical. It is routine to solve eigen problems for systems of thousands of variables. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
@Kas Ob.It's pointless trying to argue about making the wrong solution work. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
Try other compilers isn't going to make any difference here. Other compilers will face the same problems. I am reasonably confident that the correct way forward is to use the right tool for the job. And root finding of the characteristic polynomial is not the way to find eigenvalues on a finite computer. -
Delphi implementation of Aberth–Ehrlich method and precision problem
David Heffernan replied to at3s's topic in Algorithms, Data Structures and Class Design
If your goal is to find eigenvalues then you should use a dedicated library for that. There are a good few about that can handle matrices with sizes in the thousands. It sounds like you are trying to find roots of the characteristic polynomial. This is not a robust approach. -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
I don't need to. I'm not the one making the claim that all huge memory allocations should be made using VirtualAlloc. It's you that is making that claim. -
When can Class.Create fail?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Well not necessarily. Typically you let exceptions float upwards to be handled by some high level exception handler. -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Not obvious at all. Usually you allocated memory because you wanted to use it. If you've swapped the entire block to disk then bringing a couple of pages back is the least of your worries. Solve your problem by avoiding swapping in the first place. Nothing you have said, in my view, supports your claim that all allocation of huge blocks should be done using VirtualAlloc. -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
I don't see any benchmark to support the assertion that all allocation of huge blocks should be done using VirtualAlloc. Can you point to it. -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
A valid benchmark from a real world program would make me consider what I said. -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Premature optimisation -
Is interposer class really best to customize TPanel.Paint?
David Heffernan replied to Mike Torrettinni's topic in VCL
Yes, that's what I envisage -
System.GetMemory returning NIL
David Heffernan replied to dummzeuch's topic in RTL and Delphi Object Pascal
Can't understand why you aren't calling GetMem. -
Is interposer class really best to customize TPanel.Paint?
David Heffernan replied to Mike Torrettinni's topic in VCL
Another option is to use a layered window to add the additional painting. This is very flexible, not limited to panels, doesn't require any changes to the implementation of the controls. -
When can Class.Create fail?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
Two things can happen 1. The constructor succeeds and returns a valid object reference. 2. An exception is raised, propagates out of the constructor, and the assignment never happens. -
When can Class.Create fail?
David Heffernan replied to Mike Torrettinni's topic in Algorithms, Data Structures and Class Design
The try finally here isn't protecting the execution of the constructor. It protects against exceptions in the code that runs after the constructor completes, after the try. Look at the code in your post. The try finally is not active when the constructor runs. If an exception is raised in the constructor then the try is never reached. So, yes, you do need the try finally. -
How to keep track/organize all overloaded, extended 3rd party source code?
David Heffernan replied to Mike Torrettinni's topic in General Help
I literally wrote class helpers. It will. That's a problem if you are using other helpers for the class. Are you? -
How to keep track/organize all overloaded, extended 3rd party source code?
David Heffernan replied to Mike Torrettinni's topic in General Help
This is what class helpers are for. Likewise.