ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
fvar_ma1.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  */
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 "
00023      "dvar_vector operator*(const dvector& x, const dvar_matrix& m)\n";
00024      ad_exit(21);
00025    }
00026    dvar_vector tmp(m.colmin(),m.colmax());
00027    dvariable sum;
00028 
00029    for (int j=m.colmin(); j<=m.colmax(); j++)
00030    {
00031      sum=0.0;
00032      for (int i=x.indexmin(); i<=x.indexmax(); i++)
00033      {
00034        sum+=x.elem(i)*m.elem(i,j);
00035      }
00036      tmp[j]=sum;
00037    }
00038    RETURN_ARRAYS_DECREMENT();
00039    return(tmp);
00040  }