Exemplo n.º 1
0
        public override void Load(BinaryReader reader)
        {
            qnorm_    = reader.ReadBoolean();
            m_        = reader.ReadInt64();
            n_        = reader.ReadInt64();
            codesize_ = reader.ReadInt32();

            codes_ = new byte[codesize_];
            for (int i = 0; i < codesize_; i++)
            {
                codes_[i] = reader.ReadByte();
            }

            pq_ = new ProductQuantizer();
            pq_.Load(reader);

            if (qnorm_)
            {
                norm_codes_ = new byte[m_];

                for (int i = 0; i < m_; i++)
                {
                    norm_codes_[i] = reader.ReadByte();
                }

                npq_ = new ProductQuantizer();
                npq_.Load(reader);
            }
        }
Exemplo n.º 2
0
        public QuantMatrix(DenseMatrix mat, int dsub, bool qnorm)
            : base(mat.Size(0), mat.Size(1))
        {
            qnorm_    = qnorm;
            codesize_ = (int)(mat.Size(0) * ((mat.Size(1) + dsub - 1) / dsub));
            codes_    = new byte[codesize_];
            pq_       = new ProductQuantizer((int)n_, dsub);

            if (qnorm_)
            {
                norm_codes_ = new byte[m_];
                npq_        = new ProductQuantizer(1, 1);
            }

            Quantize(mat);
        }