ADMB Documentation  11.1.2533
 All Classes Files Functions Variables Typedefs Friends Defines
dmat33.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: dmat33.cpp 2281 2014-09-03 21:54:33Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include "fvar.hpp"
00012 #include <cassert>
00013 #include <climits>
00014 
00015 //class banded_symmetric_dmatrix;
00016 
00021 ostream& operator<<(const ostream& ofs1, const banded_symmetric_dmatrix& S1)
00022 {
00023   std::streamsize width = ofs1.width();
00024   assert(width <= INT_MAX);
00025   int w= (int)width;
00026   ostream& ofs=(ostream&) ofs1;
00027   banded_symmetric_dmatrix& S=(banded_symmetric_dmatrix&)(S1);
00028   int imin=S.indexmin();
00029   int imax=S.indexmax();
00030   int bw=S.bandwidth();
00031   int i1;
00032   int j1;
00033   for (int i=imin;i<=imax;i++)
00034   {
00035     for (int j=imin;j<=imax;j++)
00036     {
00037       if (j<=i)
00038       {
00039         j1=j;
00040         i1=i;
00041       }
00042       else
00043       {
00044         j1=i;
00045         i1=j;
00046       }
00047       if ( (i1-j1) < bw)
00048         ofs << setw(w) << S(i1,j1) << " ";
00049       else
00050         ofs << setw(w) << 0.0 << " ";
00051     }
00052     ofs << endl;
00053   }
00054   return ofs;
00055 }