Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-08-06 09:24:11

0001 // -*- C++ -*-
0002 
0003 /*
0004  * Poly_vec.h
0005  * Contains the declaration of the class Poly_vec related types and operators.
0006  * Created on: Aug 5, 2013
0007  * Author: Malin Sjodahl
0008  */
0009 
0010 #ifndef COLORFULL_Poly_vec_h
0011 #define COLORFULL_Poly_vec_h
0012 
0013 
0014 #include "Polynomial.h"
0015 
0016 
0017 namespace ColorFull {
0018 
0019 /// To contain a vector of Polynomials.
0020 typedef std::vector< Polynomial> poly_vec;
0021 
0022 
0023 /// Class for containing vector of Polynomials, and functions
0024 /// for Polynomial vectors.
0025 class Poly_vec {
0026 
0027 
0028 public:
0029 
0030     /// Default constructor, leaves pv empty.
0031     Poly_vec() {}
0032 
0033     /// Makes a Poly_vec of a poly_vec.
0034     Poly_vec( poly_vec poly_v ){pv=poly_v;}
0035 
0036     /// To actually contain the polynomial information.
0037     poly_vec pv;
0038 
0039     /// Returns the Polynomial at place i.
0040     const Polynomial& at( int i ) const { return pv.at(i); }
0041 
0042     /// Returns the Polynomial at place i.
0043     Polynomial& at( int i ) { return pv.at(i); }
0044 
0045     /// Return the number of Polynomials in the vector,
0046     /// i.e., the size of the member pv.
0047     uint size() const { return pv.size(); }
0048 
0049     /// Erases the information in vector.
0050     void clear() { pv.clear(); }
0051 
0052     /// Appends a Polynomial to data member pv.
0053     void append( Polynomial Poly ) { pv.push_back( Poly ); }
0054 
0055     /// Is the vector empty?
0056     bool empty() const { return pv.empty(); }
0057 
0058     /// Remove CF in the poly_vec member pv, i.e., replace CF by
0059     /// TR*Nc -TR/Nc.
0060     void remove_CF();
0061 
0062     /// Normal order all Polynomials in the poly_vec member pv
0063     /// (uses the Polynomial.normal_order function.)
0064     void normal_order();
0065 
0066     /// Simplifies all polynomials in the poly_vec member pv
0067     /// (uses the simplify member function in Polynomial).
0068     void simplify();
0069 
0070     /// Conjugates the Poly_vec.
0071     void conjugate();
0072 
0073     /// Reads in a Polynomial vector of form {Poly1, Poly2,...}
0074     /// to the member pv from the file filename.
0075     /// Comments starting with # are allowed
0076     /// at the top of the file.
0077     void read_in_Poly_vec( std::string filename );
0078 
0079     /// Writes out the vector to the file filename.
0080     void write_out_Poly_vec( std::string filename ) const;
0081 };
0082 
0083 /// Operator << for poly_vec.
0084 std::ostream& operator<<( std::ostream& out, const poly_vec & poly_v );
0085 
0086 /// Operator << for Poly_vec.
0087 std::ostream& operator<<( std::ostream& out, const Poly_vec & Pv );
0088 
0089 /// Define the operator == for Poly_vec,
0090 /// each Polynomial has to be identical.
0091 bool operator==( const Poly_vec & Pv1, const Poly_vec & Pv2 );
0092 
0093 /// Define the operator != for Poly_vec,
0094 /// each Polynomial has to be identical.
0095 bool operator!=( const Poly_vec & Pv1, const Poly_vec & Pv2 );
0096 
0097 }
0098 
0099 
0100 #endif /* COLORFULL_Poly_vec_h */