/*
 * $Id: imat6.cpp 1112 2013-07-12 21:41:41Z johnoel $
 *
 * Author: David Fournier
 * Copyright (c) 2008-2012 Regents of the University of California
 */
/**
 * \file
 * Description not yet available.
 */
#include "fvar.hpp"

/**
 * Description not yet available.
 * \param
 */
void imatrix::allocate(const imatrix& dm)
{
  int nrl=dm.rowmin();
  int nrh=dm.rowmax();
  //int ncl=dm.colmin();
  //int nch=dm.colmax();
  index_min=nrl;
  index_max=nrh;

  int rs=rowsize();
  if ( (m = new ivector [rs]) == 0)
  {
    cerr << " Error allocating memory in imatrix contructor" << endl;
    ad_exit(21);
  }
  if ( (shape = new mat_shapex(m))== 0)
  {
    cerr << " Error allocating memory in imatrix contructor" << endl;
    ad_exit(21);
  }

  m -= rowmin();
  for (int i=rowmin(); i<=rowmax(); i++)
  {
    m[i].allocate(dm(i));
  }
}
