Main Page | Class List | File List | Class Members | File Members | Related Pages

_dgematrix-misc.hpp

Go to the documentation of this file.
00001 //=============================================================================
00002 /*! destroy all the matrix data */
00003 inline void _dgematrix::destroy() const
00004 {
00005 #ifdef  CPPSL_DEBUG
00006   std::cerr << "# [NOTE] _dgematrix::destroy() "
00007             << " An array at " << Array
00008             << " is going to be destroyed." << std::endl;
00009 #endif//CPPSL_DEBUG
00010   
00011   delete [] Array;
00012 }
00013 
00014 //=============================================================================
00015 /*! shallow copy dgematrix into _dgematrix and set dgematrix an empty matrix */
00016 inline void _dgematrix::absorb(dgematrix& mat) const
00017 {
00018   M =mat.M; N =mat.N;
00019   Ml =mat.Ml; Nl =mat.Nl;
00020   for(int i=0; i<9; i++){ Desc[i] =mat.Desc[i]; }
00021   
00022   delete [] Array;
00023   double* tmp_array;
00024   tmp_array = new double[0];
00025   
00026   Array =mat.Array;
00027   mat.Array =tmp_array;
00028 }
00029 
00030 ///////////////////////////////////////////////////////////////////////////////
00031 ///////////////////////////////////////////////////////////////////////////////
00032 ///////////////////////////////////////////////////////////////////////////////
00033 
00034 //=============================================================================
00035 /*! change the matrix into a zero matrix */
00036 inline void _dgematrix::zero() const
00037 {
00038   for(long i=0; i<Ml*Nl; i++){ Array[i] =0.0; }
00039 }
00040 
00041 //=============================================================================
00042 /*! change the matrix into an identity matrix */
00043 inline void _dgematrix::identity() const
00044 {
00045 #ifdef  CPPSL_DEBUG
00046   if(M!=N){
00047     std::cerr << "[ERROR] _dgematrix::identity()" << std::endl
00048               << "Only square matrix can be a identity matrix." << std::endl
00049               << "The matrix size was " << M << "x" << N << "." << std::endl;
00050     exit(1);
00051   }
00052 #endif//CPPSL_DEBUG
00053   
00054   for(long i=0; i<Ml*Nl; i++){ Array[i] =0.0; }
00055   for(long i=0; i<M; i++){ operator()(i,i) =1.0; }
00056 }

Generated on Sat Jan 31 19:25:43 2004 for CPPScaLapack by doxygen 1.3.5