source: git/Singular/npolygon.h @ 5ca9807

spielwiese
Last change on this file since 5ca9807 was 7885020, checked in by Hans Schönemann <hannes@…>, 25 years ago
* hannes: integrated "spectrum" by Stefan Endrass, inactive by default (Makefile.in claptmpl.cc feResource.cc iparith.cc mod2.h.in tok.h GMPrat.h GMPrat.cc kmatrix.h multicnt.h multicnt.cc npolygon.h npolygon.cc semic.h semic.cc spectrum.h spectrum.cc splist.h splist.cc) git-svn-id: file:///usr/local/Singular/svn/trunk@3423 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 4.8 KB
Line 
1// ----------------------------------------------------------------------------
2//  npolygon.h
3//  begin of file
4//  Stephan Endrass, endrass@mathematik.uni-mainz.de
5//  23.7.99
6// ----------------------------------------------------------------------------
7
8#ifndef NPOLYGON_H
9#define NPOLYGON_H
10
11// ----------------------------------------------------------------------------
12//  Class representing a linear form QQ^N-->QQ
13// ----------------------------------------------------------------------------
14
15class linearForm
16{
17
18private:
19
20    Rational    *c;                   // the coefficients
21    int         N;                    // number of coefficients
22
23public:
24
25    linearForm( );
26    linearForm( const linearForm& );
27    ~linearForm( );
28
29    linearForm & operator = ( const linearForm& );
30
31    friend  int     operator == ( const linearForm&,const linearForm& );
32
33    void        copy_new     ( int );
34    void        copy_delete  ( void );
35    void        copy_zero    ( void );
36    void        copy_shallow ( linearForm& );
37    void        copy_deep    ( const linearForm& );
38
39    Rational    weight       ( poly ) const;
40    Rational    weight_shift ( poly ) const;
41    Rational    weight1      ( poly ) const;
42    Rational    weight_shift1( poly ) const;
43
44    Rational    pweight      ( poly ) const;
45
46    int         positive     ( void );
47
48    #ifdef  NPOLYGON_PRINT
49        friend ostream & operator << ( ostream&,const linearForm& );
50    #endif
51
52    friend class newtonPolygon;
53};
54
55// ----------------------------------------------------------------------------
56//  Class representing a Newton polygon
57// ----------------------------------------------------------------------------
58
59class newtonPolygon
60{
61
62private:
63
64    linearForm  *l;                   // the linear forms
65    int         N;                    // number of linear forms
66
67public:
68
69    newtonPolygon( );
70    newtonPolygon( const newtonPolygon& );
71    newtonPolygon( poly );
72    ~newtonPolygon( );
73
74    newtonPolygon & operator = ( const newtonPolygon& );
75
76
77    void        copy_new    ( int );
78    void        copy_delete ( void );
79    void        copy_zero   ( void );
80    void        copy_shallow( newtonPolygon& );
81    void        copy_deep   ( const newtonPolygon& );
82
83    void        add_linearForm( const linearForm& );
84
85    Rational    weight       ( poly ) const;
86    Rational    weight_shift ( poly ) const;
87    Rational    weight1      ( poly ) const;
88    Rational    weight_shift1( poly ) const;
89
90    //int         is_sqh     ( void ) const;
91    //Rational*   sqh_weights( void ) const;
92    //int         sqh_N      ( void ) const;
93
94    #ifdef  NPOLYGON_PRINT
95        friend ostream & operator << ( ostream&,const newtonPolygon&  );
96    #endif
97};
98
99// ---------------------------------------
100//  inline functions for class linearForm
101// ---------------------------------------
102
103// ----------------------------------------------------------------------------
104//  Initialize with zero
105// ----------------------------------------------------------------------------
106
107inline  void    linearForm::copy_zero( void )
108{
109    c = (Rational*)NULL;
110    N = 0;
111}
112
113// ----------------------------------------------------------------------------
114//  Initialize shallow from another linear form
115// ----------------------------------------------------------------------------
116
117inline  void    linearForm::copy_shallow( linearForm &l )
118{
119    c = l.c;
120    N = l.N;
121}
122
123
124// ----------------------------------------------------------------------------
125//  Zero constructor
126// ----------------------------------------------------------------------------
127
128inline  linearForm::linearForm( )
129{
130    copy_zero( );
131}
132
133
134// ------------------------------------------
135//  inline functions for class newtonPolygon
136// ------------------------------------------
137
138// ----------------------------------------------------------------------------
139//  Initialize with zero
140// ----------------------------------------------------------------------------
141
142inline  void    newtonPolygon::copy_zero( void )
143{
144    l = (linearForm*)NULL;
145    N = 0;
146}
147
148// ----------------------------------------------------------------------------
149//  Initialize shallow from another Newton polygon
150// ----------------------------------------------------------------------------
151
152inline  void    newtonPolygon::copy_shallow( newtonPolygon &np )
153{
154    l = np.l;
155    N = np.N;
156}
157
158
159// ----------------------------------------------------------------------------
160//  Zero constructor
161// ----------------------------------------------------------------------------
162
163inline newtonPolygon::newtonPolygon( )
164{
165    copy_zero( );
166}
167
168#endif /* NPOLYGON_H */
169
170// ----------------------------------------------------------------------------
171//  npolygon.h
172//  end of file
173// ----------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.