Dear Tomasz,
You wrote:
>
> Have a look at TVectorD if you meant multiplication of numbers.
I've done it already. Unfortunately I can't find an appropriate function or an operator.
Double_t operator* (const TVectorD &source1,const TVectorD &source2);
and other operators are suitable for linear algebra operations but not in my case. There are some methods similar to std::valarray operators
void TVectorD::AddSomeConstant(Double_t val, const TVectorD& select);
TVectorD& TVectorD::Sqr(); TVectorD& TVectorD::Sqrt(); TVectorD& TVectorD::Invert(); // can be used instead of operator/()
However I don't see per element multiplication. Could you point me to the method producing the vector c as shown below
TVectorD a,b;
TVectorD c(a.GetNrows());
for (UInt_t i = 0; i < c.GetNrows(); ++i) {
c[i] = a[i]*b[i];
}
I'm really sorry if I missed it in the reference.
-- Yours faithfully, Maxim NikulinReceived on Thu Oct 27 2005 - 14:49:51 MEST
> Maxim Nikulin wrote:
>
>> Hi,
>>
>> Is there a native ROOT class similar to STL std::valarray template?
>> I'm interested in e.g. element to element multiplication operator
>> (c = a*b means c[i] = a[i]*b[i]). Actually I prefer STL classes but in
>> general ROOT behaves better with native classes.
>>
>> I found no valarray CINT library, although the headers are present.
>> I've managed to build a dictionary with subset of valarray functions
>> and operators but it's better to have the library "out of box". I
>> can't say that writing correct LinkDef.h file was trivial problem and
>> it's seems that generating dictionary for operators is missed in the
>> ROOT Users Guide.
>>
>> I'm using ROOT-5.05/01, 2005-10-12 CVS HEAD, Fedora Core 2 Linux on
>> Pentium IV PC. Of course I made cintdlls during ROOT installation.
>>
This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:13 MET