CHROMA
octave.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 #ifndef _OCTAVE_DEBUG_H
4 #define _OCTAVE_DEBUG_H
5 
6 #include <sstream>
7 #include "chromabase.h"
8 
9 
10 
11 // NEEDS A LOT OF CLEAN UP
12 namespace Octave
13 {
14  int count ;
15  std::string tag(const std::string& prefix){
16  std::stringstream t ;
17  t<<prefix<<count ;
18  count++;
19  return t.str() ;
20  }
21 
22  void PrintClear( const std::string& fname){
23  count=0;
24  ofstream foo(fname.c_str(),ios::trunc);
25  foo<<"# BEGIN FILE:"<<fname<<"\n" ;
26  foo.close();
27  }
28 
29 
30  void PrintOut(const multi2d<DComplex>& H, const int& N,
31  const std::string& tag,
32  const std::string& fname)
33  {
34  ofstream foo(fname.c_str(),ios::app);
35  foo<<tag<<" =["<<std::endl;
36  for(int i(0);i<N;i++){
37  for(int j(0);j<N;j++)
38  foo<<real(H(i,j))<<"+i*"<<imag(H(i,j))<<" ";
39  foo<<std::endl ;
40  }
41  foo<<"];"<<std::endl;
42  foo.close();
43  }
44 
45 
46  void PrintOut(const multi1d<DComplex>& H,
47  const int& N,
48  const std::string& tag,
49  const std::string& fname)
50  {
51  ofstream foo(fname.c_str(),ios::app);
52  foo<<tag<<" =["<<std::endl;
53  for(int i(0);i<N;i++){
54  foo<<real(H[i])<<"+i*"<<imag(H[i])<<" ";
55  foo<<std::endl ;
56  }
57  foo<<"];"<<std::endl;
58  foo.close();
59  }
60 
61 
62 
63 } ; // End Namespace Octave
64 
65 #endif
Primary include file for CHROMA library code.
unsigned j
Definition: ldumul_w.cc:35
unsigned i
Definition: ldumul_w.cc:34
int t
Definition: meslate.cc:37
Definition: octave.h:13
void PrintClear(const std::string &fname)
Definition: octave.h:22
void PrintOut(const multi2d< DComplex > &H, const int &N, const std::string &tag, const std::string &fname)
Definition: octave.h:30
int count
Definition: octave.h:14
std::string tag(const std::string &prefix)
Definition: octave.h:15
::std::string string
Definition: gtest.h:1979