My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
Singular
dyn_modules
python
Ideal.h
Go to the documentation of this file.
1
#ifndef IDEAL_CPP_HEADER
2
#define IDEAL_CPP_HEADER
3
#include <vector>
4
#include "
Poly.h
"
5
#include "
kernel/ideals.h
"
6
//base for ideals as well for modules
7
//doesn't need a destructor, as Polys will destroy itself
8
template
<
class
poly_type>
class
IdealBase
9
{
10
protected
:
11
std::vector<poly_type>
storage
;
12
public
:
13
typedef
poly_type
value_type
;
14
typedef
typename
std::vector<poly_type>::size_type
size_type
;
15
typedef
typename
std::vector<poly_type>::iterator
iterator
;
16
typedef
typename
std::vector<poly_type>::difference_type
difference_type
;
17
typedef
typename
std::vector<poly_type>::allocator_type
allocator_type
;
18
IdealBase
(){}
19
20
IdealBase
(
iterator
first,
21
iterator
last
,
22
const
typename
23
std::vector<poly_type>::allocator_type& __a =
allocator_type
()):
24
storage
(first,
last
,__a)
25
{}
26
ring
getRing
()
const
27
{
28
//FIXME: is a hack
29
if
(
size
()>0)
30
{
31
return
storage
[0].getRing();
32
}
33
else
34
return
(ring)
NULL
;
35
}
36
poly_type&
operator[]
(
int
n)
37
{
38
return
storage
[n];
39
}
40
const
poly_type&
operator[]
(
int
n)
const
41
{
42
return
storage
[n];
43
}
44
void
push_back
(
const
poly_type&
p
)
45
{
46
storage
.push_back(
p
);
47
}
48
void
push_front
(
const
poly_type&
p
)
49
{
50
storage
.push_front(
p
);
51
}
52
53
iterator
begin
()
54
{
55
return
storage
.begin();
56
}
57
iterator
end
()
58
{
59
return
storage
.end();
60
}
61
size_type
size
()
const
62
{
63
return
storage
.size();
64
}
65
iterator
66
insert
(
iterator
__position,
const
value_type
& __x)
67
{
68
return
storage
.insert(__position,__x);
69
}
70
iterator
71
erase
(
iterator
__position)
72
{
73
return
storage
.erase(__position);
74
}
75
iterator
76
erase
(
iterator
__first,
iterator
__last)
77
{
78
return
storage
.erase(__first,__last);
79
}
80
void
insert
(
iterator
__pos,
iterator
__first,
iterator
__last)
81
{
82
return
insert
(__pos,__first,__last);
83
}
84
};
85
86
class
Ideal
:
87
public
IdealBase
<Poly>
88
{
89
public
:
90
Ideal
(){}
91
Ideal
(ideal
i
, ring r)
92
{
93
for
(
int
j
=0;
j
<
IDELEMS
(
i
);
j
++)
94
{
95
storage
.push_back(
Poly
(
i
->m[
j
],r));
96
}
97
}
98
Ideal
(
iterator
first,
99
iterator
last
,
100
const
allocator_type
& __a =
allocator_type
()):
101
IdealBase
<
Poly
>(first,
last
,__a){}
102
ideal
as_ideal
()
const
103
{
104
//no checks for rings
105
int
s
=
size
();
106
107
if
(
s
==0)
s
=1;
108
109
ideal
result
=
idInit
(
s
,1);
110
result
->m[0]=
NULL
;
111
s
=
size
();
112
for
(
int
i
=0;
i
<
s
;
i
++)
113
{
114
result
->m[
i
]=
storage
[
i
].as_poly();
115
}
116
return
result
;
117
}
118
};
119
class
Module
:
120
public
IdealBase
<Vector>
121
{
122
public
:
123
Module
(ideal
i
, ring r)
124
{
125
for
(
int
j
=0;
j
<
IDELEMS
(
i
);
j
++)
126
{
127
storage
.push_back(
Vector
(
i
->m[
j
],r));
128
}
129
}
130
ideal
as_module
()
const
131
{
132
//no checks for rings
133
int
s
=
size
();
134
135
if
(
s
==0)
136
s
=1;
137
138
ideal
result
=
idInit
(
s
,1);
139
result
->m[0]=
NULL
;
140
s
=
size
();
141
for
(
int
i
=0;
i
<
s
;
i
++)
142
{
143
result
->m[
i
]=
storage
[
i
].as_poly();
144
}
145
if
(
size
()==0)
146
result
->rank=0;
147
else
148
result
->rank=
id_RankFreeModule
(
result
,
storage
[0].
getRing
());
149
return
result
;
150
}
151
Module
(
iterator
first,
152
iterator
last
,
153
const
allocator_type
& __a =
allocator_type
()):
154
IdealBase
<
Vector
>(first,
last
,__a)
155
{}
156
Module
()
157
{}
158
};
159
#endif
Poly.h
i
int i
Definition
cfEzgcd.cc:132
p
int p
Definition
cfModGcd.cc:4086
IdealBase::IdealBase
IdealBase(iterator first, iterator last, const typename std::vector< poly_type >::allocator_type &__a=allocator_type())
Definition
Ideal.h:20
IdealBase::erase
iterator erase(iterator __position)
Definition
Ideal.h:71
IdealBase::difference_type
std::vector< poly_type >::difference_type difference_type
Definition
Ideal.h:16
IdealBase::insert
iterator insert(iterator __position, const value_type &__x)
Definition
Ideal.h:66
IdealBase::size
size_type size() const
Definition
Ideal.h:61
IdealBase::allocator_type
std::vector< poly_type >::allocator_type allocator_type
Definition
Ideal.h:17
IdealBase::end
iterator end()
Definition
Ideal.h:57
IdealBase::insert
void insert(iterator __pos, iterator __first, iterator __last)
Definition
Ideal.h:80
IdealBase::value_type
poly_type value_type
Definition
Ideal.h:13
IdealBase::size_type
std::vector< poly_type >::size_type size_type
Definition
Ideal.h:14
IdealBase::storage
std::vector< poly_type > storage
Definition
Ideal.h:11
IdealBase::push_front
void push_front(const poly_type &p)
Definition
Ideal.h:48
IdealBase::IdealBase
IdealBase()
Definition
Ideal.h:18
IdealBase::begin
iterator begin()
Definition
Ideal.h:53
IdealBase::iterator
std::vector< poly_type >::iterator iterator
Definition
Ideal.h:15
IdealBase::getRing
ring getRing() const
Definition
Ideal.h:26
IdealBase::operator[]
const poly_type & operator[](int n) const
Definition
Ideal.h:40
IdealBase::erase
iterator erase(iterator __first, iterator __last)
Definition
Ideal.h:76
IdealBase::operator[]
poly_type & operator[](int n)
Definition
Ideal.h:36
IdealBase::push_back
void push_back(const poly_type &p)
Definition
Ideal.h:44
Ideal::Ideal
Ideal(ideal i, ring r)
Definition
Ideal.h:91
Ideal::Ideal
Ideal()
Definition
Ideal.h:90
Ideal::as_ideal
ideal as_ideal() const
Definition
Ideal.h:102
Ideal::Ideal
Ideal(iterator first, iterator last, const allocator_type &__a=allocator_type())
Definition
Ideal.h:98
Module::Module
Module()
Definition
Ideal.h:156
Module::Module
Module(ideal i, ring r)
Definition
Ideal.h:123
Module::as_module
ideal as_module() const
Definition
Ideal.h:130
Module::Module
Module(iterator first, iterator last, const allocator_type &__a=allocator_type())
Definition
Ideal.h:151
Vector
Definition
Poly.h:509
result
return result
Definition
facAbsBiFact.cc:76
s
const CanonicalForm int s
Definition
facAbsFact.cc:51
j
int j
Definition
facHensel.cc:110
last
STATIC_VAR poly last
Definition
hdegree.cc:1138
ideals.h
NULL
#define NULL
Definition
omList.c:12
idInit
ideal idInit(int idsize, int rank)
initialise an ideal / module
Definition
simpleideals.cc:35
id_RankFreeModule
long id_RankFreeModule(ideal s, ring lmRing, ring tailRing)
return the maximal component number found in any polynomial in s
Definition
simpleideals.cc:1073
IDELEMS
#define IDELEMS(i)
Definition
simpleideals.h:23
Poly
Definition
janet.h:15
Generated on
for My Project by
doxygen 1.17.0
for
Singular