-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMathVector.hpp
More file actions
52 lines (44 loc) · 1.31 KB
/
MathVector.hpp
File metadata and controls
52 lines (44 loc) · 1.31 KB
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
#pragma once
#include <vector>
#include <initializer_list>
#include <iostream>
#include <stdexcept>
double randDouble(double min, double max);
struct DimensionLimits
{
std::vector<double> min;
std::vector<double> max;
DimensionLimits(int dimension, double minvalue, double maxvalue)
{
for(int i = 0; i < dimension; i++)
{
min.push_back(minvalue);
max.push_back(maxvalue);
}
};
};
struct MathVector
{
std::vector<double> vector;
MathVector() {};
MathVector(const MathVector& other)
{
vector = other.vector;
};
MathVector(std::initializer_list<double> l):vector(l){};
void randomVector(DimensionLimits);
void fillValues(unsigned dimension, double value);
int size() const
{
return vector.size();
};
};
std::ostream &operator<<(std::ostream &out, MathVector m);
MathVector operator+(const MathVector m1, const MathVector m2);
MathVector operator-(const MathVector m1, const MathVector m2);
MathVector operator*(const MathVector m1, const MathVector m2);
MathVector operator+(const MathVector m, const double d);
MathVector operator+(const double d, const MathVector m);
MathVector operator*(const MathVector m, const double d);
MathVector operator*(const double d ,const MathVector m);
extern unsigned seed;