1 // This is brl/bbas/bsta/io/bsta_io_gaussian_indep.h
2 #ifndef bsta_io_gaussian_indep_h_
3 #define bsta_io_gaussian_indep_h_
4 //:
5 // \file
6 // \brief Binary I/O for independent gaussians
7 // \author Matt Leotta (mleotta@lems.brown.edu)
8 // \date March 28, 2006
9 //
10 // \verbatim
11 //  Modifications
12 //   <none yet>
13 // \endverbatim
14 
15 #include <iostream>
16 #include <bsta/bsta_gaussian_indep.h>
17 #include <vsl/vsl_binary_io.h>
18 #include <vnl/io/vnl_io_vector_fixed.h>
19 #ifdef _MSC_VER
20 #  include <vcl_msvc_warnings.h>
21 #endif
22 
23 //: Binary save bsta_gaussian_indep to stream.
24 template <class T, unsigned n>
25 void
vsl_b_write(vsl_b_ostream & os,const bsta_gaussian_indep<T,n> & g)26 vsl_b_write(vsl_b_ostream &os, const bsta_gaussian_indep<T,n>& g)
27 {
28   vsl_b_write(os,g.mean());
29   vsl_b_write(os,g.diag_covar());
30 }
31 
32 //: Binary load bsta_gaussian_indep from stream.
33 template <class T, unsigned n>
34 void
vsl_b_read(vsl_b_istream & is,bsta_gaussian_indep<T,n> & g)35 vsl_b_read(vsl_b_istream &is, bsta_gaussian_indep<T,n>& g)
36 {
37   vnl_vector_fixed<T,n> mean, diag_covar;
38   vsl_b_read(is, mean);
39   vsl_b_read(is, diag_covar);
40   g.set_mean(mean);
41   g.set_covar(diag_covar);
42 }
43 
44 //: Print summary
45 template <class T, unsigned n>
46 void
vsl_print_summary(std::ostream & os,const bsta_gaussian_indep<T,n> & g)47 vsl_print_summary(std::ostream &os, const bsta_gaussian_indep<T,n>& g)
48 {
49   os << "Gaussian (indep) mean:"<<g.mean()<<" diag_covar:"<<g.diag_covar();
50 }
51 
52 
53 #endif // bsta_io_gaussian_indep_h_
54