ADMB Documentation  11.1.2375
 All Classes Files Functions Variables Typedefs Friends Defines
f1b2ma1.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: f1b2ma1.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <df1b2fun.h>
00012 
00017 df1b2vector column(const df1b2matrix& _M,int n)
00018 {
00019   ADUNCONST(df1b2matrix,M)
00020   int mmin=M.indexmin();
00021   int mmax=M.indexmax();
00022   if (n<M(mmin).indexmin() || n>M(mmin).indexmax())
00023   {
00024     cerr << "Index out of range in "
00025         " df1b2vector column(const df1b2matrix& M,int n) "
00026       << endl;
00027     ad_exit(1);
00028   }
00029   df1b2vector tmp(mmin,mmax);
00030   for (int i=mmin;i<=mmax;i++)
00031   {
00032     tmp(i)=M(i,n);
00033   }
00034   return tmp;
00035 }
00036 
00041  df1b2matrix trans(const df1b2matrix& _m1)
00042  {
00043    ADUNCONST(df1b2matrix,m1)
00044    int rmin=m1.indexmin();
00045    int rmax=m1.indexmax();
00046    int cmin=m1(rmin).indexmin();
00047    int cmax=m1(rmin).indexmax();
00048    df1b2matrix tmp(cmin,cmax,rmin,rmax);
00049 
00050    for (int i=rmin; i<=rmax; i++)
00051    {
00052      for (int j=cmin; j<=cmax; j++)
00053      {
00054        tmp(j,i)=m1(i,j);
00055      }
00056    }
00057    return (tmp);
00058  }