My Project
Toggle main menu visibility
Loading...
Searching...
No Matches
libpolys
misc
intvec.h
Go to the documentation of this file.
1
#ifndef INTVEC_H
2
#define INTVEC_H
3
/****************************************
4
* Computer Algebra System SINGULAR *
5
****************************************/
6
/*
7
* ABSTRACT: class intvec: lists/vectors of integers
8
*/
9
#include <string.h>
10
#include "
misc/auxiliary.h
"
11
#include "
omalloc/omalloc.h
"
12
#ifdef HAVE_OMALLOC
13
#include "
omalloc/omallocClass.h
"
14
#endif
15
#include "
coeffs/bigintmat.h
"
16
17
#include "
reporter/reporter.h
"
18
19
20
class
intvec
21
#ifdef HAVE_OMALLOC
22
:
public
omallocClass
23
#endif
24
{
25
private
:
26
int
*
v
;
27
int
row
;
28
int
col
;
29
public
:
30
31
inline
intvec
(
int
l
= 1)
32
{
33
assume
(
l
>= 0);
34
if
(
l
>0)
v
= (
int
*)
omAlloc0
(
sizeof
(
int
)*
l
);
35
else
v
=
NULL
;
36
row
=
l
;
37
col
= 1;
38
}
39
intvec
(
int
s
,
int
e);
40
intvec
(
int
r,
int
c,
int
init);
41
intvec
(
const
intvec
* iv)
42
{
43
assume
( iv !=
NULL
);
44
row
= iv->
rows
();
45
col
= iv->
cols
();
46
assume
(
row
>= 0);
47
assume
(
col
>= 0);
48
if
(
row
*
col
>0)
49
{
50
v
= (
int
*)
omAlloc
(
sizeof
(
int
)*
row
*
col
);
51
for
(
int
i
=
row
*
col
-1;
i
>=0;
i
--)
52
{
53
v
[
i
] = (*iv)[
i
];
54
}
55
}
56
else
v
=
NULL
;
57
}
58
59
void
resize
(
int
new_length);
60
inline
int
range
(
int
i
)
const
61
//{ return ((i<row) && (i>=0) && (col==1)); }
62
{
return
((((
unsigned
)
i
)<((
unsigned
)
row
)) && (
col
==1)); }
63
inline
int
range
(
int
i
,
int
j
)
const
64
//{ return ((i<row) && (i>=0) && (j<col) && (j>=0)); }
65
{
return
((((
unsigned
)
i
)<((
unsigned
)
row
)) && (((
unsigned
)
j
)<((
unsigned
)
col
))); }
66
inline
int
&
operator[]
(
int
i
)
67
{
68
#ifndef SING_NDEBUG
69
if
((
i
<0)||(
i
>=
row
*
col
))
70
{
71
Werror
(
"wrong intvec index:%d\n"
,
i
);
72
}
73
#endif
74
return
v
[
i
];
75
}
76
inline
const
int
&
operator[]
(
int
i
)
const
77
{
78
#ifndef SING_NDEBUG
79
if
((
i
<0)||(
i
>=
row
*
col
))
80
{
81
Werror
(
"wrong intvec index:%d\n"
,
i
);
82
}
83
#endif
84
return
v
[
i
];
85
}
86
#define IMATELEM(M,I,J) (M)[(I-1)*(M).cols()+J-1]
87
void
operator+=
(
int
intop);
88
void
operator-=
(
int
intop);
89
void
operator*=
(
int
intop);
90
void
operator/=
(
int
intop);
91
void
operator%=
(
int
intop);
92
// -2: not compatible, -1: <, 0:=, 1: >
93
int
compare
(
const
intvec
* o)
const
;
94
int
compare
(
int
o)
const
;
95
inline
int
length
()
const
{
return
col
*
row
; }
96
inline
int
cols
()
const
{
return
col
; }
97
inline
int
rows
()
const
{
return
row
; }
98
void
show
(
int
mat=0,
int
spaces=0)
const
;
99
#ifndef SING_NDEBUG
100
void
view()
const
;
101
#endif
102
103
inline
void
makeVector
() {
row
*=
col
;
col
=1; }
104
char
*
String
(
int
dim
= 2)
const
;
105
char
*
ivString
(
int
not_mat=1,
int
spaces=0,
int
dim
=2)
const
;
106
inline
~intvec
()
107
{
108
assume
(
row
>=0);
109
assume
(
col
>=0);
110
if
(
v
!=
NULL
)
111
{
112
omFreeSize
((
ADDRESS
)
v
,
sizeof
(
int
)*
row
*
col
);
113
v
=
NULL
;
114
}
115
}
116
inline
void
ivTEST
()
const
117
{
118
assume
(
row
>=0);
119
assume
(
col
>=0);
120
if
(
row
>0)
omCheckAddrSize
((
ADDRESS
)
v
,
sizeof
(
int
)*
row
*
col
);
121
}
122
inline
int
min_in
()
123
{
124
int
m
=0;
125
if
(
row
>0)
126
{
127
m
=
v
[0];
128
for
(
int
i
=
row
*
col
-1;
i
>0;
i
--)
if
(
v
[
i
]<
m
)
m
=
v
[
i
];
129
}
130
return
m
;
131
}
132
inline
int
max_in
()
133
{
134
int
m
=0;
135
if
(
row
>0)
136
{
137
m
=
v
[0];
138
for
(
int
i
=
row
*
col
-1;
i
>0;
i
--)
if
(
v
[
i
]>
m
)
m
=
v
[
i
];
139
}
140
return
m
;
141
}
142
intvec
*
delete_pos
(
int
p
);
143
// keiner (ausser obachman) darf das folgenden benutzen !!!
144
inline
int
*
ivGetVec
()
const
{
return
v
; }
145
};
146
inline
intvec
*
ivCopy
(
const
intvec
* o)
147
{
148
if
( o !=
NULL
)
149
return
new
intvec
(o);
150
return
NULL
;
151
}
152
153
intvec
*
ivAdd
(
intvec
* a,
intvec
*
b
);
154
intvec
*
ivAddShift
(
intvec
* a,
intvec
*
b
,
int
s
);
155
intvec
*
ivSub
(
intvec
* a,
intvec
*
b
);
156
intvec
*
ivTranp
(
intvec
* o);
157
int
ivTrace
(
intvec
* o);
158
intvec
*
ivMult
(
intvec
* a,
intvec
*
b
);
159
//void ivTriangMat(intvec * imat);
160
void
ivTriangIntern
(
intvec
* imat,
int
&ready,
int
&all);
161
intvec
*
ivSolveKern
(
intvec
* imat,
int
ready);
162
intvec
*
ivConcat
(
intvec
* a,
intvec
*
b
);
163
164
bigintmat
*
iv2biv
(
intvec
* hilb,
const
coeffs
cf
);
165
166
#ifdef MDEBUG
167
inline
void
ivTest
(
intvec
*
v
)
168
{
169
v
->ivTEST();
170
}
171
#else
172
#define ivTest(v) do {} while (0)
173
#endif
174
175
#undef INLINE_THIS
176
177
#endif
auxiliary.h
All the auxiliary stuff.
ADDRESS
void * ADDRESS
Definition
auxiliary.h:120
bigintmat.h
l
int l
Definition
cfEzgcd.cc:100
m
int m
Definition
cfEzgcd.cc:128
i
int i
Definition
cfEzgcd.cc:132
p
int p
Definition
cfModGcd.cc:4086
cf
CanonicalForm cf
Definition
cfModGcd.cc:4091
b
CanonicalForm b
Definition
cfModGcd.cc:4111
bigintmat
Matrices of numbers.
Definition
bigintmat.h:51
intvec
Definition
intvec.h:24
intvec::makeVector
void makeVector()
Definition
intvec.h:103
intvec::max_in
int max_in()
Definition
intvec.h:132
intvec::operator[]
int & operator[](int i)
Definition
intvec.h:66
intvec::~intvec
~intvec()
Definition
intvec.h:106
intvec::intvec
intvec(const intvec *iv)
Definition
intvec.h:41
intvec::delete_pos
intvec * delete_pos(int p)
Definition
intvec.cc:842
intvec::intvec
intvec(int l=1)
Definition
intvec.h:31
intvec::range
int range(int i) const
Definition
intvec.h:60
intvec::resize
void resize(int new_length)
Definition
intvec.cc:106
intvec::operator%=
void operator%=(int intop)
Definition
intvec.cc:193
intvec::show
void show(int mat=0, int spaces=0) const
Definition
intvec.cc:149
intvec::min_in
int min_in()
Definition
intvec.h:122
intvec::col
int col
Definition
intvec.h:28
intvec::length
int length() const
Definition
intvec.h:95
intvec::operator/=
void operator/=(int intop)
Definition
intvec.cc:179
intvec::operator+=
void operator+=(int intop)
Definition
intvec.cc:164
intvec::String
char * String(int dim=2) const
Definition
intvec.cc:127
intvec::compare
int compare(const intvec *o) const
Definition
intvec.cc:206
intvec::row
int row
Definition
intvec.h:27
intvec::operator[]
const int & operator[](int i) const
Definition
intvec.h:76
intvec::range
int range(int i, int j) const
Definition
intvec.h:63
intvec::v
int * v
Definition
intvec.h:26
intvec::ivString
char * ivString(int not_mat=1, int spaces=0, int dim=2) const
Definition
intvec.cc:58
intvec::operator*=
void operator*=(int intop)
Definition
intvec.cc:174
intvec::operator-=
void operator-=(int intop)
Definition
intvec.cc:169
intvec::cols
int cols() const
Definition
intvec.h:96
intvec::ivTEST
void ivTEST() const
Definition
intvec.h:116
intvec::rows
int rows() const
Definition
intvec.h:97
intvec::ivGetVec
int * ivGetVec() const
Definition
intvec.h:144
omallocClass
Definition
omallocClass.h:20
s
const CanonicalForm int s
Definition
facAbsFact.cc:51
v
const Variable & v
< [in] a sqrfree bivariate poly
Definition
facBivar.h:39
j
int j
Definition
facHensel.cc:110
ivSub
intvec * ivSub(intvec *a, intvec *b)
Definition
intvec.cc:297
ivTrace
int ivTrace(intvec *o)
Definition
intvec.cc:339
iv2biv
bigintmat * iv2biv(intvec *hilb, const coeffs cf)
Definition
intvec.cc:851
ivConcat
intvec * ivConcat(intvec *a, intvec *b)
Definition
intvec.cc:822
ivTriangIntern
void ivTriangIntern(intvec *imat, int &ready, int &all)
Definition
intvec.cc:404
ivAddShift
intvec * ivAddShift(intvec *a, intvec *b, int s)
Definition
intvec.cc:279
ivSolveKern
intvec * ivSolveKern(intvec *imat, int dimtr)
Definition
intvec.cc:442
ivAdd
intvec * ivAdd(intvec *a, intvec *b)
Definition
intvec.cc:249
ivMult
intvec * ivMult(intvec *a, intvec *b)
Definition
intvec.cc:349
ivTranp
intvec * ivTranp(intvec *o)
Definition
intvec.cc:327
ivCopy
intvec * ivCopy(const intvec *o)
Definition
intvec.h:146
ivTest
#define ivTest(v)
Definition
intvec.h:172
assume
#define assume(x)
Definition
mod2.h:389
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
omFreeSize
#define omFreeSize(addr, size)
Definition
omAllocDecl.h:260
omAlloc
#define omAlloc(size)
Definition
omAllocDecl.h:210
omCheckAddrSize
#define omCheckAddrSize(addr, size)
Definition
omAllocDecl.h:327
omAlloc0
#define omAlloc0(size)
Definition
omAllocDecl.h:211
NULL
#define NULL
Definition
omList.c:12
omallocClass.h
omalloc.h
Werror
void Werror(const char *fmt,...)
Definition
reporter.cc:189
reporter.h
dim
int dim(ideal I, ring r)
Definition
tropicalStrategy.cc:23
Generated on
for My Project by
doxygen 1.18.0
for
Singular