contrib/brl/bbas/bsta/io/bsta_io_gaussian_full.h
Go to the documentation of this file.
00001 // This is brl/bbas/bsta/io/bsta_io_gaussian_full.h
00002 #ifndef bsta_io_gaussian_full_h_
00003 #define bsta_io_gaussian_full_h_
00004 //:
00005 // \file
00006 // \brief Binary I/O for full gaussians
00007 // \author Matt Leotta (mleotta@lems.brown.edu)
00008 // \date March 28, 2006
00009 //
00010 // \verbatim
00011 //  Modifications
00012 //   <none yet>
00013 // \endverbatim
00014 
00015 #include <bsta/bsta_gaussian_full.h>
00016 #include <vsl/vsl_binary_io.h>
00017 #include <vnl/io/vnl_io_vector_fixed.h>
00018 #include <vnl/io/vnl_io_matrix_fixed.h>
00019 #include <vcl_iostream.h>
00020 
00021 //: Binary save bsta_gaussian_full to stream.
00022 template <class T, unsigned n>
00023 void
00024 vsl_b_write(vsl_b_ostream &os, const bsta_gaussian_full<T,n>& g)
00025 {
00026   vsl_b_write(os,g.mean());
00027   vsl_b_write(os,g.covar());
00028 }
00029 
00030 //: Binary load bsta_gaussian_full from stream.
00031 template <class T, unsigned n>
00032 void
00033 vsl_b_read(vsl_b_istream &is, bsta_gaussian_full<T,n>& g)
00034 {
00035   vnl_vector_fixed<T,n> mean;
00036   vnl_matrix_fixed<T,n,n> covar;
00037   vsl_b_read(is, mean);
00038   vsl_b_read(is, covar);
00039   g.set_mean(mean);
00040   g.set_covar(covar);
00041 }
00042 
00043 //: Print summary
00044 template <class T, unsigned n>
00045 void
00046 vsl_print_summary(vcl_ostream &os, const bsta_gaussian_full<T,n>& g)
00047 {
00048   os << "Gaussian (full) mean:"<<g.mean()<<" covar:"<<g.covar();
00049 }
00050 
00051 
00052 #endif // bsta_io_gaussian_full_h_