⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curves.h

📁 CGAL is a collaborative effort of several sites in Europe and Israel. The goal is to make the most i
💻 H
📖 第 1 页 / 共 2 页
字号:
  //	and returns the new (true) y-degree;  //	It returns -2 if this is a no-op  int contract();  // Self-assignment  BiPoly<NT> & operator=( const BiPoly<NT>& P);  // Self-addition  BiPoly<NT> & BiPoly<NT>::operator+=( BiPoly<NT>& P);     // Self-subtraction  BiPoly<NT> & BiPoly<NT>::operator-=( BiPoly<NT>& P);  // Self-multiplication  BiPoly<NT> & BiPoly<NT>::operator*=( BiPoly<NT>& P);    // Multiply by a polynomial in X  BiPoly<NT> & mulXpoly( Polynomial<NT> & p);  //Multiply by a constant  BiPoly<NT> & mulScalar( NT & c);  // mulYpower: Multiply by Y^i (COULD be a divide if i<0)  BiPoly<NT> & mulYpower(int s);    // Divide by a polynomial in X.  // We replace the coeffX[i] by the pseudoQuotient(coeffX[i], P)  BiPoly<NT> & divXpoly( Polynomial<NT> & p);    //Using the standard definition of pseudRemainder operation.  //	--No optimization!  BiPoly<NT>  pseudoRemainderY (BiPoly<NT> & Q);  //Partial Differentiation  //Partial Differentiation wrt Y  BiPoly<NT> & differentiateY();  BiPoly<NT> & differentiateX();  BiPoly<NT> & differentiateXY(int m, int n);//m times wrt X and n times wrt Y  //Represents the bivariate polynomial in (R[X])[Y] as a member  //of (R[Y])[X].  //But since our polynomials in X can only have NT coeff's thus  // to represent the above polynomial we switch X and Y once  // the conversion has been done.  //NOTE: This is different from replacing X by Y which was  //      done in the case of the constructor from a polynomial in X  //Need to calculate resultant wrt X.  BiPoly<NT> & convertXpoly();  //Set Coeffecient to the polynomial passed as a parameter  bool setCoeff(int i, Polynomial<NT> p);  void reverse();  Polynomial<NT> replaceYwithX();  //Binary-power operator  BiPoly<NT>& pow(unsigned int n);  //Returns a Bipoly corresponding to s, which is supposed to  //contain as place-holders the chars 'x' and 'y'.  BiPoly<NT> getbipoly(string s);};//BiPoly Class  ////////////////////////////////////////////////////////  // Helper Functions  //////////////////////////////////////////////////////////Experimental version of constructor from strings containing general //parentheses// zeroPinY(P)//	checks whether a Bi-polynomial is a zero Polynomialtemplate <class NT>bool zeroPinY(BiPoly<NT> & P);// gcd(P,Q)//   This gcd is based upon the subresultant PRS to avoid//   exponential coeffecient growth and gcd computations, both of which //   are expensive since the coefficients are polynomialstemplate <class NT>BiPoly<NT> gcd( BiPoly<NT>& P ,BiPoly<NT>& Q);// resY(P,Q)://      Resultant of Bi-Polys P and Q w.r.t. Y.//      So the resultant is a polynomial in Xtemplate <class NT>Polynomial<NT>  resY( BiPoly<NT>& P ,BiPoly<NT>& Q);// resX(P,Q)://      Resultant of Bi-Polys P and Q w.r.t. X.//      So the resultant is a polynomial in Y//	We first convert P, Q to polynomials in X. Then // 	call resY and then turn it back into a polynomial in Y//	QUESTION: is this last switch really necessary???template <class NT>BiPoly<NT>  resX( BiPoly<NT>& P ,BiPoly<NT>& Q);//Equality operator for BiPolytemplate <class NT>bool operator==(const BiPoly<NT>& P, const BiPoly<NT>& Q);//Addition operator for BiPolytemplate <class NT> BiPoly<NT> operator+(const BiPoly<NT>& P, const BiPoly<NT>& Q);//Subtraction operator for BiPolytemplate <class NT> BiPoly<NT> operator-(const BiPoly<NT>& P, const BiPoly<NT>& Q);//Multiplication operator for BiPolytemplate <class NT> BiPoly<NT> operator*(const BiPoly<NT>& P, const BiPoly<NT>& Q);  ////////////////////////////////////////////////////////  //Curve Class  //  	extends BiPoly Class  ////////////////////////////////////////////////////////template < class NT >class Curve : public BiPoly<NT> {public:  // Colors for plotting curves  const static int NumColors=7;  static double red_comp(int i){  	static double RED_COMP[] = {0.9, 0.8, 0.7, 0.6, 0.8, 0.8, 0.7};	return RED_COMP[i % NumColors];  }  static double green_comp(int i){  	static double GREEN_COMP[] = {0.5, 0.9, 0.3, 0.9, 0.7, 0.55, 0.95};	return GREEN_COMP[i % NumColors];  }  static double blue_comp(int i){  	static double BLUE_COMP[] = {0.8, 0.3, 0.8, 0.5, 0.4, 0.85, 0.35};	return BLUE_COMP[i % NumColors];  }  Curve(); // zero polynomial    //Curve(vp):  //    construct from a vector of polynomials  Curve(std::vector<Polynomial<NT> > vp);  //	  : BiPoly<NT>(vp){  //}    //Curve(p):  //	Converts a polynomial p(X) to a BiPoly in one of two ways:  // 	    (1) if flag is false, the result is Y-p(X)   // 	    (2) if flag is true, the result is p(Y)   //    The default is (1) because we usually want to plot the  //        graph of the polynomial p(X)  Curve(Polynomial<NT> p, bool flag=false);  //	  : BiPoly<NT>(p, flag){  //}  //Curve(deg, d[], C[]):  //	Takes in a list of list of coefficients.  //	Each cofficient list represents a polynomial in X  //  //  deg - ydeg of the bipoly  //  d[] - array containing the degrees of each coefficient (i.e., X poly)  //  C[] - list of coefficients, we use array d to select the  //      coefficients  Curve(int deg, int *d, NT *C);  //	  : BiPoly<NT>(deg, d, C){  //}  Curve(const BiPoly<NT> &P);  //	  : BiPoly<NT>(P){  //}  //Curve(n) -- the nominal y-degree is n  Curve(int n);  //Creates a curve from a string (no parentheses, no *, no =)  Curve(const string & s, char myX='x', char myY='y');  Curve(const char* s, char myX='x', char myY='y');  /////////////////////////////////////////////////////////////////////////  // verticalIntersections(x, vecI, aprec=0):  //    The list vecI is passed an isolating intervals for y's such that (x,y)  //    lies on the curve.  //    If aprec is non-zero (!), the intervals have with < 2^{-aprec}.  //    Return is -2 if curve equation does not depend on Y  //    	-1 if infinitely roots at x,  //    	0 if no roots at x  //    	1 otherwise  int verticalIntersections(const BigFloat & x, BFVecInterval & vI,			    int aprec=0);    // TO DO:   // 		horizontalIntersections(...)    /////////////////////////////////////////////////////////////////////////  // plot(eps, x1, y1, x2, y2)  //  // 	All parameters have defaults  //  //    Gives the points on the curve at resolution "eps".  Currently,  //    eps is viewed as delta-x step size (but it could change).  //    The display is done in the rectangale   //    defined by [(x1, y1), (x2, y2)].  //    The output is written into a file in the format specified  //    by our drawcurve function (see COREPATH/ext/graphics).  //  //    Heuristic: the open polygonal lines end when number of roots  //    changes...  //  int  plot( BigFloat eps=0.1, BigFloat x1=-1.0,	     BigFloat y1=-1.0, BigFloat x2=1.0, BigFloat y2=1.0, int fileNo=1);// selfIntersections()://   this should be another member function that lists//   all the self-intersections of a curve////  template <class NT>//  void selfIntersections(BFVecInterval &vI){//  ...//  }};// Curve class  ////////////////////////////////////////////////////////  // Curve helper functions  //////////////////////////////////////////////////////////Xintersections(C, D, vI)://  returns the list vI of x-ccordinates of possible intersection points.//  Assumes that C & D are quasi-monic.(or generally aligned)template <class NT>void  Xintersections( Curve<NT>& P ,Curve<NT>& Q, BFVecInterval &vI);//Yintersections(C, D, vI)://	similar to Xintersectionstemplate <class NT>void  Yintersections( Curve<NT>& P ,Curve<NT>& Q, BFVecInterval &vI);// Display Intervalstemplate <class NT>void showIntervals(char* s, BFVecInterval &vI);// Set Display Parameters// ...////////////////////////////////////////////////////////// IMPLEMENTATIONS ARE FOUND IN Curves.tcc////////////////////////////////////////////////////////#include <CORE/poly/Curves.tcc>CORE_END_NAMESPACE#endif/*************************************************************************** */// END/*************************************************************************** */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -