CrossCovarianceMatrix.h
1 //-*-C++-*-
2 /***************************************************************************
3  *
4  * Copyright (C) 2016 by Aditya Parthasarathy & Willem van Straten
5  * Licensed under the Academic Free License version 2.1
6  *
7  ***************************************************************************/
8 
9 // psrchive/Base/Extensions/Pulsar/CrossCovarianceMatrix.h
10 
11 #ifndef __CrossCovarianceMatrix_h
12 #define __CrossCovarianceMatrix_h
13 
14 #include "Pulsar/ArchiveExtension.h"
15 #include "Pulsar/Profile.h"
16 
17 #include <vector>
18 
19 namespace Pulsar {
20 
21  class CrossCovarianceMatrix : public Pulsar::Archive::Extension
22  {
23 
24  public:
25 
27  CrossCovarianceMatrix ();
28 
30  CrossCovarianceMatrix (const CrossCovarianceMatrix& extension);
31 
33  const CrossCovarianceMatrix& operator= (const CrossCovarianceMatrix&);
34 
36  ~CrossCovarianceMatrix ();
37 
39  CrossCovarianceMatrix* clone () const
40  { return new CrossCovarianceMatrix( *this ); }
41 
43  void set_nbin (unsigned);
44 
46  unsigned get_nbin () const;
47 
49  void set_npol (unsigned);
50 
52  unsigned get_npol () const;
53 
55  void set_nlag (unsigned);
56 
58  unsigned get_nlag () const;
59 
61  unsigned get_ncross (unsigned ilag) const;
62 
64  unsigned get_ncross_total () const;
65 
66  class Stream;
67 
69  bool has_stream () const;
70 
72  void set_stream (Stream*);
73 
75  const Stream* get_stream () const;
76 
78  void resize_data ();
79 
81  std::vector<double>& get_data () { return covariance; }
82 
84  const std::vector<double>& get_data () const { return covariance; }
85 
86  protected:
87 
88  unsigned nbin;
89  unsigned npol;
90  unsigned nlag;
91 
92  std::vector<double> covariance;
93 
94  Reference::To<Stream> stream;
95 
96  };
97 
99  class CrossCovarianceMatrix::Stream : public Reference::Able
100  {
101  public:
102  typedef double Type;
103 
104  virtual unsigned get_ndat () const = 0;
105  virtual void get_data (unsigned off, unsigned n, double*) const = 0;
106  virtual void verify_end_of_data () const = 0;
107  };
108 
109 }
110 
111 #endif
112 
void covariance(Scalar *function, unsigned index, std::vector< unsigned > &imap, std::vector< std::vector< double > > &covar)
Definition: ArchiveExtension.h:28
Defines the PSRCHIVE library.
Definition: CalSource.h:17

Generated using doxygen 1.8.17