ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
tensprod.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 
00024   dvar_matrix tensor_prod(const dvar_matrix& a,const dvar_matrix & b)
00025   {
00026     int lba=a.indexmin();
00027     int lbb=b.indexmin();
00028     int uba=a.indexmax();
00029     int ubb=b.indexmax();
00030     dvar_matrix ta=trans(a);
00031     dvar_matrix tb=trans(b);
00032     dvar_matrix c(lba,uba,lbb,ubb);
00033     for (int i=lba;i<=lbb;i++)
00034       for (int j=lbb;j<=ubb;j++)
00035         c(i,j)=ta(i)*tb(j);
00036     return c;
00037   }