Eigen::TensorIOFormat Struct Reference

Public Member Functions

void init_spacer ()
 
 TensorIOFormat (const std::vector< std::string > &_separator, const std::vector< std::string > &_prefix, const std::vector< std::string > &_suffix, int _precision=StreamPrecision, int _flags=0, const std::string &_tenPrefix="", const std::string &_tenSuffix="", const char _fill=' ')
 
 TensorIOFormat (int _precision=StreamPrecision, int _flags=0, const std::string &_tenPrefix="", const std::string &_tenSuffix="", const char _fill=' ')
 

Static Public Member Functions

static const TensorIOFormat Legacy ()
 
static const TensorIOFormat Native ()
 
static const TensorIOFormat Numpy ()
 
static const TensorIOFormat Plain ()
 

Public Attributes

char fill
 
int flags
 
bool legacy_bit
 
int precision
 
std::vector< std::string > prefix
 
std::vector< std::string > separator
 
std::vector< std::string > spacer
 
std::vector< std::string > suffix
 
std::string tenPrefix
 
std::string tenSuffix
 

Detailed Description

Definition at line 24 of file TensorIO.h.

Constructor & Destructor Documentation

◆ TensorIOFormat() [1/2]

Eigen::TensorIOFormat::TensorIOFormat ( const std::vector< std::string > &  _separator,
const std::vector< std::string > &  _prefix,
const std::vector< std::string > &  _suffix,
int  _precision = StreamPrecision,
int  _flags = 0,
const std::string &  _tenPrefix = "",
const std::string &  _tenSuffix = "",
const char  _fill = ' ' 
)
inline

Definition at line 25 of file TensorIO.h.

28  : tenPrefix(_tenPrefix),
29  tenSuffix(_tenSuffix),
30  prefix(_prefix),
31  suffix(_suffix),
32  separator(_separator),
33  fill(_fill),
34  precision(_precision),
35  flags(_flags) {
36  init_spacer();
37  }
std::vector< std::string > separator
Definition: TensorIO.h:100
std::vector< std::string > prefix
Definition: TensorIO.h:98
std::vector< std::string > suffix
Definition: TensorIO.h:99
std::string tenPrefix
Definition: TensorIO.h:96
std::string tenSuffix
Definition: TensorIO.h:97

◆ TensorIOFormat() [2/2]

Eigen::TensorIOFormat::TensorIOFormat ( int  _precision = StreamPrecision,
int  _flags = 0,
const std::string &  _tenPrefix = "",
const std::string &  _tenSuffix = "",
const char  _fill = ' ' 
)
inline

Definition at line 39 of file TensorIO.h.

41  : tenPrefix(_tenPrefix), tenSuffix(_tenSuffix), fill(_fill), precision(_precision), flags(_flags) {
42  // default values of prefix, suffix and separator
43  prefix = {"", "["};
44  suffix = {"", "]"};
45  separator = {", ", "\n"};
46 
47  init_spacer();
48  }

Member Function Documentation

◆ init_spacer()

void Eigen::TensorIOFormat::init_spacer ( )
inline

Definition at line 50 of file TensorIO.h.

50  {
51  if ((flags & DontAlignCols)) return;
52  spacer.resize(prefix.size());
53  spacer[0] = "";
54  int i = int(tenPrefix.length()) - 1;
55  while (i >= 0 && tenPrefix[i] != '\n') {
56  spacer[0] += ' ';
57  i--;
58  }
59 
60  for (std::size_t k = 1; k < prefix.size(); k++) {
61  int j = int(prefix[k].length()) - 1;
62  while (j >= 0 && prefix[k][j] != '\n') {
63  spacer[k] += ' ';
64  j--;
65  }
66  }
67  }
int i
std::vector< std::string > spacer
Definition: TensorIO.h:104
std::ptrdiff_t j

◆ Legacy()

static const TensorIOFormat Eigen::TensorIOFormat::Legacy ( )
inlinestatic

Definition at line 90 of file TensorIO.h.

90  {
91  TensorIOFormat LegacyFormat(StreamPrecision, 0, "", "", ' ');
92  LegacyFormat.legacy_bit = true;
93  return LegacyFormat;
94  }
StreamPrecision
TensorIOFormat(const std::vector< std::string > &_separator, const std::vector< std::string > &_prefix, const std::vector< std::string > &_suffix, int _precision=StreamPrecision, int _flags=0, const std::string &_tenPrefix="", const std::string &_tenSuffix="", const char _fill=' ')
Definition: TensorIO.h:25

◆ Native()

static const TensorIOFormat Eigen::TensorIOFormat::Native ( )
inlinestatic

Definition at line 83 of file TensorIO.h.

83  {
84  std::vector<std::string> separator = {", ", ",\n", "\n"};
85  std::vector<std::string> prefix = {"", "{"};
86  std::vector<std::string> suffix = {"", "}"};
87  return TensorIOFormat(separator, prefix, suffix, StreamPrecision, 0, "{", "}", ' ');
88  }

◆ Numpy()

static const TensorIOFormat Eigen::TensorIOFormat::Numpy ( )
inlinestatic

Definition at line 69 of file TensorIO.h.

69  {
70  std::vector<std::string> prefix = {"", "["};
71  std::vector<std::string> suffix = {"", "]"};
72  std::vector<std::string> separator = {" ", "\n"};
73  return TensorIOFormat(separator, prefix, suffix, StreamPrecision, 0, "[", "]");
74  }

◆ Plain()

static const TensorIOFormat Eigen::TensorIOFormat::Plain ( )
inlinestatic

Definition at line 76 of file TensorIO.h.

76  {
77  std::vector<std::string> separator = {" ", "\n", "\n", ""};
78  std::vector<std::string> prefix = {""};
79  std::vector<std::string> suffix = {""};
80  return TensorIOFormat(separator, prefix, suffix, StreamPrecision, 0, "", "", ' ');
81  }

Member Data Documentation

◆ fill

char Eigen::TensorIOFormat::fill

Definition at line 101 of file TensorIO.h.

◆ flags

int Eigen::TensorIOFormat::flags

Definition at line 103 of file TensorIO.h.

◆ legacy_bit

bool Eigen::TensorIOFormat::legacy_bit

Definition at line 105 of file TensorIO.h.

◆ precision

int Eigen::TensorIOFormat::precision

Definition at line 102 of file TensorIO.h.

◆ prefix

std::vector<std::string> Eigen::TensorIOFormat::prefix

Definition at line 98 of file TensorIO.h.

◆ separator

std::vector<std::string> Eigen::TensorIOFormat::separator

Definition at line 100 of file TensorIO.h.

◆ spacer

std::vector<std::string> Eigen::TensorIOFormat::spacer

Definition at line 104 of file TensorIO.h.

◆ suffix

std::vector<std::string> Eigen::TensorIOFormat::suffix

Definition at line 99 of file TensorIO.h.

◆ tenPrefix

std::string Eigen::TensorIOFormat::tenPrefix

Definition at line 96 of file TensorIO.h.

◆ tenSuffix

std::string Eigen::TensorIOFormat::tenSuffix

Definition at line 97 of file TensorIO.h.


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