//---------------------------------------------------------------------------

#include "stdafx.h"

#ifdef _MSC_VER
#pragma hdrstop
#endif

using namespace std;

#include "../../Kernel/myExcept.h"

#include "CovMatrix.h"

CovMatrix::CovMatrix( const unsigned int _rows, const unsigned int _cols )
	: rownum(_rows), colnum(_cols), costs(_cols, 1)
{
	unsigned int i;

	matrix = new bitvector[_rows];
	for (i = 0; i < _rows; i++) {
		matrix[i].resize(_cols);
	}
}

CovMatrix::~CovMatrix(void)
{
	delete[] matrix;
}

void CovMatrix::DumpMatrix( const char *fn ) const
{
	unsigned int i;
	ofstream f;

	f.open(fn);
	f << rownum << endl;
	f << colnum << endl;
	for ( i = 0; i < colnum; i++ )
		f << costs[i] << " ";
	f << endl;
	for ( i = 0; i < rownum; i++ ) {
		f << matrix[i];
	}
	f.close();
}
