ADMB Documentation  11.1.1015
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_ma1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: fvar_ma1.cpp 542 2012-07-10 21:04:06Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California 
00006  */
00011 #include "fvar.hpp"
00012 
00017 dvar_vector operator*(const dvector& x, const dvar_matrix& m)
00018  {
00019    RETURN_ARRAYS_INCREMENT();
00020    if (x.indexmin() != m.rowmin() || x.indexmax() != m.rowmax())
00021    {
00022      cerr << " Incompatible array bounds in dvar_vector  operator*(const dvector& x, const dvar_matrix& m)\n";
00023      ad_exit(21);
00024    }
00025    dvar_vector tmp(m.colmin(),m.colmax());
00026    dvariable sum;
00027 
00028    for (int j=m.colmin(); j<=m.colmax(); j++)
00029    {
00030      sum=0.0;
00031      for (int i=x.indexmin(); i<=x.indexmax(); i++)
00032      {
00033        sum+=x.elem(i)*m.elem(i,j);
00034      }
00035      tmp[j]=sum;
00036    }
00037    RETURN_ARRAYS_DECREMENT();
00038    return(tmp);
00039  }