async readNormExpectedValuesAndNormVectorIndex() {

        await this.init()

        if (this.normExpectedValueVectorsPosition === undefined) {
            return;
        }

        const nviStart = await this.skipExpectedValues(this.normExpectedValueVectorsPosition)
        let byteCount = 4;

        let data = await this.file.read(nviStart, 4);
        if (data.byteLength === 0) {
            // This is possible if there are no norm vectors.  Its a legal v8 file, though uncommon
            return;
        }
        const binaryParser = new BinaryParser(new DataView(data));
        const nEntries = binaryParser.getInt();
        const sizeEstimate = nEntries * 30;
        const range = {start: nviStart + byteCount, size: sizeEstimate}

        data = await this.file.read(range.start, range.size)
        this.normalizedExpectedValueVectors = {};
        this.normVectorIndex = {};

        // Recursively process entries
        await processEntries.call(this, nEntries, data)

        this.config.nvi = nviStart.toString() + "," + byteCount

        async function processEntries(nEntries, data) {

            const binaryParser = new BinaryParser(new DataView(data));

            while (nEntries-- > 0) {

                if (binaryParser.available() < 100) {

                    nEntries++;   // Reset counter as entry is not processed

                    byteCount += binaryParser.position;
                    const sizeEstimate = Math.max(1000, nEntries * 30);
                    const range = {start: nviStart + byteCount, size: sizeEstimate}
                    const data = await this.file.read(range.start, range.size)
                    return processEntries.call(this, nEntries, data);
                }

                this.parseNormVectorEntry(binaryParser)

            }
            byteCount += binaryParser.position;
        }
    }
/**
     * This function is used when the position of the norm vector index is unknown.  We must read through the expected
     * values to find the index
     *
     * @param dataset
     * @returns {Promise}
     */
This function is used when the position of the norm vector index is unknown.  We must read through the expected
values to find the index

@param dataset
@returns {Promise}
This function is used when the position of the norm vector index is unknown . We must read through the expected values to find the index @param dataset @returns { Promise }
async readNormExpectedValuesAndNormVectorIndex() {
        await this.init()
        if (this.normExpectedValueVectorsPosition === undefined) {
            return;
        }
        const nviStart = await this.skipExpectedValues(this.normExpectedValueVectorsPosition)
        let byteCount = 4;
        let data = await this.file.read(nviStart, 4);
        if (data.byteLength === 0) {
            return;
        }
        const binaryParser = new BinaryParser(new DataView(data));
        const nEntries = binaryParser.getInt();
        const sizeEstimate = nEntries * 30;
        const range = {start: nviStart + byteCount, size: sizeEstimate}
        data = await this.file.read(range.start, range.size)
        this.normalizedExpectedValueVectors = {};
        this.normVectorIndex = {};
        await processEntries.call(this, nEntries, data)
        this.config.nvi = nviStart.toString() + "," + byteCount
        async function processEntries(nEntries, data) {
            const binaryParser = new BinaryParser(new DataView(data));
            while (nEntries-- > 0) {
                if (binaryParser.available() < 100) {
                    nEntries++;   
                    byteCount += binaryParser.position;
                    const sizeEstimate = Math.max(1000, nEntries * 30);
                    const range = {start: nviStart + byteCount, size: sizeEstimate}
                    const data = await this.file.read(range.start, range.size)
                    return processEntries.call(this, nEntries, data);
                }
                this.parseNormVectorEntry(binaryParser)
            }
            byteCount += binaryParser.position;
        }
    }
async readNormExpectedValuesAndNormVectorIndex ( ) { await this . init ( ) if ( this . normExpectedValueVectorsPosition === undefined ) { return ; } const nviStart = await this . skipExpectedValues ( this . normExpectedValueVectorsPosition ) let byteCount = 4 ; let data = await this . file . read ( nviStart , 4 ) ; if ( data . byteLength === 0 ) { return ; } const binaryParser = new BinaryParser ( new DataView ( data ) ) ; const nEntries = binaryParser . getInt ( ) ; const sizeEstimate = nEntries * 30 ; const range = { start : nviStart + byteCount , size : sizeEstimate } data = await this . file . read ( range . start , range . size ) this . normalizedExpectedValueVectors = { } ; this . normVectorIndex = { } ; await processEntries . call ( this , nEntries , data ) this . config . nvi = nviStart . toString ( ) + "," + byteCount async function processEntries ( nEntries , data ) { const binaryParser = new BinaryParser ( new DataView ( data ) ) ; while ( nEntries -- > 0 ) { if ( binaryParser . available ( ) < 100 ) { nEntries ++ ; byteCount += binaryParser . position ; const sizeEstimate = Math . max ( 1000 , nEntries * 30 ) ; const range = { start : nviStart + byteCount , size : sizeEstimate } const data = await this . file . read ( range . start , range . size ) return processEntries . call ( this , nEntries , data ) ; } this . parseNormVectorEntry ( binaryParser ) } byteCount += binaryParser . position ; } }
This function is used when the position of the norm vector index is unknown.
This function is used when the position of the norm vector index is unknown .
// This is possible if there are no norm vectors.  Its a legal v8 file, though uncommon // Recursively process entries // Reset counter as entry is not processed