Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
stan::io::csv_writer Class Reference

Writes Stan variables in comma-separated-value format to an output stream. More...

#include <csv_writer.hpp>

Public Member Functions

void comma ()
 Write a comma. More...
 
 csv_writer (std::ostream &o)
 Construct a CSV writer that writes to the specified output stream. More...
 
void newline ()
 Write a newline character. More...
 
void write (int n)
 Write a value. More...
 
void write (double x)
 Write a value. More...
 
template<int R, int C>
void write_row_major (const Eigen::Matrix< double, R, C > &m)
 Write a value. More...
 
template<int R, int C>
void write_col_major (const Eigen::Matrix< double, R, C > &m)
 Write a value in column-major order. More...
 
template<int R, int C>
void write (const Eigen::Matrix< double, R, C > &m)
 
void write (const std::string &s)
 Write a value. More...
 

Detailed Description

Writes Stan variables in comma-separated-value format to an output stream.

All output is written to the same line and separated by commas. Use the newline() method to advance to the next line of CSV output.

Definition at line 23 of file csv_writer.hpp.

Constructor & Destructor Documentation

stan::io::csv_writer::csv_writer ( std::ostream &  o)
inline

Construct a CSV writer that writes to the specified output stream.

Parameters
oOutput stream on which to write.

Definition at line 51 of file csv_writer.hpp.

Member Function Documentation

void stan::io::csv_writer::comma ( )
inline

Write a comma.

On the first call do nothing, subsequently write a comma.

Definition at line 36 of file csv_writer.hpp.

void stan::io::csv_writer::newline ( )
inline

Write a newline character.

End a line of output and start a new line. This method needs to be called rather than writing a newline to the output stream because it resets the comma flag.

Definition at line 63 of file csv_writer.hpp.

void stan::io::csv_writer::write ( int  n)
inline

Write a value.

Write the specified integer to the output stream on the current line.

Parameters
nInteger to write.

Definition at line 76 of file csv_writer.hpp.

void stan::io::csv_writer::write ( double  x)
inline

Write a value.

Write the specified double to the output stream on the current line.

Parameters
xDouble to write.

Definition at line 89 of file csv_writer.hpp.

template<int R, int C>
void stan::io::csv_writer::write ( const Eigen::Matrix< double, R, C > &  m)
inline

Definition at line 133 of file csv_writer.hpp.

void stan::io::csv_writer::write ( const std::string &  s)
inline

Write a value.

Write the specified string to the output stream with quotes around it and quotes inside escaped to double quotes.

Parameters
sString to write.

Definition at line 146 of file csv_writer.hpp.

template<int R, int C>
void stan::io::csv_writer::write_col_major ( const Eigen::Matrix< double, R, C > &  m)
inline

Write a value in column-major order.

Write the specified matrix to the output stream in column-major order.

Parameters
mMatrix of doubles to write.

Definition at line 122 of file csv_writer.hpp.

template<int R, int C>
void stan::io::csv_writer::write_row_major ( const Eigen::Matrix< double, R, C > &  m)
inline

Write a value.

Write the specified matrix to the output stream in row-major order.

Parameters
mMatrix to write.

Definition at line 104 of file csv_writer.hpp.


The documentation for this class was generated from the following file:

     [ Stan Home Page ] © 2011–2014, Stan Development Team.