00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "matrix.cpp"
00027
00028 namespace PLib {
00029
00030 Matrix<unsigned char>&
00031 Matrix<unsigned char>::operator*=(double a)
00032 {
00033 unsigned char *p1 ;
00034 p1 = m-1 ;
00035 const int size = rows()*cols() ;
00036 for(int i=size; i>0; --i){
00037 *p1 = (unsigned char)(a*double(*p1)) ;
00038 ++p1 ;
00039 }
00040 return *this ;
00041 }
00042
00043 Matrix<unsigned char>&
00044 Matrix<unsigned char>::operator+=(double a)
00045 {
00046 unsigned char *p1 ;
00047 p1 = m-1 ;
00048 const int size = rows()*cols() ;
00049 for(int i=size; i>0; --i)
00050 *(++p1) += (unsigned char)a ;
00051 return *this ;
00052 }
00053
00054
00055 Matrix<unsigned char>&
00056 Matrix<unsigned char>::operator-=(double a)
00057 {
00058 unsigned char *p1 ;
00059 p1 = m-1 ;
00060 const int size = rows()*cols() ;
00061 for(int i=size; i>0; --i)
00062 *(++p1) -= (unsigned char)a ;
00063 return *this ;
00064 }
00065
00066
00067 Matrix<unsigned char>&
00068 Matrix<unsigned char>::operator/=(double a)
00069 {
00070 unsigned char *p1 ;
00071 p1 = m-1 ;
00072 const int size = rows()*cols() ;
00073 for(int i=size; i>0; --i){
00074 *p1 = (unsigned char)(double(*p1)/a) ;
00075 ++p1 ;
00076 }
00077 return *this ;
00078 }
00079
00080
00081 #ifdef NO_IMPLICIT_TEMPLATES
00082
00083 template class Matrix<unsigned char> ;
00084
00085 template Matrix<unsigned char> operator+(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00086 template Matrix<unsigned char> operator-(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00087 template Matrix<unsigned char> operator*(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00088 template Matrix<unsigned char> operator*(const double,const Matrix<unsigned char>&);
00089 template Matrix<unsigned char> operator*(const Complex&,const Matrix<unsigned char>&);
00090 template Vector<unsigned char> operator*(const Matrix<unsigned char>&,const Vector<unsigned char>&);
00091 template int operator==(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00092
00093 template Matrix<unsigned char> comm(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00094
00095 #endif
00096
00097 }