-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTerm.h
More file actions
35 lines (24 loc) · 722 Bytes
/
Copy pathTerm.h
File metadata and controls
35 lines (24 loc) · 722 Bytes
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
#pragma once
#include <array>
/*
A single polynomial term in R[x_1, x_2,..., x_N].
Stores the coefficient and the powers on x_1, x_2,..., x_N.
Terms can be multiplied with "*" or divided with "/"
*/
template<unsigned int N>
class Term
{
public:
double c = 0;
Term<N>();
Term<N>(double iniC, const std::array<unsigned int, N>& iniAlpha);
unsigned int operator()(unsigned int index) const;
unsigned int& operator[](unsigned int index);
Term<N> operator*(const Term<N>& t) const;
Term<N> operator/(const Term<N>& t) const;
std::array<unsigned int, N> degree() const;
unsigned int totalOrder() const;
bool divides(const Term<N>& t) const;
private:
std::array<unsigned int, N> alpha{};
};