Adding template matrix class 33/22533/9
authorRamasamy <ram.kannan@samsung.com>
Thu, 5 Jun 2014 11:54:52 +0000 (17:24 +0530)
committerRamasamy <ram.kannan@samsung.com>
Thu, 12 Jun 2014 06:14:37 +0000 (11:44 +0530)
- Adding standalone directory for sensor fusion standalone C/C++
  library
- Adding matrix template class definition.

signed-off-by: Ramasamy <ram.kannan@samsung.com>
Change-Id: I55e4244338a33ad89272600bdcfad2605dff4af1

src/sensor_fusion/standalone/util/matrix.cpp [new file with mode: 0755]
src/sensor_fusion/standalone/util/matrix.h [new file with mode: 0755]

diff --git a/src/sensor_fusion/standalone/util/matrix.cpp b/src/sensor_fusion/standalone/util/matrix.cpp
new file mode 100755 (executable)
index 0000000..3544252
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <matrix.h>
+
+template <typename TYPE>
+matrix<TYPE>::matrix(void)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE>::matrix(const int rows, const int cols)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE>::matrix(const int rows, const int cols, TYPE **mat_data)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE>::matrix(const matrix<TYPE>& m)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE>::~matrix()
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> matrix<TYPE>::operator =(const matrix<TYPE>& m)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator +(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator +(const matrix<TYPE> m, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator -(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator -(const matrix<TYPE> m, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator *(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator *(const matrix<TYPE> m, const TYPE val)
+{
+
+}
+
+template <typename TYPE>
+matrix<TYPE> operator /(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+template <typename TYPE>
+bool operator ==(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+template <typename TYPE>
+bool operator !=(const matrix<TYPE> m1, const matrix<TYPE> m2)
+{
+
+}
+
+
+template <typename TYPE>
+matrix<TYPE> matrix<TYPE>::transpose(const matrix<TYPE> m)
+{
+
+}
diff --git a/src/sensor_fusion/standalone/util/matrix.h b/src/sensor_fusion/standalone/util/matrix.h
new file mode 100755 (executable)
index 0000000..7b95d98
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * sensord
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _MATRIX_H
+#define _MATRIX_H
+
+template <typename TYPE>
+class matrix {
+public:
+       int m_rows;
+       int m_cols;
+       TYPE **m_mat;
+
+       matrix(void);
+       matrix(const int rows, const int cols);
+       matrix(const int rows, const int cols, TYPE **mat_data);
+       matrix(const matrix<TYPE>& m);
+       ~matrix();
+
+       matrix<TYPE> operator =(const matrix<TYPE>& m);
+
+       friend matrix<TYPE> operator +(const matrix<TYPE> m1, const matrix<TYPE> m2);
+       friend matrix<TYPE> operator +(const matrix<TYPE> m, const TYPE val);
+       friend matrix<TYPE> operator -(const matrix<TYPE> m1, const matrix<TYPE> m2);
+       friend matrix<TYPE> operator -(const matrix<TYPE> m, const TYPE val);
+       friend matrix<TYPE> operator *(const matrix<TYPE> m1, const matrix<TYPE> m2);
+       friend matrix<TYPE> operator *(const matrix<TYPE> m, const TYPE val);
+       friend matrix<TYPE> operator /(const matrix<TYPE> m1, const matrix<TYPE> m2);
+       friend bool operator ==(const matrix<TYPE> m1, const matrix<TYPE> m2);
+       friend bool operator !=(const matrix<TYPE> m1, const matrix<TYPE> m2);
+
+       friend matrix<TYPE> transpose(const matrix<TYPE> m);
+};
+
+#endif  //_MATRIX_H