/**------------------------------------------------------------------------
 * @file
 *
 * Copyright 2001 by the University of Toronto (UT).
 *
 *                       All Rights Reserved
 * 
 * Permission to copy and modify this software and its documentation 
 * only for internal use in your organization is hereby granted, 
 * provided that this notice is retained thereon and on all copies.  
 * UT makes no representations as to the suitability and operability 
 * of this software for any purpose.  It is provided "as is" without 
 * express or implied warranty.
 *
 * UT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
 * SHALL UT BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
 * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 * No other rights, including for example, the right to redistribute 
 * this software and its documentation or the right to prepare 
 * derivative works, are granted unless specifically provided in a 
 * separate license agreement.
 *
 * Author: Diego Macrini
 *
 *-----------------------------------------------------------------------*/
#ifndef __DAG_SIMILARITY_MEMORY_H__
#define __DAG_SIMILARITY_MEMORY_H__

//#include <DAG.h>
#include <SmartMatrix.h>

class DAGSimilarityMemory : SmartMatrix<Matrix>
{
public:

	Matrix& operator()(int i, int j)
	{
		return (*this)[i][j];
	}

	double& operator()(int i, int j, int si, int sj)
	{
		return (*this)(i, j)(si + 1, sj + 1);
	}

	void Init(int rows, int cols, int subRows, int subCols)
	{
		int i, j;

		Resize(rows, cols);

		for (i = 0; i < rows; i++)
		{
			for (j = 0; j < cols; j++)
			{
				Matrix& simMat = (*this)(i, j);

				simMat.ReSize(subRows, subCols); 
				simMat = -1;
			}
		}
	}

	DAGSimilarityMemory()
	{
		// Nothing to do here
	}

	DAGSimilarityMemory(int rows, int cols, int subRows, int subCols)
	{
		Init(rows, cols, subRows, subCols);
	}
};

#endif //__DAG_SIMILARITY_MEMORY_H__
