00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 #ifndef __MMX_MATRIX_INT_HPP
00014 #define __MMX_MATRIX_INT_HPP
00015 #include <algebramix/vector_unrolled.hpp>
00016 #include <algebramix/vector_simd.hpp>
00017 #include <algebramix/matrix.hpp>
00018 #include <algebramix/matrix_ring_naive.hpp>
00019 #include <algebramix/matrix_strassen.hpp>
00020 #include <algebramix/matrix_threads.hpp>
00021 #include <algebramix/matrix_simd.hpp>
00022 namespace mmx {
00023 #define TMPL template<typename V>
00024 #define Matrix matrix<int,V>
00025 
00026 
00027 
00028 
00029 TMPL inline Matrix operator + (const Matrix& x, const int& y) {
00030   return x + promote (y, x); }
00031 TMPL inline Matrix operator + (const int& x, const Matrix& y) {
00032   return promote (x, y) + y; }
00033 TMPL inline Matrix operator - (const Matrix& x, const int& y) {
00034   return x - promote (y, x); }
00035 TMPL inline Matrix operator - (const int& x, const Matrix& y) {
00036   return promote (x, y) - y; }
00037 TMPL inline Matrix operator * (const Matrix& x, const int& y) {
00038   return x * promote (y, x); }
00039 TMPL inline Matrix operator * (const int& x, const Matrix& y) {
00040   return promote (x, y) * y; }
00041 TMPL inline Matrix operator / (const Matrix& x, const int& y) {
00042   return x / promote (y, x); }
00043 TMPL inline Matrix operator / (const int& x, const Matrix& y) {
00044   return promote (x, y) / y; }
00045 
00046 #undef TMPL
00047 #undef Matrix
00048 
00049 
00050 
00051 
00052 
00053 DEFINE_VARIANT_1 (typename I, I, matrix_int_simd,
00054                     matrix_strassen<
00055                         typename Matrix_simd_variant(I) >)
00056 
00057 DEFINE_VARIANT (matrix_int,
00058                 matrix_ring_naive<
00059                   matrix_strassen<
00060                     matrix_unrolled<16> > >)
00061 
00062 STMPL
00063 struct matrix_variant_helper<signed char> {
00064   typedef matrix_int_simd<signed char> MV; };
00065 STMPL
00066 struct matrix_variant_helper<unsigned char> {
00067   typedef matrix_int_simd<unsigned char> MV; };
00068 STMPL
00069 struct matrix_variant_helper<short int> {
00070   typedef matrix_int_simd<short int> MV; };
00071 STMPL
00072 struct matrix_variant_helper<unsigned short int> {
00073   typedef matrix_int_simd<unsigned short int> MV; };
00074 STMPL
00075 struct matrix_variant_helper<int> {
00076   typedef matrix_int MV; };
00077 STMPL
00078 struct matrix_variant_helper<unsigned int> {
00079   typedef matrix_int MV; };
00080 STMPL
00081 struct matrix_variant_helper<long int> {
00082   typedef matrix_int MV; };
00083 STMPL
00084 struct matrix_variant_helper<unsigned long int> {
00085   typedef matrix_int MV; };
00086 STMPL
00087 struct matrix_variant_helper<long long int> {
00088   typedef matrix_int MV; };
00089 STMPL
00090 struct matrix_variant_helper<unsigned long long int> {
00091   typedef matrix_int MV; };
00092 }
00093 #endif // __MMX_MATRIX_INT_HPP