/home/coin/SVN-release/OS-2.4.2/Couenne/src/util/CouenneSparseMatrix.cpp

Go to the documentation of this file.
00001 /* $Id: CouenneSparseMatrix.cpp 716 2011-06-26 12:43:43Z pbelotti $
00002  *
00003  * Name:    CouenneSparseMatrix.cpp
00004  * Authors: Pietro Belotti, Clemson University
00005  * Purpose: Implementation of a sparse Matrix for use in distance
00006  *          measurements in Feasibility Pump
00007  * 
00008  * This file is licensed under the Eclipse Public License (EPL)
00009  */
00010 
00011 #include "CouenneSparseMatrix.hpp"
00012 #include "CoinHelperFunctions.hpp"
00013 
00014 using namespace Couenne;
00015 
00017 CouenneSparseMatrix::CouenneSparseMatrix ():
00018 
00019   num_  (0),
00020   val_  (NULL),
00021   col_  (NULL),
00022   row_  (NULL) {}
00023 
00024 
00026 CouenneSparseMatrix::~CouenneSparseMatrix () {
00027 
00028   if (val_) {
00029 
00030     free (val_);
00031     free (col_);
00032     free (row_);
00033   }
00034 }
00035 
00037 CouenneSparseMatrix::CouenneSparseMatrix (const CouenneSparseMatrix &rhs)
00038 {operator= (rhs);}
00039 
00041 CouenneSparseMatrix &CouenneSparseMatrix::operator= (const CouenneSparseMatrix &rhs) {
00042 
00043   num_ = rhs.num_;
00044 
00045   val_ = rhs.val_ && num_ ? CoinCopyOfArray (rhs.val_, num_) : NULL;
00046   col_ = rhs.col_ && num_ ? CoinCopyOfArray (rhs.col_, num_) : NULL;
00047   row_ = rhs.row_ && num_ ? CoinCopyOfArray (rhs.row_, num_) : NULL;
00048 
00049   return *this;
00050 }
00051 
00053 CouenneSparseMatrix *CouenneSparseMatrix::clone () 
00054 {return new CouenneSparseMatrix (*this);}

Generated on Wed Nov 30 03:04:09 2011 by  doxygen 1.4.7