Main Page   Class Hierarchy   Compound List   File List   Compound Members  

matrix_int.cpp

00001 /*=============================================================================
00002         File: matrix.cpp
00003      Purpose:       
00004     Revision: $Id: matrix_int.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 
00027 #include "matrix.cpp"
00028 
00029 
00030 namespace PLib {
00031 
00032   void Matrix<int>::qSort(){
00033     qsort((char*)m,rows()*cols(),sizeof(int),compareInt) ;
00034   }
00035   
00036   Matrix<int>&
00037     Matrix<int>::operator*=(double a)
00038     {
00039       int *p1 ;
00040       p1 = m-1 ;
00041       const int size = rows()*cols() ;
00042       for(int i=0;i<size; ++i){
00043         *p1 = (int)(a*double(*p1)) ;  
00044         ++p1 ; 
00045       }
00046       return *this ;
00047     }
00048   
00049   Matrix<int>&
00050     Matrix<int>::operator+=(double a)
00051     {
00052       int *p1 ;
00053       p1 = m-1 ;
00054       const int size = rows()*cols() ;
00055       for(int i=size; i>0; --i)
00056         *(++p1) += (int)a ;  
00057       return *this ;
00058     }
00059 
00060   Matrix<int>&
00061     Matrix<int>::operator-=(double a)
00062     {
00063       int *p1 ;
00064       p1 = m-1 ;
00065       const int size = rows()*cols() ;
00066       for(int i=size; i>0; --i)
00067         *(++p1) -= (int)a ;  
00068       return *this ;
00069     }
00070   
00071   Matrix<int>&
00072     Matrix<int>::operator/=(double a)
00073     {
00074       int *p1 ;
00075       p1 = m-1 ;
00076       const int size = rows()*cols() ;
00077       for(int i=size; i>0; --i){
00078         *p1 = (int)(double(*p1)/a) ;  
00079         ++p1 ; 
00080       }
00081       return *this ;
00082     }
00083 
00084 #ifdef NO_IMPLICIT_TEMPLATES
00085 
00086   // Template instantation for g++ to be used with -fno-implicit-templates
00087   
00088   template class Matrix<int> ;
00089   
00090   template Matrix<int> operator+(const Matrix<int>&,const Matrix<int>&);
00091   template Matrix<int> operator-(const Matrix<int>&,const Matrix<int>&);
00092   template Matrix<int> operator*(const Matrix<int>&,const Matrix<int>&);
00093   template Matrix<int> operator*(const double,const Matrix<int>&);
00094   template Matrix<int> operator*(const Complex&,const Matrix<int>&);
00095   template Vector<int> operator*(const Matrix<int>&,const Vector<int>&);
00096   template int operator==(const Matrix<int>&,const Matrix<int>&);
00097   //template int operator!=(const Matrix<int>&,const Matrix<int>&);
00098   template Matrix<int> comm(const Matrix<int>&,const Matrix<int>&);
00099   
00100 #endif
00101 
00102 }

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