-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvector_math.h
More file actions
30 lines (22 loc) · 1.41 KB
/
vector_math.h
File metadata and controls
30 lines (22 loc) · 1.41 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
#pragma once
#include <vector>
/*----------- element‑wise binary operators (vector–vector) ----------*/
std::vector<double>& operator+=(std::vector<double>& a,
const std::vector<double>& b);
std::vector<double>& operator-=(std::vector<double>& a,
const std::vector<double>& b);
std::vector<double> operator+(const std::vector<double>& a,
const std::vector<double>& b);
std::vector<double> operator-(const std::vector<double>& a,
const std::vector<double>& b);
/*----------- vector–scalar products --------------------------------*/
std::vector<double>& operator*=(std::vector<double>& v, double s);
std::vector<double>& operator/=(std::vector<double>& v, double s);
std::vector<double> operator*(const std::vector<double>& v, double s);
std::vector<double> operator*(double s, const std::vector<double>& v);
std::vector<double> operator/(const std::vector<double>& v, double s);
/*----------- Element‑wise product ---------------------------*/
std::vector<double>& operator*(std::vector<double>& a, const std::vector<double>& b);
std::vector<double> operator*(const std::vector<double>& a, const std::vector<double>& b);
std::vector<double>& operator/(std::vector<double>& a, const std::vector<double>& b);
std::vector<double> operator/(const std::vector<double>& a, const std::vector<double>& b);