Changeset 2588 in Sophya


Ignore:
Timestamp:
Jul 30, 2004, 4:30:47 PM (21 years ago)
Author:
ansari
Message:

1/ Ajout methodes Mul/Div(const TArray<T>& a) pour mult/div elt/elt in place

(a remplacer eventuellement par l'operateur *= /= )

2/ Ajout fonctions inline MultiplyElt(const TArray<T>& a,const TArray<T>& b)
et DivideElt(const TArray<T>& a,const TArray<T>& b)

Reza, 30 Juillet 2004

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/TArray/tarray.h

    r2575 r2588  
    174174  inline  TArray<T>&  operator -= (const TArray<T>& a)  { return SubElt(a, *this); }
    175175
     176  // Doit-on definir les operateur *= /= TArray ?  Reza, Juillet 2004
     177  //! Element by element multiplication in place TArray *= TArray (element by element)
     178  inline  TArray<T>&  Mul(const TArray<T>& a)           { return MulElt(a, *this); }
     179  //! Element by element division in place TArray *= TArray (element by element)
     180  inline  TArray<T>&  Div(const TArray<T>& a)           { return DivlElt(a, *this); }
     181
    176182// Recopie des valeurs, element par element
    177183  virtual TArray<T>&  CopyElt(const TArray<T>& a);
     
    292298
    293299/*! \ingroup TArray \fn operator+(const TArray<T>&,const TArray<T>&)
    294   \brief Operator TArray = TArray + TArray */
     300  \brief Operator TArray = TArray + TArray (element by element addition) */
    295301template <class T>
    296302inline TArray<T> operator + (const TArray<T>& a,const TArray<T>& b)
     
    299305
    300306/*! \ingroup TArray \fn operator-(const TArray<T>&,const TArray<T>&)
    301   \brief Operator TArray = TArray - TArray */
     307  \brief Operator TArray = TArray - TArray (element by element subtraction) */
    302308template <class T>
    303309inline TArray<T> operator - (const TArray<T>& a,const TArray<T>& b)
     
    305311    a.SubElt(b, result);    return result; }
    306312
     313/*! \ingroup TArray \fn MultiplyElt((const TArray<T>&,const TArray<T>&)
     314  \brief Element by element multiplication of two arrays TArray = TArray * TArray */
     315
     316template <class T>
     317inline TArray<T> MultiplyElt(const TArray<T>& a,const TArray<T>& b)
     318    { TArray<T> result; result.SetTemp(true);
     319    a.MulElt(b, result);    return result; }
     320
     321/*! \ingroup TArray \fn DivideElt((const TArray<T>&,const TArray<T>&)
     322  \brief Element by element division of two arrays TArray = TArray * TArray */
     323template <class T>
     324inline TArray<T> DivideElt(const TArray<T>& a,const TArray<T>& b)
     325    { TArray<T> result; result.SetTemp(true);
     326    a.DivElt(b, result);    return result; }
    307327
    308328// --------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.