algebramix_doc 0.3
fast_series_test.cpp
/******************************************************************************
* MODULE     : fast_series_test.cpp
* DESCRIPTION: Test fast power series
* COPYRIGHT  : (C) 2004  Joris van der Hoeven
*******************************************************************************
* This software falls under the GNU general public license and comes WITHOUT
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
* If you don't have this file, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
******************************************************************************/

#include <numerix/modular_int.hpp>
#include <numerix/rational.hpp>
#include <algebramix/series.hpp>
#include <algebramix/series_elementary.hpp>
#include <algebramix/series_fast.hpp>

/******************************************************************************
* Test series
******************************************************************************/

namespace mmx {

template<typename C, typename V>
class test_series_rep: public series_rep<C,V> {
public:
  inline test_series_rep (): series_rep<C,V> (format<C> ()) {}
  syntactic expression (const syntactic& z) const { return apply ("test", z); }
  C next () { return this->one (); }
};

template<typename C, typename V> series<C,V>
test_series () {
  return (series_rep<C,V>*) new test_series_rep<C,V> ();
}

} // end namespace mmx

/******************************************************************************
* Main tests
******************************************************************************/

using namespace mmx;

//#define C rational
//#define C complex<double>
//#define C modular<modulus<nat, modulus_int_preinverse<32> >, FFTP>
#define C modular<modulus<nat>, FFTP>
#define V series_fast
#define Series series<C,V>

int
main () {
  Series z (1, 1);
  Series t= test_series<C,V> ();
  Series f= 1 / (1 - z);
  Series g= exp (z);
  Series h= exp (lshiftz (t, 1));
  Series::set_output_order (25);

  mmout << "z\t= " << z << "\n\n";
  mmout << "t\t= " << t << "\n\n";
  mmout << "t*t\t= " << t*t << "\n\n";
  mmout << "f\t= " << f << "\n\n";
  mmout << "g\t= " << g << "\n\n";
  mmout << "h\t= " << h << "\n\n";
  return 0;
}
 All Classes Namespaces Files Functions Variables Typedefs Friends Defines