sokobo
Loading...
Searching...
No Matches
vector.h
1
#pragma once
2
#include <vector>
3
#include <string>
4
#include <stdexcept>
5
#include <cmath>
6
#include <sstream>
7
8
template
<
typename
T>
9
class
Vector
10
{
11
private
:
12
std::vector<T> data;
13
14
public
:
15
Vector
();
16
Vector
(
int
size);
17
Vector
(
const
std::vector<T>& vec);
18
19
T& operator[](
int
i);
20
const
T& operator[](
int
i)
const
;
21
int
size()
const
;
22
23
Vector<T>
operator+(
const
Vector<T>
& other)
const
;
24
Vector<T>
operator-(
const
Vector<T>
& other)
const
;
25
Vector<T>
operator*(T scalar)
const
;
26
Vector<T>
operator/(T scalar)
const
;
27
28
T dot(
const
Vector<T>
& other)
const
;
29
double
norm()
const
;
30
void
normalize();
31
32
std::string toString()
const
;
33
34
static
Vector<T>
zeros(
int
size);
35
static
Vector<T>
ones(
int
size);
36
37
};
Vector
Definition:
vector.h:10
source
include
vector.h
Generated by
1.9.6