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_matr.h
0005  * Contains the declaration of the class Poly_matr and related types and operators.
0006  * Created on: Aug 5, 2013
0007  * Author: Malin Sjodahl
0008  */
0009 
0010 #ifndef COLORFULL_Poly_matr_h
0011 #define COLORFULL_Poly_matr_h
0012 
0013 
0014 
0015 #include "Poly_vec.h"
0016 
0017 
0018 namespace ColorFull {
0019 
0020 /// To contain a matrix of Polynomials, a vector of Poly_vec.
0021 typedef std::vector< Poly_vec > poly_matr;
0022 
0023 
0024 /// Class for containing a Polynomial matrix, and functions
0025 /// for Polynomial matrices.
0026 class Poly_matr {
0027 
0028 public:
0029 
0030     /// Default constructor, leaves pm empty.
0031     Poly_matr() {}
0032 
0033     /// To actually contain the matrix of Polynomials.
0034     poly_matr pm;
0035 
0036     /// Returns the Poly_vec at place i.
0037     const Poly_vec& at( int i ) const {return pm.at(i);}
0038 
0039     /// Returns the Poly_vec at place i.
0040     Poly_vec& at( int i ) {return pm.at(i);}
0041 
0042     /// Returns the matrix element at i, j.
0043     Polynomial& at( int i, int j ) { return pm.at(i).pv.at(j);}
0044 
0045     /// Returns the matrix element at i, j.
0046     const Polynomial& at( int i, int j ) const { return pm.at(i).pv.at(j);}
0047 
0048     /// Is the matrix, stored in pm, empty?
0049     bool empty( ) const {return pm.empty();}
0050 
0051     /// Returns the size of the matrix, the number of Poly_vec's
0052     /// in the member pm.
0053     uint size( ) const {return pm.size();}
0054 
0055     /// Erases the matrix information.
0056     void clear()  {pm.clear();}
0057 
0058     /// Appends a Poly_vec to data member pm.
0059     void append( Poly_vec Pv ) {pm.push_back( Pv );}
0060 
0061     /// Remove CF in the poly_matr member pm, i.e., replace CF by
0062     /// TR (Nc^2-1)/Nc.
0063     void remove_CF();
0064 
0065     /// Normal orders all polynomials in the poly_matr member pm,
0066     /// (uses Polynomial.normal_order.)
0067     void normal_order();
0068 
0069     /// Simplifies all polynomials in the poly_matr member pm,
0070     /// (uses Polynomial.simplify.)
0071     void simplify();
0072 
0073     /// Conjugates the matrix.
0074     void conjugate();
0075 
0076     /// Reads in the matrix from the file filename.
0077     /// The file should be of the format
0078     /// {{Poly11,...,Poly1n},
0079     /// ...,
0080     /// {Polyn1,...,Polynn}},
0081     /// and may contain comment lines starting with # at the top.
0082     void read_in_Poly_matr( std::string filename );
0083 
0084     /// Writes out the matrix to the file filename.
0085     void write_out_Poly_matr( std::string filename ) const;
0086 
0087 };
0088 
0089 /// Operator << for poly_matr.
0090 std::ostream& operator<<( std::ostream& out, const poly_matr & pm );
0091 
0092 /// Operator << for poly_vec.
0093 std::ostream& operator<<( std::ostream& out, const Poly_matr & Pm );
0094 
0095 /// Define the operator == for Poly_matr,
0096 /// each Poly_vec has to be identical.
0097 bool operator==( const Poly_matr & Pm1, const Poly_matr & Pm2 );
0098 
0099 /// Define the operator == for Poly_matr,
0100 /// each Poly_vec has to be identical.
0101 bool operator!=( const Poly_matr & Pm1, const Poly_matr & Pm2 );
0102 
0103 }
0104 
0105 
0106 #endif /* COLORFULL_Poly_matr_h */