ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
lmat5.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00012 #include "fvar.hpp"
00013 
00018 lmatrix& lmatrix::operator=(const lmatrix& m1)
00019  {
00020    if (rowmin() != m1.rowmin() || rowmax() != m1.rowmax() ||
00021      colmin() != m1.colmin() || colmax() != m1.colmax() )
00022    {
00023      cerr << " Incompatible array bounds in "
00024      "imatrix& operator = (const imatrix&)\n";
00025      ad_exit(21);
00026    }
00027 
00028    if (m != m1.m)            // check for condition that both matrices
00029    {                         // point to the same object
00030      for (int i=rowmin();i<=rowmax();i++)
00031      {
00032        *(m+i) = m1[i];
00033      }
00034    }
00035    return(*this);
00036  }
00037 
00042 lmatrix& lmatrix::operator=(const imatrix& m1)
00043  {
00044    if (rowmin() != m1.rowmin() || rowmax() != m1.rowmax() ||
00045      colmin() != m1.colmin() || colmax() != m1.colmax() )
00046    {
00047      cerr << " Incompatible array bounds in "
00048      "imatrix& operator=(const imatrix&)\n";
00049      ad_exit(21);
00050    }
00051 
00052    for (int i=rowmin();i<=rowmax();i++)
00053    {
00054      *(m+i) = m1[i];
00055    }
00056    return(*this);
00057  }
00058