public EncoderThreadObj(CodeBook codeBook, IDataMatrix<float> dataMatrix, IDataMatrixBuilderRam<ushort> matrixBuilder) { //temporary data used by encoding one data group this.cDataSize = dataMatrix.NumCols; this.codedRow = new ushort[this.cDataSize]; //input data this.dataMatrix = dataMatrix; this.codeBook = codeBook; //store the encoded features this.matrixBuilder = matrixBuilder; }
private IDataMatrix<ushort> EncodeFeatureValues(IDataMatrix<float> dataMatrix, CodeBook codeBook, int cThreads, bool fSparse) { //construct the matrix builder given if we want to have dense or sparse representations or not IDataMatrixBuilderRam<ushort> dataMatrixBuilderRam; if (fSparse) { dataMatrixBuilderRam = new DataMatrixBuilderRamSparse<ushort>(dataMatrix.NumRows, dataMatrix.NumCols, 0); } else { dataMatrixBuilderRam = new DataMatrixBuilderRamDense<ushort>(dataMatrix.NumRows, dataMatrix.NumCols); } MatrixEncoder matrixEncoder = new MatrixEncoder(dataMatrix, codeBook, dataMatrixBuilderRam); ProcessorMT processorMT = new ProcessorMT(matrixEncoder, cThreads); #if QUANTIZER_TIMER System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch(); #if VERBOSE Console.WriteLine("Starting encoding timer..."); #endif timer.Start(); #endif processorMT.Process(); #if QUANTIZER_TIMER timer.Stop(); #if VERBOSE Console.WriteLine("Total encoding time: {0} seconds", 0.001 * timer.ElapsedMilliseconds); #endif #endif return matrixEncoder.CodedMatrix; }
public MatrixEncoder(IDataMatrix<float> dataMatrix, CodeBook codeBook, IDataMatrixBuilderRam<ushort> matrixBuilder) { this.dataMatix = dataMatrix; this.codeBook = codeBook; this.matrixBuilder = matrixBuilder; }