Merge "Adding AK8975 geo-sensor info in sensors.xml.in required by geo-plugin" into...
[platform/core/system/sensord.git] / src / sensor_fusion / vector.h
1 /*
2  * sensord
3  *
4  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _VECTOR_H
21 #define _VECTOR_H
22
23 #include "matrix.h"
24
25 template <typename TYPE>
26 class vect {
27 public:
28         int m_size;
29         TYPE *m_vec;
30
31         vect(void);
32         vect(const int size);
33         vect(const int size, TYPE *vec_data);
34         vect(const vect<TYPE>& v);
35         ~vect();
36
37         vect<TYPE> operator =(const vect<TYPE>& v);
38
39         template<typename T> friend ostream& operator << (ostream& dout,
40                         vect<T>& v);
41         template<typename T> friend vect<T> operator +(const vect<T> v1,
42                         const vect<T> v2);
43         template<typename T> friend vect<T> operator +(const vect<T> v,
44                         const T val);
45         template<typename T> friend vect<T> operator -(const vect<T> v1,
46                         const vect<T> v2);
47         template<typename T> friend vect<T> operator -(const vect<T> v,
48                         const T val);
49         template<typename T> friend matrix<T> operator *(const matrix<T> v1,
50                         const vect<T> v2);
51         template<typename T> friend vect<T> operator *(const vect<T> v,
52                         const matrix<T> m);
53         template<typename T> friend vect<T> operator *(const vect<T> v,
54                         const T val);
55         template<typename T> friend vect<T> operator /(const vect<T> v1,
56                         const T val);
57         template<typename T> friend bool operator ==(const vect<T> v1,
58                         const vect<T> v2);
59         template<typename T> friend bool operator !=(const vect<T> v1,
60                         const vect<T> v2);
61
62         template<typename T> friend T mul(const vect<T> v, const matrix<T> m);
63         template<typename T> friend void insert_end(vect<T>& v, T val);
64         template<typename T> friend matrix<T> transpose(const vect<T> v);
65         template <typename T> friend vect<T> transpose(const matrix<T> m);
66         template<typename T> friend vect<T> cross(const vect<T> v1,
67                         const vect<T> v2);
68         template <typename T> friend T var(const vect<T> v);
69         template <typename T> friend bool is_initialized(const vect<T> v);
70 };
71
72 #include "vector.cpp"
73
74 #endif /* _VECTOR_H */