blob: 0d6d4179f63d18d0ef2ed23cd98955511f06cad3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
// file: bigint_vector.h
// update: 09/25/02
#ifndef _BIGINT_VECTOR_H
#define _BIGINT_VECTOR_H
#include <cassert>
#include <cstdlib>
#include <iostream>
#include "bigint.h"
using namespace std;
class bigint_vector
{
friend class bigrational_vector;
private:
unsigned long dim;
bigint* rep;
// arithmetic
bigint_vector add(const bigint_vector&) const;
bigint_vector sub(const bigint_vector&) const;
bigint_vector neg() const;
bigint in_prod(const bigint_vector&) const;
bigint_vector scalar_mul(const bigint&) const;
// comparison
int cmp(const bigint_vector&) const;
int is_zero() const;
public:
// constructor, assignment and destructor
bigint_vector(const unsigned long = 1);
bigint_vector(const unsigned long, const bigint*);
bigint_vector(const bigint_vector&);
bigint_vector& operator =(const bigint_vector&);
~bigint_vector();
// size
unsigned long get_dim() const;
// element
bigint& operator [](const unsigned long) const;
// arithmetic
friend bigint_vector operator +(const bigint_vector&, const bigint_vector&);
friend bigint_vector operator -(const bigint_vector&, const bigint_vector&);
friend bigint_vector operator -(const bigint_vector&);
friend bigint in_prod(const bigint_vector&, const bigint_vector&);
friend bigint_vector scalar_mul(const bigint&, const bigint_vector&);
// comparison
friend int operator ==(const bigint_vector&, const bigint_vector&);
friend int operator !=(const bigint_vector&, const bigint_vector&);
friend int is_zero(const bigint_vector&);
// arithemtic and assignment
bigint_vector& operator +=(const bigint_vector&);
bigint_vector& operator -=(const bigint_vector&);
// bigint_vector& scalar_mul_assign(const bigint&);
// stream
friend ostream& operator <<(ostream&, const bigint_vector&);
};
inline unsigned long bigint_vector :: get_dim() const
{
return dim;
}
inline bigint& bigint_vector :: operator [](const unsigned long n) const
{
assert(n < dim);
return rep[n];
}
#endif
|