Add const attributes to IntSimMatrix multiplier

IntSimMatrix no longer contains variable members.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2019-01-12 08:05:25 +01:00
parent 7c70147701
commit e237a38405
5 changed files with 6 additions and 6 deletions

View File

@ -28,8 +28,8 @@ namespace tesseract {
// Factory makes and returns an IntSimdMatrix (sub)class of the best
// available type for the current architecture.
/* static */
IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
IntSimdMatrix* multiplier;
const IntSimdMatrix* IntSimdMatrix::GetFastestMultiplier() {
const IntSimdMatrix* multiplier;
if (SIMDDetect::IsAVX2Available()) {
multiplier = new IntSimdMatrixAVX2();
} else if (SIMDDetect::IsSSEAvailable()) {

View File

@ -71,7 +71,7 @@ class IntSimdMatrix {
// Factory makes and returns an IntSimdMatrix (sub)class of the best
// available type for the current architecture.
static IntSimdMatrix* GetFastestMultiplier();
static const IntSimdMatrix* GetFastestMultiplier();
// Computes a reshaped copy of the weight matrix w. If there are no
// partial_funcs_, it does nothing.

View File

@ -34,7 +34,7 @@ const float kMinProb = exp(kMinCertainty);
// Holds the optimal integer multiplier for this machine.
// This is a leaked, lazily initialized singleton, and is used for computing
// padding to apply to i_ for SIMD use.
IntSimdMatrix* NetworkIO::multiplier_ = nullptr;
const IntSimdMatrix* NetworkIO::multiplier_ = nullptr;
// Resizes to a specific size as a 2-d temp buffer. No batches, no y-dim.
void NetworkIO::Resize2d(bool int_mode, int width, int num_features) {

View File

@ -341,7 +341,7 @@ class NetworkIO {
// Holds the optimal integer multiplier for this machine.
// This is a leaked, lazily initialized singleton, and is used for computing
// padding to apply to i_ for SIMD use.
static IntSimdMatrix* multiplier_;
static const IntSimdMatrix* multiplier_;
};
} // namespace tesseract.

View File

@ -179,7 +179,7 @@ class WeightMatrix {
// The weights matrix reorganized in whatever way suits this instance.
std::vector<int8_t> shaped_w_;
// Holds the optimal integer multiplier for this machine.
std::unique_ptr<IntSimdMatrix> multiplier_;
std::unique_ptr<const IntSimdMatrix> multiplier_;
};
} // namespace tesseract.