#include <ErrorMatrixCompressor.h>
Definition at line 124 of file ErrorMatrixCompressor.h.
◆ ErrorMatrixCompressor()
ErrorMatrixCompressor::ErrorMatrixCompressor |
( |
int |
b | ) |
|
Definition at line 82 of file ErrorMatrixCompressor.cxx.
84 short int biasArray[6] = {116,120,118,116,116,102};
87 double T[5]={0.2,0.5,100.0,100.0,20000.0};
◆ ~ErrorMatrixCompressor()
ErrorMatrixCompressor::~ErrorMatrixCompressor |
( |
| ) |
|
|
inline |
◆ CholeskyDecomposition()
bool ErrorMatrixCompressor::CholeskyDecomposition |
( |
double |
a[5][5], |
|
|
double |
L[5][5] |
|
) |
| |
|
protected |
◆ compress()
bool ErrorMatrixCompressor::compress |
( |
const std::vector< double > & |
src, |
|
|
std::vector< unsigned int > & |
dest |
|
) |
| |
Definition at line 173 of file ErrorMatrixCompressor.cxx.
176 double L[5][5],C0[5][5],
C[5][5];
186 C[j][
i]=C0[
i][j]=C0[j][
i]=
C[
i][j];
190 memset(&L[0][0],0,
sizeof(L));
199 memset(&
S[0][0],0,
sizeof(
S));
201 for(j=0;j<=
i;j++)
S[
i][j]=L[
i][j];
203 std::vector<FloatRep> vecFR;
211 char sign=(
S[
i][j]<0)?1:0;
217 std::vector<unsigned short> vShorts;
226 unsigned int buffer = 0x00000000;
◆ compressFR()
bool ErrorMatrixCompressor::compressFR |
( |
const std::vector< FloatRep > & |
src, |
|
|
std::vector< unsigned short > & |
dest |
|
) |
| |
|
protected |
Definition at line 308 of file ErrorMatrixCompressor.cxx.
310 unsigned short buf=0x0000;
315 std::cout<<
"Requested mantissa reduction is too large: 23->"<<nMantLength<<std::endl;
318 std::vector<FloatRep>::const_iterator fIt;
332 unsigned short int ex=(*fIt).exponent();
333 unsigned int mant=(*fIt).mantissa();
345 if((ex!=0)&&(mant!=0))
347 if((ex<bias)||(ex-bias>
limit))
362 i2[0]=(*trIt).m_nd1;i2[1]=(*trIt).m_nd2;
368 buf =
buf | ((
e<<12) & 0xF000);
369 if((
src[i2[0]].exponent()==0)&&(
src[i2[0]].mantissa()==0))
371 e=
src[i2[0]].exponent();
381 if((
src[i2[1]].exponent()==0)&&(
src[i2[1]].mantissa()==0))
384 e=
src[i2[1]].exponent();
399 unsigned int nPacked=0;
400 int nFreeBits=0,nBitsToStore=0,nBufferLength=0;
401 unsigned int srcBuffer=0x00000000;
403 while (nPacked<=
src.size()+1)
420 if(fIt==
src.end())
break;
422 srcBuffer=((*fIt).mantissa()<<9);
424 nBitsToStore=nMantLength;
426 int Np=(nBitsToStore>nFreeBits)?nFreeBits:nBitsToStore;
429 slice = (
slice >> (32-nFreeBits)) & 0x0000FFFF;
433 srcBuffer = srcBuffer << Np;
◆ restore()
bool ErrorMatrixCompressor::restore |
( |
const std::vector< unsigned int > & |
src, |
|
|
std::vector< double > & |
dest |
|
) |
| |
Definition at line 249 of file ErrorMatrixCompressor.cxx.
253 double L[5][5],
C[5][5];
257 std::vector<FloatRep> vecFR;
260 std::vector<unsigned short> vShorts;
264 for (
unsigned int ii :
src) {
265 unsigned short s1,
s2;
267 s1 = (
unsigned short)((0xFFFF0000 & ii) >> 16);
268 s2 = (
unsigned short)(0x0000FFFF & ii);
269 vShorts.push_back(
s1);
271 vShorts.push_back(
s2);
274 if(!
restoreFR(vShorts,vecFR))
return false;
277 memset(&
S[0][0],0,
sizeof(
S));
281 if(fIt==vecFR.end())
break;
282 S[
i][j]=(*fIt).restore();
286 memset(&L[0][0],0,
sizeof(L));
288 for(j=0;j<=
i;j++) L[
i][j]=
S[
i][j];
294 C[
i][j]+=L[
i][
k]*L[j][
k];
303 for(
i=0;
i<5;
i++)
for(j=0;j<=
i;j++)
dest.push_back(
C[
i][j]);
◆ restoreFR()
bool ErrorMatrixCompressor::restoreFR |
( |
const std::vector< unsigned short > & |
src, |
|
|
std::vector< FloatRep > & |
dest |
|
) |
| |
|
protected |
Definition at line 444 of file ErrorMatrixCompressor.cxx.
446 int i,nRestored,nFreeBits,nBitsToStore;
447 unsigned short buf=0x0000;
448 unsigned int destBuffer=0x00000000;
449 std::vector<unsigned short>::const_iterator uIt(
src.begin());
458 for(;uIt!=
src.end();++uIt)
464 char s=((
buf & 0x0800)==0)?0:1;
466 s=((
buf & 0x0020)==0)?0:1;
468 unsigned short e = ((
buf & 0xF000) >> 12);
470 e = ((
buf & 0x07C0) >> 6);
477 if(
i<5)
return false;
491 dest[nRestored-1].mantissa(destBuffer);
494 destBuffer=0x00000000;
495 nFreeBits=nMantLength;
499 if(uIt==
src.end())
break;
506 nBitsToStore=16;
buf=(*uIt);
508 int Np=(nFreeBits>nBitsToStore) ? nBitsToStore : nFreeBits;
511 buf = (
unsigned int)((buf << Np) & 0x0000FFFF);
515 destBuffer = destBuffer << Np;
517 destBuffer = destBuffer |
tmp;
◆ setBiases()
void ErrorMatrixCompressor::setBiases |
( |
const int |
b[6] | ) |
|
◆ setUpperLimits()
void ErrorMatrixCompressor::setUpperLimits |
( |
const int |
l[2] | ) |
|
◆ m_biases
short int ErrorMatrixCompressor::m_biases[6] |
|
protected |
◆ m_bitStrip
int ErrorMatrixCompressor::m_bitStrip |
|
protected |
◆ m_decoder
◆ m_limits
short int ErrorMatrixCompressor::m_limits[2] |
|
protected |
◆ m_scales
double ErrorMatrixCompressor::m_scales[5] |
|
protected |
◆ m_srcMasks
unsigned int ErrorMatrixCompressor::m_srcMasks[16] |
|
private |
◆ m_tripVec
std::vector<Triplet> ErrorMatrixCompressor::m_tripVec |
|
private |
The documentation for this class was generated from the following files: