当前位置: 首页>>代码示例>>C++>>正文


C++ PolyRing::myOutputSelfLong方法代码示例

本文整理汇总了C++中PolyRing::myOutputSelfLong方法的典型用法代码示例。如果您正苦于以下问题:C++ PolyRing::myOutputSelfLong方法的具体用法?C++ PolyRing::myOutputSelfLong怎么用?C++ PolyRing::myOutputSelfLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PolyRing的用法示例。


在下文中一共展示了PolyRing::myOutputSelfLong方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: program

void program()
{
  // This test is for testing printing functions
  GlobalManager CoCoAFoundations;


  PolyRing R = NewPolyRing(RingQQ(), symbols("a","b")); // QQ[a,b]
  ring K = NewFractionField(R); // QQ(a,b)
  PolyRing Kxy = NewPolyRing(K, symbols("x", "y"));
  RingHom f = CanonicalHom(R,K);
  RingHom g = CanonicalHom(K,Kxy);
  RingHom h = g(f);
  RingElem a = RingElem(R, symbol("a"));
  RingElem b = RingElem(R, symbol("b"));
  RingElem Inv_a = 1/f(a);
  RingElem x = RingElem(Kxy, symbol("x"));
  RingElem Inv_a_x = g(Inv_a)*x;
  
  //  std::cout << 2*a/3-1 << std::endl;
  //  std::cout << 2*h(a)*x-1 << std::endl;
  
  { ostringstream s;  s << a/2;          TEST_ASSERT(s.str() == "(1/2)*a"); }
  { ostringstream s;  s << -a/3;         TEST_ASSERT(s.str() == "(-1/3)*a"); }
  { ostringstream s;  s << -x/3;         TEST_ASSERT(s.str() == "(-1/3)*x"); }
  { ostringstream s;  s << h(-a)*x*x + h(1-a)*x + h(1-a);
    TEST_ASSERT(s.str() == "-a*x^2 +(-a +1)*x -a +1"); }
  { ostringstream s;  s << x - h(a*b);   TEST_ASSERT(s.str() == "x -a*b"); }
  { ostringstream s;  s << -x;           TEST_ASSERT(s.str() == "-x"); }
  { ostringstream s;  s << -x+1;         TEST_ASSERT(s.str() == "-x +1"); }
  { ostringstream s;  s << x-1;          TEST_ASSERT(s.str() == "x -1"); }
  { ostringstream s;  s << x- h(a);      TEST_ASSERT(s.str() == "x -a"); }
  { ostringstream s;  s << 1/f(a);       TEST_ASSERT(s.str() == "1/a"); }
  { ostringstream s;  s << 1/h(a);       TEST_ASSERT(s.str() == "1/a"); }
  { ostringstream s;  s << g(1/f(a))*x;  TEST_ASSERT(s.str() == "(1/a)*x"); }
  { ostringstream s;  s << h(a)*x;       TEST_ASSERT(s.str() == "a*x"); }
  { ostringstream s;  s << x/(-1);       TEST_ASSERT(s.str() == "-x"); }
  { ostringstream s;  s << x-one(Kxy)/2; TEST_ASSERT(s.str() == "x -1/2"); }
  { ostringstream s;  s << x-h(a/2);     TEST_ASSERT(s.str() == "x -a/2"); }
  { ostringstream s;  s << x-h(a)/2;     TEST_ASSERT(s.str() == "x -a/2"); }
  { ostringstream s;  s << x-h(a+1)/2;   TEST_ASSERT(s.str() == "x +(-a -1)/2"); }
  { R->myOutputSelfLong(std::cout); }
  { std::cout << std::endl; }
  { NewPolyRing(R, SymbolRange("x",1,3))->myOutputSelfLong(std::cout); }
  { std::cout << std::endl; }
  { NewPolyRing(NewFractionField(R), SymbolRange("x",1,3))->myOutputSelfLong(std::cout); }
  { std::cout << std::endl; }
  { NewPolyRing(NewQuotientRing(R,ideal(ReadExpr(R,"a^2-2"))), SymbolRange("x",1,3))->myOutputSelfLong(std::cout); }
  { std::cout << std::endl; }
  
  //  std::cout << x-h(a)/2 << std::endl;

}
开发者ID:BrentBaccala,项目名称:CoCoA,代码行数:52,代码来源:test-output.C


注:本文中的PolyRing::myOutputSelfLong方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。