Main Page   Class Hierarchy   Compound List   File List   Compound Members  

matrix_uchar.cpp

00001 /*=============================================================================
00002         File: matrix.cpp
00003      Purpose:       
00004     Revision: $Id: matrix_uchar.cpp,v 1.2 2002/05/13 21:07:45 philosophil Exp $
00005   Created by: Philippe Lavoie          (3 Oct, 1996)
00006  Modified by: 
00007 
00008  Copyright notice:
00009           Copyright (C) 1996-1998 Philippe Lavoie
00010  
00011           This library is free software; you can redistribute it and/or
00012           modify it under the terms of the GNU Library General Public
00013           License as published by the Free Software Foundation; either
00014           version 2 of the License, or (at your option) any later version.
00015  
00016           This library is distributed in the hope that it will be useful,
00017           but WITHOUT ANY WARRANTY; without even the implied warranty of
00018           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019           Library General Public License for more details.
00020  
00021           You should have received a copy of the GNU Library General Public
00022           License along with this library; if not, write to the Free
00023           Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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   // template int operator!=(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00093   template Matrix<unsigned char> comm(const Matrix<unsigned char>&,const Matrix<unsigned char>&);
00094 
00095 #endif
00096 
00097 }

Generated on Tue Jun 24 13:26:55 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002