tesseract  5.0.0-alpha-619-ge9db
GENERIC_2D_ARRAY< T > Class Template Reference

#include <intsimdmatrix.h>

Inheritance diagram for GENERIC_2D_ARRAY< T >:
BandTriMatrix< T >

Public Member Functions

 GENERIC_2D_ARRAY (int dim1, int dim2, const T &empty, T *array)
 
 GENERIC_2D_ARRAY (int dim1, int dim2, const T &empty)
 
 GENERIC_2D_ARRAY ()
 
 GENERIC_2D_ARRAY (const GENERIC_2D_ARRAY< T > &src)
 
virtual ~GENERIC_2D_ARRAY ()
 
void operator= (const GENERIC_2D_ARRAY< T > &src)
 
void ResizeNoInit (int size1, int size2, int pad=0)
 
void Resize (int size1, int size2, const T &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 T &thing)
 
void put (int column, int row, const T &thing)
 
get (ICOORD pos) const
 
get (int column, int row) const
 
const T & operator() (int column, int row) const
 
T & operator() (int column, int row)
 
T * operator[] (int column)
 
const T * operator[] (int column) const
 
void operator+= (const GENERIC_2D_ARRAY< T > &addend)
 
void operator-= (const GENERIC_2D_ARRAY< T > &minuend)
 
void operator+= (const T &addend)
 
void operator*= (const T &factor)
 
void Clip (const T &rangemin, const T &rangemax)
 
bool WithinBounds (const T &rangemin, const T &rangemax) const
 
double Normalize ()
 
Max () const
 
MaxAbs () const
 
void SumSquares (const GENERIC_2D_ARRAY< T > &src, const T &decay_factor)
 
void AdamUpdate (const GENERIC_2D_ARRAY< T > &sum, const GENERIC_2D_ARRAY< T > &sqsum, const T &epsilon)
 
void AssertFinite () const
 
void RotatingTranspose (const int *dims, int num_dims, int src_dim, int dest_dim, GENERIC_2D_ARRAY< T > *result) const
 
void delete_matrix_pointers ()
 

Protected Member Functions

bool SerializeSize (FILE *fp) const
 
bool SerializeSize (tesseract::TFile *fp) const
 
bool DeSerializeSize (bool swap, FILE *fp)
 
bool DeSerializeSize (tesseract::TFile *fp)
 

Protected Attributes

T * array_
 
empty_
 
int dim1_
 
int dim2_
 
int size_allocated_
 

Detailed Description

template<class T>
class GENERIC_2D_ARRAY< T >

Definition at line 26 of file intsimdmatrix.h.

Constructor & Destructor Documentation

◆ GENERIC_2D_ARRAY() [1/4]

template<class T>
GENERIC_2D_ARRAY< T >::GENERIC_2D_ARRAY ( int  dim1,
int  dim2,
const T &  empty,
T *  array 
)
inline

Definition at line 52 of file matrix.h.

54  : empty_(empty), dim1_(dim1), dim2_(dim2), array_(array) {

◆ GENERIC_2D_ARRAY() [2/4]

template<class T>
GENERIC_2D_ARRAY< T >::GENERIC_2D_ARRAY ( int  dim1,
int  dim2,
const T &  empty 
)
inline

Definition at line 58 of file matrix.h.

60  : empty_(empty), dim1_(dim1), dim2_(dim2) {
61  int new_size = dim1 * dim2;
62  array_ = new T[new_size];
63  size_allocated_ = new_size;
64  for (int i = 0; i < size_allocated_; ++i)
65  array_[i] = empty_;

◆ GENERIC_2D_ARRAY() [3/4]

template<class T>
GENERIC_2D_ARRAY< T >::GENERIC_2D_ARRAY ( )
inline

Definition at line 67 of file matrix.h.

69  : array_(nullptr), empty_(static_cast<T>(0)), dim1_(0), dim2_(0),
70  size_allocated_(0) {

◆ GENERIC_2D_ARRAY() [4/4]

template<class T>
GENERIC_2D_ARRAY< T >::GENERIC_2D_ARRAY ( const GENERIC_2D_ARRAY< T > &  src)
inline

Definition at line 71 of file matrix.h.

73  : array_(nullptr), empty_(static_cast<T>(0)), dim1_(0), dim2_(0),
74  size_allocated_(0) {
75  *this = src;

◆ ~GENERIC_2D_ARRAY()

template<class T>
virtual GENERIC_2D_ARRAY< T >::~GENERIC_2D_ARRAY ( )
inlinevirtual

Definition at line 76 of file matrix.h.

77 { delete[] array_; }

Member Function Documentation

◆ AdamUpdate()

template<class T>
void GENERIC_2D_ARRAY< T >::AdamUpdate ( const GENERIC_2D_ARRAY< T > &  sum,
const GENERIC_2D_ARRAY< T > &  sqsum,
const T &  epsilon 
)
inline

Definition at line 378 of file matrix.h.

380  {
381  int size = num_elements();
382  for (int i = 0; i < size; ++i) {
383  array_[i] += sum.array_[i] / (sqrt(sqsum.array_[i]) + epsilon);
384  }

◆ AssertFinite()

template<class T>
void GENERIC_2D_ARRAY< T >::AssertFinite ( ) const
inline

Definition at line 386 of file matrix.h.

387  {
388  int size = num_elements();
389  for (int i = 0; i < size; ++i) {
390  ASSERT_HOST(isfinite(array_[i]));
391  }

◆ Clear()

template<class T>
void GENERIC_2D_ARRAY< T >::Clear ( )
inline

Definition at line 135 of file matrix.h.

136  {
137  int total_size = num_elements();
138  for (int i = 0; i < total_size; ++i)
139  array_[i] = empty_;

◆ Clip()

template<class T>
void GENERIC_2D_ARRAY< T >::Clip ( const T &  rangemin,
const T &  rangemax 
)
inline

Definition at line 296 of file matrix.h.

297  {
298  int size = num_elements();
299  for (int i = 0; i < size; ++i) {
300  array_[i] = ClipToRange(array_[i], rangemin, rangemax);
301  }

◆ delete_matrix_pointers()

template<class T>
void GENERIC_2D_ARRAY< T >::delete_matrix_pointers ( )
inline

Definition at line 454 of file matrix.h.

455  {
456  int size = num_elements();
457  for (int i = 0; i < size; ++i) {
458  T matrix_cell = array_[i];
459  if (matrix_cell != empty_)
460  delete matrix_cell;
461  }

◆ DeSerialize() [1/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::DeSerialize ( bool  swap,
FILE *  fp 
)
inline

Definition at line 160 of file matrix.h.

161  {
162  if (!DeSerializeSize(swap, fp)) return false;
163  if (!tesseract::DeSerialize(fp, &empty_)) return false;
164  if (swap) ReverseN(&empty_, sizeof(empty_));
165  int size = num_elements();
166  if (!tesseract::DeSerialize(fp, &array_[0], size)) return false;
167  if (swap) {
168  for (int i = 0; i < size; ++i)
169  ReverseN(&array_[i], sizeof(array_[i]));
170  }
171  return true;

◆ DeSerialize() [2/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::DeSerialize ( tesseract::TFile fp)
inline

Definition at line 173 of file matrix.h.

174  {
175  return DeSerializeSize(fp) &&
176  fp->DeSerialize(&empty_) &&
177  fp->DeSerialize(&array_[0], num_elements());

◆ DeSerializeClasses()

template<class T>
bool GENERIC_2D_ARRAY< T >::DeSerializeClasses ( bool  swap,
FILE *  fp 
)
inline

Definition at line 194 of file matrix.h.

195  {
196  if (!DeSerializeSize(swap, fp)) return false;
197  if (!empty_.DeSerialize(swap, fp)) return false;
198  int size = num_elements();
199  for (int i = 0; i < size; ++i) {
200  if (!array_[i].DeSerialize(swap, fp)) return false;
201  }
202  return true;

◆ DeSerializeSize() [1/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::DeSerializeSize ( bool  swap,
FILE *  fp 
)
inlineprotected

Definition at line 479 of file matrix.h.

480  {
481  uint32_t size1, size2;
482  if (!tesseract::DeSerialize(fp, &size1)) return false;
483  if (!tesseract::DeSerialize(fp, &size2)) return false;
484  if (swap) {
485  ReverseN(&size1, sizeof(size1));
486  ReverseN(&size2, sizeof(size2));
487  }
488  // Arbitrarily limit the number of elements to protect against bad data.
489  if (size1 > UINT16_MAX) return false;
490  if (size2 > UINT16_MAX) return false;
491  Resize(size1, size2, empty_);
492  return true;

◆ DeSerializeSize() [2/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::DeSerializeSize ( tesseract::TFile fp)
inlineprotected

Definition at line 493 of file matrix.h.

494  {
495  int32_t size1, size2;
496  if (!fp->DeSerialize(&size1)) return false;
497  if (!fp->DeSerialize(&size2)) return false;
498  // Arbitrarily limit the number of elements to protect against bad data.
499  if (size1 > UINT16_MAX) return false;
500  if (size2 > UINT16_MAX) return false;
501  Resize(size1, size2, empty_);
502  return true;

◆ dim1()

template<class T>
int GENERIC_2D_ARRAY< T >::dim1 ( ) const
inline

Definition at line 205 of file matrix.h.

206 { return dim1_; }

◆ dim2()

template<class T>
int GENERIC_2D_ARRAY< T >::dim2 ( ) const
inline

Definition at line 206 of file matrix.h.

206 { return dim1_; }

◆ get() [1/2]

template<class T>
T GENERIC_2D_ARRAY< T >::get ( ICOORD  pos) const
inline

Definition at line 227 of file matrix.h.

228  {
229  return array_[this->index(pos.x(), pos.y())];

◆ get() [2/2]

template<class T>
T GENERIC_2D_ARRAY< T >::get ( int  column,
int  row 
) const
inline

Definition at line 230 of file matrix.h.

231  {
232  return array_[this->index(column, row)];

◆ index()

template<class T>
virtual int GENERIC_2D_ARRAY< T >::index ( int  column,
int  row 
) const
inlinevirtual

Reimplemented in BandTriMatrix< T >, and BandTriMatrix< BLOB_CHOICE_LIST * >.

Definition at line 214 of file matrix.h.

215  {
216  return (column * dim2_ + row);

◆ Max()

template<class T>
T GENERIC_2D_ARRAY< T >::Max ( ) const
inline

Definition at line 341 of file matrix.h.

342  {
343  int size = num_elements();
344  if (size <= 0) return empty_;
345  // Compute the max.
346  T max_value = array_[0];
347  for (int i = 1; i < size; ++i) {
348  const T& value = array_[i];
349  if (value > max_value) max_value = value;
350  }
351  return max_value;

◆ MaxAbs()

template<class T>
T GENERIC_2D_ARRAY< T >::MaxAbs ( ) const
inline

Definition at line 354 of file matrix.h.

355  {
356  int size = num_elements();
357  if (size <= 0) return empty_;
358  // Compute the max.
359  T max_abs = static_cast<T>(0);
360  for (int i = 0; i < size; ++i) {
361  T value = static_cast<T>(fabs(array_[i]));
362  if (value > max_abs) max_abs = value;
363  }
364  return max_abs;

◆ Normalize()

template<class T>
double GENERIC_2D_ARRAY< T >::Normalize ( )
inline

Definition at line 314 of file matrix.h.

315  {
316  int size = num_elements();
317  if (size <= 0) return 0.0;
318  // Compute the mean.
319  double mean = 0.0;
320  for (int i = 0; i < size; ++i) {
321  mean += array_[i];
322  }
323  mean /= size;
324  // Subtract the mean and compute the standard deviation.
325  double sd = 0.0;
326  for (int i = 0; i < size; ++i) {
327  double normed = array_[i] - mean;
328  array_[i] = normed;
329  sd += normed * normed;
330  }
331  sd = sqrt(sd / size);
332  if (sd > 0.0) {
333  // Divide by the sd.
334  for (int i = 0; i < size; ++i) {
335  array_[i] /= sd;
336  }
337  }
338  return sd;

◆ num_elements()

template<class T>
virtual int GENERIC_2D_ARRAY< T >::num_elements ( ) const
inlinevirtual

Definition at line 209 of file matrix.h.

210 { return dim1_ * dim2_; }

◆ operator()() [1/2]

template<class T>
T& GENERIC_2D_ARRAY< T >::operator() ( int  column,
int  row 
)
inline

Definition at line 237 of file matrix.h.

238  {
239  return array_[this->index(column, row)];

◆ operator()() [2/2]

template<class T>
const T& GENERIC_2D_ARRAY< T >::operator() ( int  column,
int  row 
) const
inline

Definition at line 234 of file matrix.h.

235  {
236  return array_[this->index(column, row)];

◆ operator*=()

template<class T>
void GENERIC_2D_ARRAY< T >::operator*= ( const T &  factor)
inline

Definition at line 289 of file matrix.h.

290  {
291  int size = num_elements();
292  for (int i = 0; i < size; ++i) {
293  array_[i] *= factor;
294  }

◆ operator+=() [1/2]

template<class T>
void GENERIC_2D_ARRAY< T >::operator+= ( const GENERIC_2D_ARRAY< T > &  addend)
inline

Definition at line 250 of file matrix.h.

251  {
252  if (dim2_ == addend.dim2_) {
253  // Faster if equal size in the major dimension.
254  int size = std::min(num_elements(), addend.num_elements());
255  for (int i = 0; i < size; ++i) {
256  array_[i] += addend.array_[i];
257  }
258  } else {
259  for (int x = 0; x < dim1_; x++) {
260  for (int y = 0; y < dim2_; y++) {
261  (*this)(x, y) += addend(x, y);
262  }
263  }
264  }

◆ operator+=() [2/2]

template<class T>
void GENERIC_2D_ARRAY< T >::operator+= ( const T &  addend)
inline

Definition at line 282 of file matrix.h.

283  {
284  int size = num_elements();
285  for (int i = 0; i < size; ++i) {
286  array_[i] += addend;
287  }

◆ operator-=()

template<class T>
void GENERIC_2D_ARRAY< T >::operator-= ( const GENERIC_2D_ARRAY< T > &  minuend)
inline

Definition at line 266 of file matrix.h.

267  {
268  if (dim2_ == minuend.dim2_) {
269  // Faster if equal size in the major dimension.
270  int size = std::min(num_elements(), minuend.num_elements());
271  for (int i = 0; i < size; ++i) {
272  array_[i] -= minuend.array_[i];
273  }
274  } else {
275  for (int x = 0; x < dim1_; x++) {
276  for (int y = 0; y < dim2_; y++) {
277  (*this)(x, y) -= minuend(x, y);
278  }
279  }
280  }

◆ operator=()

template<class T>
void GENERIC_2D_ARRAY< T >::operator= ( const GENERIC_2D_ARRAY< T > &  src)
inline

Definition at line 78 of file matrix.h.

79  {
80  ResizeNoInit(src.dim1(), src.dim2());
81  int size = num_elements();
82  if (size > 0) {
83  memcpy(array_, src.array_, size * sizeof(array_[0]));
84  }

◆ operator[]() [1/2]

template<class T>
T* GENERIC_2D_ARRAY< T >::operator[] ( int  column)
inline

Definition at line 242 of file matrix.h.

243  {
244  return &array_[this->index(column, 0)];

◆ operator[]() [2/2]

template<class T>
const T* GENERIC_2D_ARRAY< T >::operator[] ( int  column) const
inline

Definition at line 245 of file matrix.h.

246  {
247  return &array_[this->index(column, 0)];

◆ put() [1/2]

template<class T>
void GENERIC_2D_ARRAY< T >::put ( ICOORD  pos,
const T &  thing 
)
inline

Definition at line 219 of file matrix.h.

220  {
221  array_[this->index(pos.x(), pos.y())] = thing;

◆ put() [2/2]

template<class T>
void GENERIC_2D_ARRAY< T >::put ( int  column,
int  row,
const T &  thing 
)
inline

Definition at line 222 of file matrix.h.

223  {
224  array_[this->index(column, row)] = thing;

◆ Resize()

template<class T>
void GENERIC_2D_ARRAY< T >::Resize ( int  size1,
int  size2,
const T &  empty 
)
inline

Definition at line 104 of file matrix.h.

105  {
106  empty_ = empty;
107  ResizeNoInit(size1, size2);
108  Clear();

◆ ResizeNoInit()

template<class T>
void GENERIC_2D_ARRAY< T >::ResizeNoInit ( int  size1,
int  size2,
int  pad = 0 
)
inline

Definition at line 90 of file matrix.h.

91  {
92  int new_size = size1 * size2 + pad;
93  if (new_size > size_allocated_) {
94  delete [] array_;
95  array_ = new T[new_size];
96  size_allocated_ = new_size;
97  }
98  dim1_ = size1;
99  dim2_ = size2;
100  // Fill the padding data so it isn't uninitialized.
101  for (int i = size1 * size2; i < new_size; ++i) array_[i] = empty_;

◆ ResizeWithCopy()

template<class T>
void GENERIC_2D_ARRAY< T >::ResizeWithCopy ( int  size1,
int  size2 
)
inline

Definition at line 111 of file matrix.h.

112  {
113  if (size1 != dim1_ || size2 != dim2_) {
114  int new_size = size1 * size2;
115  T* new_array = new T[new_size];
116  for (int col = 0; col < size1; ++col) {
117  for (int row = 0; row < size2; ++row) {
118  int old_index = col * dim2() + row;
119  int new_index = col * size2 + row;
120  if (col < dim1_ && row < dim2_) {
121  new_array[new_index] = array_[old_index];
122  } else {
123  new_array[new_index] = empty_;
124  }
125  }
126  }
127  delete[] array_;
128  array_ = new_array;
129  dim1_ = size1;
130  dim2_ = size2;
131  size_allocated_ = new_size;
132  }

◆ RotatingTranspose()

template<class T>
void GENERIC_2D_ARRAY< T >::RotatingTranspose ( const int *  dims,
int  num_dims,
int  src_dim,
int  dest_dim,
GENERIC_2D_ARRAY< T > *  result 
) const
inline

Definition at line 417 of file matrix.h.

419  {
420  int max_d = std::max(src_dim, dest_dim);
421  int min_d = std::min(src_dim, dest_dim);
422  // In a tensor of shape [d0, d1... min_d, ... max_d, ... dn-2, dn-1], the
423  // ends outside of min_d and max_d are unaffected, with [max_d +1, dn-1]
424  // being contiguous blocks of data that will move together, and
425  // [d0, min_d -1] being replicas of the transpose operation.
426  // num_replicas represents the large dimensions unchanged by the operation.
427  // move_size represents the small dimensions unchanged by the operation.
428  // src_step represents the stride in the src between each adjacent group
429  // in the destination.
430  int num_replicas = 1, move_size = 1, src_step = 1;
431  for (int d = 0; d < min_d; ++d) num_replicas *= dims[d];
432  for (int d = max_d + 1; d < num_dims; ++d) move_size *= dims[d];
433  for (int d = src_dim + 1; d < num_dims; ++d) src_step *= dims[d];
434  if (src_dim > dest_dim) src_step *= dims[src_dim];
435  // wrap_size is the size of a single replica, being the amount that is
436  // handled num_replicas times.
437  int wrap_size = move_size;
438  for (int d = min_d; d <= max_d; ++d) wrap_size *= dims[d];
439  result->ResizeNoInit(dim1_, dim2_);
440  result->empty_ = empty_;
441  const T* src = array_;
442  T* dest = result->array_;
443  for (int replica = 0; replica < num_replicas; ++replica) {
444  for (int start = 0; start < src_step; start += move_size) {
445  for (int pos = start; pos < wrap_size; pos += src_step) {
446  memcpy(dest, src + pos, sizeof(*dest) * move_size);
447  dest += move_size;
448  }
449  }
450  src += wrap_size;
451  }

◆ Serialize() [1/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::Serialize ( FILE *  fp) const
inline

Definition at line 143 of file matrix.h.

144  {
145  if (!SerializeSize(fp)) return false;
146  if (!tesseract::Serialize(fp, &empty_)) return false;
147  int size = num_elements();
148  return tesseract::Serialize(fp, &array_[0], size);

◆ Serialize() [2/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::Serialize ( tesseract::TFile fp) const
inline

Definition at line 150 of file matrix.h.

151  {
152  if (!SerializeSize(fp)) return false;
153  if (!fp->Serialize(&empty_)) return false;
154  int size = num_elements();
155  return fp->Serialize(&array_[0], size);

◆ SerializeClasses()

template<class T>
bool GENERIC_2D_ARRAY< T >::SerializeClasses ( FILE *  fp) const
inline

Definition at line 181 of file matrix.h.

182  {
183  if (!SerializeSize(fp)) return false;
184  if (!empty_.Serialize(fp)) return false;
185  int size = num_elements();
186  for (int i = 0; i < size; ++i) {
187  if (!array_[i].Serialize(fp)) return false;
188  }
189  return true;

◆ SerializeSize() [1/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::SerializeSize ( FILE *  fp) const
inlineprotected

Definition at line 465 of file matrix.h.

466  {
467  uint32_t size = dim1_;
468  if (!tesseract::Serialize(fp, &size)) return false;
469  size = dim2_;
470  return tesseract::Serialize(fp, &size);

◆ SerializeSize() [2/2]

template<class T>
bool GENERIC_2D_ARRAY< T >::SerializeSize ( tesseract::TFile fp) const
inlineprotected

Definition at line 471 of file matrix.h.

472  {
473  uint32_t size = dim1_;
474  if (!fp->Serialize(&size)) return false;
475  size = dim2_;
476  return fp->Serialize(&size);

◆ SumSquares()

template<class T>
void GENERIC_2D_ARRAY< T >::SumSquares ( const GENERIC_2D_ARRAY< T > &  src,
const T &  decay_factor 
)
inline

Definition at line 367 of file matrix.h.

368  {
369  T update_factor = 1.0 - decay_factor;
370  int size = num_elements();
371  for (int i = 0; i < size; ++i) {
372  array_[i] = array_[i] * decay_factor +
373  update_factor * src.array_[i] * src.array_[i];
374  }

◆ WithinBounds()

template<class T>
bool GENERIC_2D_ARRAY< T >::WithinBounds ( const T &  rangemin,
const T &  rangemax 
) const
inline

Definition at line 304 of file matrix.h.

305  {
306  int size = num_elements();
307  for (int i = 0; i < size; ++i) {
308  const T& value = array_[i];
309  if (value < rangemin || rangemax < value)
310  return false;
311  }
312  return true;

Member Data Documentation

◆ array_

template<class T>
T* GENERIC_2D_ARRAY< T >::array_
protected

Definition at line 504 of file matrix.h.

◆ dim1_

template<class T>
int GENERIC_2D_ARRAY< T >::dim1_
protected

Definition at line 506 of file matrix.h.

◆ dim2_

template<class T>
int GENERIC_2D_ARRAY< T >::dim2_
protected

Definition at line 507 of file matrix.h.

◆ empty_

template<class T>
T GENERIC_2D_ARRAY< T >::empty_
protected

Definition at line 505 of file matrix.h.

◆ size_allocated_

template<class T>
int GENERIC_2D_ARRAY< T >::size_allocated_
protected

Definition at line 511 of file matrix.h.


The documentation for this class was generated from the following files:
GENERIC_2D_ARRAY::DeSerializeSize
bool DeSerializeSize(bool swap, FILE *fp)
Definition: matrix.h:479
ClipToRange
T ClipToRange(const T &x, const T &lower_bound, const T &upper_bound)
Definition: helpers.h:106
ASSERT_HOST
#define ASSERT_HOST(x)
Definition: errcode.h:87
GENERIC_2D_ARRAY::array_
T * array_
Definition: matrix.h:504
GENERIC_2D_ARRAY::DeSerialize
bool DeSerialize(bool swap, FILE *fp)
Definition: matrix.h:160
GENERIC_2D_ARRAY::size_allocated_
int size_allocated_
Definition: matrix.h:511
ICOORD::x
int16_t x() const
access function
Definition: points.h:51
GENERIC_2D_ARRAY::num_elements
virtual int num_elements() const
Definition: matrix.h:209
GENERIC_2D_ARRAY::SerializeSize
bool SerializeSize(FILE *fp) const
Definition: matrix.h:465
GENERIC_2D_ARRAY::dim2
int dim2() const
Definition: matrix.h:206
tesseract::TFile::DeSerialize
bool DeSerialize(char *data, size_t count=1)
Definition: serialis.cpp:117
GENERIC_2D_ARRAY::index
virtual int index(int column, int row) const
Definition: matrix.h:214
tesseract::TFile::Serialize
bool Serialize(const char *data, size_t count=1)
Definition: serialis.cpp:161
GENERIC_2D_ARRAY::ResizeNoInit
void ResizeNoInit(int size1, int size2, int pad=0)
Definition: matrix.h:90
GENERIC_2D_ARRAY::dim2_
int dim2_
Definition: matrix.h:507
GENERIC_2D_ARRAY::Clear
void Clear()
Definition: matrix.h:135
GENERIC_2D_ARRAY::dim1_
int dim1_
Definition: matrix.h:506
GENERIC_2D_ARRAY::Serialize
bool Serialize(FILE *fp) const
Definition: matrix.h:143
tesstrain_utils.dest
dest
Definition: tesstrain_utils.py:139
GENERIC_2D_ARRAY::Resize
void Resize(int size1, int size2, const T &empty)
Definition: matrix.h:104
GENERIC_2D_ARRAY::empty_
T empty_
Definition: matrix.h:505
ReverseN
void ReverseN(void *ptr, int num_bytes)
Definition: helpers.h:183
tesseract::DeSerialize
bool DeSerialize(FILE *fp, char *data, size_t n=1)
Definition: serialis.cpp:41
tesseract::Serialize
bool Serialize(FILE *fp, const char *data, size_t n=1)
Definition: serialis.cpp:73
GENERIC_2D_ARRAY::dim1
int dim1() const
Definition: matrix.h:205
ICOORD::y
int16_t y() const
access_function
Definition: points.h:55