ColPack
Utilities/MatrixDeallocation.h
Go to the documentation of this file.
00001 /************************************************************************************
00002     Copyright (C) 2005-2008 Assefaw H. Gebremedhin, Arijit Tarafdar, Duc Nguyen,
00003     Alex Pothen
00004 
00005     This file is part of ColPack.
00006 
00007     ColPack is free software: you can redistribute it and/or modify
00008     it under the terms of the GNU Lesser General Public License as published
00009     by the Free Software Foundation, either version 3 of the License, or
00010     (at your option) any later version.
00011 
00012     ColPack is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015     GNU Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public License
00018     along with ColPack.  If not, see <http://www.gnu.org/licenses/>.
00019 ************************************************************************************/
00020 
00021 #include "Definitions.h"
00022 
00023 using namespace std;
00024 
00025 #ifndef MATRIXDEALLOCATION_H
00026 #define MATRIXDEALLOCATION_H
00027 
00029 
00032 int MatrixDeallocation_SparseSolversFormat(unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_JacobianValue);
00033 
00035 
00038 int MatrixDeallocation_RowCompressedFormat(double ***dp3_HessianValue, unsigned int i_numOfRows);
00039 
00044 int MatrixDeallocation_CoordinateFormat(unsigned int **ip2_RowIndex, unsigned int **ip2_ColumnIndex, double **dp2_HessianValue);
00045 
00046 
00047 template<typename T>
00048 int free_2DMatrix(T **dp2_2DMatrix, unsigned int i_numOfRows) {
00049   for(unsigned int i=0; i< i_numOfRows; i++) {
00050     delete[] (dp2_2DMatrix)[i];
00051   }
00052   delete[] (dp2_2DMatrix);
00053 
00054   return _TRUE;
00055 }
00056 
00057 template<typename T>
00058 int free_2DMatrix(T ***dp3_2DMatrix, unsigned int i_numOfRows) {
00059         free_2DMatrix(*dp3_2DMatrix,i_numOfRows);
00060         delete dp3_2DMatrix;
00061 
00062   return _TRUE;
00063 }
00064 
00065 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines