tesseract  4.0.0-1-g2a2b
tesseract::TransposedArray Class Reference

#include <weightmatrix.h>

Inheritance diagram for tesseract::TransposedArray:
GENERIC_2D_ARRAY< double >

Public Member Functions

void Transpose (const GENERIC_2D_ARRAY< double > &input)
 
virtual ~TransposedArray ()
 
void WriteStrided (int t, const float *data)
 
void WriteStrided (int t, const double *data)
 
void PrintUnTransposed (int num)
 
- Public Member Functions inherited from GENERIC_2D_ARRAY< double >
 GENERIC_2D_ARRAY (int dim1, int dim2, const double &empty, double *array)
 
 GENERIC_2D_ARRAY (int dim1, int dim2, const double &empty)
 
 GENERIC_2D_ARRAY ()
 
 GENERIC_2D_ARRAY (const GENERIC_2D_ARRAY< double > &src)
 
virtual ~GENERIC_2D_ARRAY ()
 
void operator= (const GENERIC_2D_ARRAY< double > &src)
 
void ResizeNoInit (int size1, int size2, int pad=0)
 
void Resize (int size1, int size2, const double &empty)
 
void ResizeWithCopy (int size1, int size2)
 
void Clear ()
 
bool Serialize (FILE *fp) const
 
bool Serialize (tesseract::TFile *fp) const
 
bool DeSerialize (bool swap, FILE *fp)
 
bool DeSerialize (tesseract::TFile *fp)
 
bool SerializeClasses (FILE *fp) const
 
bool DeSerializeClasses (bool swap, FILE *fp)
 
int dim1 () const
 
int dim2 () const
 
virtual int num_elements () const
 
virtual int index (int column, int row) const
 
void put (ICOORD pos, const double &thing)
 
void put (int column, int row, const double &thing)
 
double get (ICOORD pos) const
 
double get (int column, int row) const
 
const double & operator() (int column, int row) const
 
double & operator() (int column, int row)
 
double * operator[] (int column)
 
const double * operator[] (int column) const
 
void operator+= (const GENERIC_2D_ARRAY< double > &addend)
 
void operator+= (const double &addend)
 
void operator-= (const GENERIC_2D_ARRAY< double > &minuend)
 
void operator*= (const double &factor)
 
void Clip (const double &rangemin, const double &rangemax)
 
bool WithinBounds (const double &rangemin, const double &rangemax) const
 
double Normalize ()
 
double Max () const
 
double MaxAbs () const
 
void SumSquares (const GENERIC_2D_ARRAY< double > &src, const double &decay_factor)
 
void AdamUpdate (const GENERIC_2D_ARRAY< double > &sum, const GENERIC_2D_ARRAY< double > &sqsum, const double &epsilon)
 
void AssertFinite () const
 
void RotatingTranspose (const int *dims, int num_dims, int src_dim, int dest_dim, GENERIC_2D_ARRAY< double > *result) const
 
void delete_matrix_pointers ()
 

Additional Inherited Members

- Protected Member Functions inherited from GENERIC_2D_ARRAY< double >
bool SerializeSize (FILE *fp) const
 
bool SerializeSize (tesseract::TFile *fp) const
 
bool DeSerializeSize (bool swap, FILE *fp)
 
bool DeSerializeSize (tesseract::TFile *fp)
 
- Protected Attributes inherited from GENERIC_2D_ARRAY< double >
double * array_
 
double empty_
 
int dim1_
 
int dim2_
 
int size_allocated_
 

Detailed Description

Definition at line 33 of file weightmatrix.h.

Constructor & Destructor Documentation

◆ ~TransposedArray()

tesseract::TransposedArray::~TransposedArray ( )
virtualdefault

Member Function Documentation

◆ PrintUnTransposed()

void tesseract::TransposedArray::PrintUnTransposed ( int  num)
inline

Definition at line 49 of file weightmatrix.h.

49  {
50  int num_features = dim1();
51  int width = dim2();
52  for (int y = 0; y < num_features; ++y) {
53  for (int t = 0; t < width; ++t) {
54  if (num == 0 || t < num || t + num >= width) {
55  tprintf(" %g", (*this)(y, t));
56  }
57  }
58  tprintf("\n");
59  }
60  }
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37

◆ Transpose()

void tesseract::TransposedArray::Transpose ( const GENERIC_2D_ARRAY< double > &  input)

Definition at line 42 of file weightmatrix.cpp.

42  {
43  int width = input.dim1();
44  int num_features = input.dim2();
45  ResizeNoInit(num_features, width);
46  for (int t = 0; t < width; ++t) WriteStrided(t, input[t]);
47 }
void ResizeNoInit(int size1, int size2, int pad=0)
Definition: matrix.h:91
int dim1() const
Definition: matrix.h:206
int dim2() const
Definition: matrix.h:207
void WriteStrided(int t, const float *data)
Definition: weightmatrix.h:40

◆ WriteStrided() [1/2]

void tesseract::TransposedArray::WriteStrided ( int  t,
const float *  data 
)
inline

Definition at line 40 of file weightmatrix.h.

40  {
41  int size1 = dim1();
42  for (int i = 0; i < size1; ++i) put(i, t, data[i]);
43  }
void put(ICOORD pos, const double &thing)
Definition: matrix.h:220

◆ WriteStrided() [2/2]

void tesseract::TransposedArray::WriteStrided ( int  t,
const double *  data 
)
inline

Definition at line 44 of file weightmatrix.h.

44  {
45  int size1 = dim1();
46  for (int i = 0; i < size1; ++i) put(i, t, data[i]);
47  }
void put(ICOORD pos, const double &thing)
Definition: matrix.h:220

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