4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
27 #define TYPE_ROW_COL template<typename TYPE, int ROW, int COL>
28 #define T_R_C template<typename T, int R, int C>
29 #define T_R_C_C2 template<typename T, int R, int C, int C2>
30 #define T_R1_C1_R2_C2 template<typename T, int R1, int C1, int R2, int C2>
32 TYPE_ROW_COL class matrix {
37 matrix(TYPE mat_data[ROW][COL]);
38 matrix(const matrix<TYPE, ROW, COL>& m);
41 matrix<TYPE, ROW, COL> operator =(const matrix<TYPE, ROW, COL>& m);
43 T_R_C friend ostream& operator << (ostream& dout, matrix<T, R, C>& m);
44 T_R_C friend matrix<T, R, C> operator +(const matrix<T, R, C> m1, const matrix<T, R, C> m2);
45 T_R_C friend matrix<T, R, C> operator +(const matrix<T, R, C> m, const T val);
46 T_R_C friend matrix<T, R, C> operator -(const matrix<T, R, C> m1, const matrix<T, R, C> m2);
47 T_R_C friend matrix<T, R, C> operator -(const matrix<T, R, C> m, const T val);
48 T_R_C_C2 friend matrix<T, R, C2> operator *(const matrix<T, R, C> m1, const matrix<T, C, C2> m2);
49 T_R_C friend matrix<T, R, C> operator *(const matrix<T, R, C> m, const T val);
50 T_R_C friend matrix<T, R, C> operator /(const matrix<T, R, C> m1, const T val);
51 T_R1_C1_R2_C2 friend bool operator ==(const matrix<T, R1, C1> m1, const matrix<T, R2, C2> m2);
52 T_R1_C1_R2_C2 friend bool operator !=(const matrix<T, R1, C1> m1, const matrix<T, R2, C2> m2);
53 T_R_C friend matrix<T, R, C> tran(const matrix<T, R, C> m);