tesseract  5.0.0-alpha-619-ge9db
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)
 
 ~TransposedArray () override
 
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 32 of file weightmatrix.h.

Constructor & Destructor Documentation

◆ ~TransposedArray()

tesseract::TransposedArray::~TransposedArray ( )
overridedefault

Member Function Documentation

◆ PrintUnTransposed()

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

Definition at line 48 of file weightmatrix.h.

48  {
49  int num_features = dim1();
50  int width = dim2();
51  for (int y = 0; y < num_features; ++y) {
52  for (int t = 0; t < width; ++t) {
53  if (num == 0 || t < num || t + num >= width) {
54  tprintf(" %g", (*this)(y, t));
55  }
56  }
57  tprintf("\n");
58  }
59  }

◆ Transpose()

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

Definition at line 62 of file weightmatrix.cpp.

62  {
63  int width = input.dim1();
64  int num_features = input.dim2();
65  ResizeNoInit(num_features, width);
66  for (int t = 0; t < width; ++t) WriteStrided(t, input[t]);
67 }

◆ WriteStrided() [1/2]

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

Definition at line 43 of file weightmatrix.h.

43  {
44  int size1 = dim1();
45  for (int i = 0; i < size1; ++i) put(i, t, data[i]);
46  }

◆ WriteStrided() [2/2]

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

Definition at line 39 of file weightmatrix.h.

39  {
40  int size1 = dim1();
41  for (int i = 0; i < size1; ++i) put(i, t, data[i]);
42  }

The documentation for this class was generated from the following files:
tesseract::TransposedArray::WriteStrided
void WriteStrided(int t, const float *data)
Definition: weightmatrix.h:39
GENERIC_2D_ARRAY< double >::dim2
int dim2() const
Definition: matrix.h:206
GENERIC_2D_ARRAY< double >::ResizeNoInit
void ResizeNoInit(int size1, int size2, int pad=0)
Definition: matrix.h:90
GENERIC_2D_ARRAY< double >::put
void put(ICOORD pos, const double &thing)
Definition: matrix.h:219
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
GENERIC_2D_ARRAY< double >::dim1
int dim1() const
Definition: matrix.h:205