On Sat, Aug 7, 2010 at 8:51 PM, Rene Brun <Rene.Brun_at_cern.ch> wrote:
> see class TLinearFitter (http://root.cern.ch/root/html/TLinearFitter.html)
> and examples in $ROOTSYS/tutorials/fit
>
> Rene Brun
>
>
>
> Zoltan Seress wrote:
>
>>
>> Dear Listmembers,
>>
>> I'm new to root, so please let me ask. I need a least trimmed squares
>> linear solver for "standard" Ax=b linear equation systems. Can I do this
>> with root? I looked in the user's guide, tutorials and howtos and now I
>> think it can't be done. (There is a least trimmed method for curve fitting,
>> but not for solvers.) But maybe I missed something, so I ask.
>>
>> Regards,
>> --
>> Zoli
>>
>
> Thank you, Rene!
Can I ask for further help? I wanted to try a simple example, but didn't
managed to.
A*x=y, where
A = ( 1 3 4
2 0 3 0 1 1 1 1 0 )
x = (x1 x2 x3)
y = (2 1 0 8)
Here is the code what I created, but it gives zeroes as result, so something must be wrong with it.
#include "TLinearFitter.h"
void root_example()
{
Double_t a[] = {1.0, 3.0, 4.0, 2.0, 0.0, 3.0, 0.0, 1.0, 1.0, 1.0, 1.0,
0.0};
Double_t y[] = {2.0, 1.0, 0.0, 8.0};
TLinearFitter *lf = new TLinearFitter();
lf->StoreData(1);
// lf->SetFormula(???); // I don't know what to write here.
lf->AssignData(4, 3, a, y);
lf->EvalRobust();
TVector result(3);
lf->GetParameters(result);
cout << "results: " << result[0] << " " << result[0] << " " << result[0]
<< endl;
}
-- ZoliReceived on Sun Aug 08 2010 - 20:30:51 CEST
This archive was generated by hypermail 2.2.0 : Sun Aug 08 2010 - 23:50:01 CEST