tesseract  4.00.00dev
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)
 
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)
 
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)
 
void AdaGradScaling (const GENERIC_2D_ARRAY< double > &sqsum, int num_samples)
 
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 31 of file weightmatrix.h.

Member Function Documentation

◆ PrintUnTransposed()

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

Definition at line 46 of file weightmatrix.h.

46  {
47  int num_features = dim1();
48  int width = dim2();
49  for (int y = 0; y < num_features; ++y) {
50  for (int t = 0; t < width; ++t) {
51  if (num == 0 || t < num || t + num >= width) {
52  tprintf(" %g", (*this)(y, t));
53  }
54  }
55  tprintf("\n");
56  }
57  }
#define tprintf(...)
Definition: tprintf.h:31

◆ Transpose()

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

Definition at line 30 of file weightmatrix.cpp.

30  {
31  int width = input.dim1();
32  int num_features = input.dim2();
33  ResizeNoInit(num_features, width);
34  for (int t = 0; t < width; ++t) WriteStrided(t, input[t]);
35 }
void WriteStrided(int t, const float *data)
Definition: weightmatrix.h:37
int dim1() const
Definition: matrix.h:201
int dim2() const
Definition: matrix.h:202
void ResizeNoInit(int size1, int size2)
Definition: matrix.h:86

◆ WriteStrided() [1/2]

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

Definition at line 37 of file weightmatrix.h.

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

◆ WriteStrided() [2/2]

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

Definition at line 41 of file weightmatrix.h.

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

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