Changeset 958 in Sophya for trunk/SophyaLib/NTools/poly.h


Ignore:
Timestamp:
Apr 18, 2000, 3:38:53 PM (25 years ago)
Author:
ansari
Message:

doc + vire warning cmv 18/04/00

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/NTools/poly.h

    r938 r958  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: poly.h,v 1.7 2000-04-14 16:14:31 ansari Exp $
     3// $Id: poly.h,v 1.8 2000-04-18 13:38:36 ansari Exp $
    44//
    55
     
    2121
    2222//////////////////////////////////////////////////////////////////////////
     23//! Class of 1 dimension polynomials P(x)
    2324class Poly : public TVector<r_8> {
    2425  friend class ObjFileIO<Poly>;
     
    2728  Poly(Poly const& a);
    2829
     30  //! Return degre of polynomials
    2931  inline int Degre() const {UpdateDegIfDirty(); return deg;}
    3032
     33  //! Return space for a \b n degre polynomial
     34  /*!
     35    \param \b n : degre of new polynomial
     36    \param \b force : force re-allocation if true,\
     37                 if not allocation occurs only
     38                 if space needed is greater than the old one
     39  */
    3140  inline void Realloc(int n, bool force=false)
    3241                     {TVector<r_8>::Realloc(n+1,force);}
    3342
    3443  //  Pour compatibilite PEIDA  - Reza 03/2000
     44  //! Return coefficient of degre \b i
    3545  inline double Element(int i) const { return Elem(i,0,0,0,0); }
     46  //! Return coefficient of degre \b i
    3647  inline double & Element(int i)  { return Elem(i,0,0,0,0); }
    3748
     49  //! Return coefficient of degre \b i
    3850  inline double operator[](int i) const {return Elem(i,0,0,0,0);}
     51  //! Return coefficient of degre \b i
    3952  inline double& operator[](int i) {dirty = 1; return Elem(i,0,0,0,0);}
    4053  // Retourne le coefficient de degre i
     
    87100};
    88101
     102/*! \ingroup NTools \fn operator*(Poly const&,Poly const&)
     103  \brief perform and return P(X) = a(x) * b(x) */
    89104inline Poly operator* (Poly const& a, Poly const& b)
    90105  { return a.Mult(b); }
    91106
     107/*! \ingroup NTools \fn operator+(Poly const&,Poly const&)
     108  \brief perform and return P(X) = a(x) + b(x) */
    92109inline Poly operator+ (Poly const& a, Poly const& b)
    93110 { Poly c((a.Degre() > b.Degre())?(a.Degre()+1):(b.Degre()+1));
    94111   c = a; c += b; return c; }
    95112
     113/*! \ingroup NTools \fn operator-(Poly const&,Poly const&)
     114  \brief perform and return P(X) = a(x) - b(x) */
    96115inline Poly operator- (Poly const& a, Poly const& b)
    97116  { Poly c((a.Degre() > b.Degre())?(a.Degre()+1):(b.Degre()+1));
    98117    c = a; c -= b; return c; }
    99118
     119/*! \ingroup NTools \fn operator*(double,Poly const&)
     120  \brief perform and return P(X) = a * b(x) */
    100121inline Poly operator* (double a, Poly const& b)
    101122  { Poly c(b); c *= a; return c; }
    102123
     124/*! \ingroup NTools \fn operator<<(ostream&,const Poly&)
     125  \brief Print a(x) on stream \b s */
    103126inline ostream& operator << (ostream& s, const Poly& a)
    104127  { a.Print(s); return s; }
    105128
    106129//////////////////////////////////////////////////////////////////////////
     130/*! \ingroup NTools \fn operator<<(POutPersist&,Poly&)
     131  \brief For persistance management */
    107132inline POutPersist& operator << (POutPersist& os, Poly & obj)
    108133  { ObjFileIO<Poly> fio(&obj);  fio.Write(os);  return(os); }
     134/*! \ingroup NTools \fn operator<<(PInPersist&,,Poly&)
     135  \brief For persistance management */
    109136inline PInPersist& operator >> (PInPersist& is, Poly & obj)
    110137  { ObjFileIO<Poly> fio(&obj);  fio.Read(is);  return(is); }
     
    116143
    117144//////////////////////////////////////////////////////////////////////////
     145//! Class of 2 dimensions polynomials P(x,y)
    118146class Poly2 : public TVector<r_8> {
    119147  friend class ObjFileIO<Poly2>;
     
    124152  Poly2(Poly2 const& a);
    125153
     154  //! Return polynomial partial degre for X
    126155  inline int DegX() const {UpdateDegIfDirty(); return degX;}
     156  //! Return polynomial partial degre for Y
    127157  inline int DegY() const {UpdateDegIfDirty(); return degY;}
     158  //! Return polynomial maximum partial degre for X
    128159  inline int MaxDegX() const {return maxDegX;}
     160  //! Return polynomial maximum partial degre for Y
    129161  inline int MaxDegY() const {return maxDegY;}
     162  //! Return polynomial total degre for X
    130163  inline int Deg()  const {UpdateDegIfDirty(); return deg;}
    131164  // les degres partiels en x et y, et totaux.
    132165
    133166  //  Pour compatibilite PEIDA  - Reza 03/2000
     167  //! Return coefficient of degre \b i
    134168  inline double Element(int i) const { return Elem(i,0,0,0,0); }
     169  //! Return coefficient of degre \b i
    135170  inline double & Element(int i)  { return Elem(i,0,0,0,0); }
    136171
     
    138173  // retourne la valeur en (x,y)
    139174
     175  //! Return index of coefficient of X^dx * Y^dy in the vector
    140176  inline int IndCoef(int dx, int dy) const {
    141177    if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);
     
    146182  // d'un fit...
    147183
     184  //! Return coefficient of X^dx * Y^dy
    148185  inline double Coef(int dx, int dy) const {
    149186    return (dx>maxDegX || dy>maxDegY) ? 0 : Element(IndCoef(dx,dy));
    150187  }
     188  //! Return coefficient of X^dx * Y^dy
    151189  inline double& Coef(int dx, int dy) {
    152190    if (dx>maxDegX || dy>maxDegY) THROW(rangeCheckErr);
     
    199237};
    200238
     239/*! \ingroup NTools \fn operator*(Poly2 const&,Poly2 const&)
     240  \brief Perform P(x,y) = a(x,y) * b(x,y) */
    201241inline Poly2 operator* (Poly2 const& a, Poly2 const& b)
    202242  { return a.Mult(b); }
    203243
     244/*! \ingroup NTools \fn operator+(Poly2 const&,Poly2 const&)
     245  \brief Perform P(x,y) = a(x,y) + b(x,y) */
    204246inline Poly2 operator+ (Poly2 const& a, Poly2 const& b)
    205247  { Poly2 c(a); c += b; return c; }
    206248
     249/*! \ingroup NTools \fn operator-(Poly2 const&,Poly2 const&)
     250  \brief Perform P(x,y) = a(x,y) - b(x,y) */
    207251inline Poly2 operator- (Poly2 const& a, Poly2 const& b)
    208252  { Poly2 c(a); c -= b; return c; }
    209253
     254/*! \ingroup NTools \fn operator-(double,Poly2 const&)
     255  \brief Perform P(x,y) = a * b(x,y) */
    210256inline Poly2 operator * (double a, Poly2 const& b)
    211257  { Poly2 c(b); c *= a; return c; }
    212258
     259/*! \ingroup NTools \fn operator<<(ostream&,const Poly2&)
     260  \brief Print a(x,y) on stream \b s */
    213261inline ostream& operator << (ostream& s, const Poly2& a)
    214262  { a.Print(s); return s; }
    215263
    216264//////////////////////////////////////////////////////////////////////////
     265/*! \ingroup NTools \fn operator<<(POutPersist&,Poly2&)
     266  \brief For persistance management */
    217267inline POutPersist& operator << (POutPersist& os, Poly2 & obj)
    218268  { ObjFileIO<Poly2> fio(&obj);  fio.Write(os);  return(os); }
     269/*! \ingroup NTools \fn operator<<(POutPersist&,Poly2&)
     270  \brief For persistance management */
    219271inline PInPersist& operator >> (PInPersist& is, Poly2 & obj)
    220272  { ObjFileIO<Poly2> fio(&obj);  fio.Read(is);  return(is); }
Note: See TracChangeset for help on using the changeset viewer.