📄 gpolylst.imp
字号:
else index++; if (List.Length() <= 1) return; int ii; for (ii = 1; ii <= List.Length(); ii++) List[ii]->ToMonic(order); gList<index_pair> uncomputed; gList<index_pair> computed; for (ii = 2; ii <= List.Length(); ii++) { for (int j = 1; j < ii; j++) uncomputed += index_pair(j,ii); CriterionTwo(uncomputed, computed, ii, order); } while (uncomputed.Length() > 0) { int mindex = 1; for (ii = 2; ii <= uncomputed.Length(); ii++) if (order.Less(List[uncomputed[ii][1]]->LeadingPowerProduct(order). LCM(List[uncomputed[ii][2]]->LeadingPowerProduct(order)), List[uncomputed[mindex][1]]->LeadingPowerProduct(order). LCM(List[uncomputed[mindex][2]]->LeadingPowerProduct(order)))) mindex = ii; computed += uncomputed[mindex]; int ii = uncomputed[mindex][1]; int j = uncomputed[mindex][2]; uncomputed.Remove(mindex); if ( !List[ii]->LeadingPowerProduct(order). UsesDifferentVariablesThan(List[j]->LeadingPowerProduct(order)) ) { gPoly<T> h = ReductionOf(List[ii]->S_Polynomial(order,*(List[j])),order); if (!h.IsZero()) { h.ToMonic(order); gPoly<T>* hptr = new gPoly<T>(h); List += hptr; for (int k = 1; k < List.Length(); k++) uncomputed += index_pair(k,List.Length()); CriterionTwo(uncomputed, computed, List.Length(), order); } } }}template<class T> void gPolyList<T>::GrobnerToMinimalGrobner(const term_order & order){ if (Length() <= 1) return; int i = 1; int j = 2; while (j <= Length()) { if ( List[i]->LeadingPowerProduct(order) <= List[j]->LeadingPowerProduct(order) ) { delete List[j]; List.Remove(j); } else if ( List[i]->LeadingPowerProduct(order) >= List[j]->LeadingPowerProduct(order) ) { delete List[i]; List.Remove(i); if (i < j-1) j--; else i = 1; } else { if (i < j-1) i++; else { i = 1; j++; } } }}template<class T> void gPolyList<T>::MinimalGrobnerToReducedGrobner(const term_order & order){ if (Length() <= 1) return; int i = 1; while (i <= List.Length()) { gPolyList<T> AllBut_ith(*this); delete AllBut_ith.List[i]; AllBut_ith.List.Remove(i); gPoly<T> h = AllBut_ith.ReductionOf(*List[i],order); delete List[i]; List[i] = new gPoly<T>(h); i++; }}template<class T> gPolyList<T>& gPolyList<T>::ToSortedReducedGrobner(const term_order & order){ Grobnerize(order); GrobnerToMinimalGrobner(order); MinimalGrobnerToReducedGrobner(order); Sort(order); return *this;}//------------------------------------------// New Coordinate Systems//------------------------------------------template<class T> gPolyList<T> gPolyList<T>::TranslateOfSystem(const gVector<T>& new_origin) const{ gList<gPoly<T> > new_polys; for (int i = 1; i <= Length(); i++) { new_polys += (*this)[i].TranslateOfPoly(new_origin); // assert (TranslateOfPoly((*this)[i],new_origin) == // (*this)[i].TranslateOfPoly(new_origin)); } return gPolyList<T>(AmbientSpace(),TermOrder(),new_polys);}template<class T> gPolyList<T> gPolyList<T>::SystemInNewCoordinates(const gSquareMatrix<T>& M) const{ gList<gPoly<T> > new_polys; for (int i = 1; i <= Length(); i++) { // assert ( (*this)[i].PolyInNewCoordinates(M) == // gPoly<T>( PolyInNewCoordinates((*this)[i],M) ) ); new_polys += (*this)[i].PolyInNewCoordinates(M); } return gPolyList<T>(AmbientSpace(),TermOrder(),new_polys);}//-----------------------------------// Truncations//-----------------------------------template<class T> gPolyList<T> gPolyList<T>::InteriorSegment(int first, int last) const{ return gPolyList<T>(AmbientSpace(), TermOrder(), List.InteriorSegment(first,last));}//----------------------------------// Information//----------------------------------template <class T> gList<gPoly<T> > gPolyList<T>::UnderlyingList(void) const{ gList<gPoly<T> > NewList; int ii; for (ii = 1; ii <= List.Length(); ii++) NewList += *List[ii]; return NewList;}template <class T> const bool gPolyList<T>::IsMultiaffine() const{ for (int i = 1; i <= List.Length(); i++) if (!(*List[i]).IsMultiaffine()) return false; return true;} template<class T> const gVector<T> gPolyList<T>::Evaluate(const gVector<T>& v) const{ gVector<T> answer(Length()); int ii; for (ii = 1; ii <= List.Length(); ii++) answer[ii] = List[ii]->Evaluate(v); return answer;} template<class T> const bool gPolyList<T>::IsRoot(const gVector<T>& v) const{ for (int ii = 1; ii <= List.Length(); ii++) if (List[ii]->Evaluate(v) != (T)0) return false; return true;} template<class T> const gRectArray<gPoly<T>*> gPolyList<T>::DerivativeMatrix() const{ gPoly<T> zero(Space, Order); gRectArray<gPoly<T>*> answer(Length(),Dmnsn()); int ii; for (ii = 1; ii <= Length(); ii++) for (int j = 1; j <= Dmnsn(); j++) answer(ii,j) = new gPoly<T>(UnderlyingList()[ii].PartialDerivative(j)); return answer;} template<class T> const gPoly<T> gPolyList<T>::DetOfDerivativeMatrix() const{ assert(List.Length() == Space->Dmnsn()); int n = List.Length(); gRectArray<gPoly<T>*> deriv_matrix = DerivativeMatrix(); gPoly<T> answer(Space, Order); gPermutationOdometer odo(n); while (odo.Turn()) { gPoly<T> increment(Space, (T)1, Order); for (int i = 1; i <= n; i++) increment *= *(deriv_matrix(i, odo[i])); increment *= (T)odo.CurrentSign(); answer += increment; } return answer;} template<class T> const gMatrix<T> gPolyList<T>::DerivativeMatrix(const gVector<T>& p) const{ gMatrix<T> answer(Length(),Dmnsn()); gList<gPoly<T> > list = UnderlyingList(); int ii; for (ii = 1; ii <= Length(); ii++) for (int j = 1; j <= Dmnsn(); j++) answer(ii,j) = list[ii].PartialDerivative(j).Evaluate(p); return answer;} template<class T> const gSquareMatrix<T> gPolyList<T>::SquareDerivativeMatrix(const gVector<T>& p) const{ assert (Length() == Dmnsn()); gSquareMatrix<T> answer(Length()); gList<gPoly<T> > list = UnderlyingList(); int ii; for (ii = 1; ii <= Length(); ii++) for (int j = 1; j <= Dmnsn(); j++) answer(ii,j) = list[ii].PartialDerivative(j).Evaluate(p); return answer;}//----------------------------------// Conversion//----------------------------------template<class T> gList<gPoly<gDouble> > gPolyList<T>::ListTogDouble() const{ gList<gPoly<gDouble> > newlist; int ii; for (ii = 1; ii <= List.Length(); ii++) { newlist += gPoly<gDouble>(TogDouble(*List[ii])); } return newlist;}template<class T> gList<gPoly<gDouble> > gPolyList<T>::NormalizedList() const{ gList<gPoly<gDouble> > newlist; int ii; for (ii = 1; ii <= List.Length(); ii++) { newlist += gPoly<gDouble>(NormalizationOfPoly(*List[ii])); } return newlist;}template <class T> const gSpace* gPolyList<T>::AmbientSpace() const { return Space; }template <class T> const term_order* gPolyList<T>::TermOrder() const { return Order; }template <class T> const int gPolyList<T>::Length() const { return List.Length(); }template <class T> const int gPolyList<T>::Dmnsn() const { return Space->Dmnsn(); }//----------------------------------// Printing//----------------------------------template <class T> gOutput& operator << (gOutput& output, const gPolyList<T>& x){ for(int t = 1; t <= x.Length(); t++) output << t << ": " << x[t] <<"\n"; return output;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -