ArrayAlign | ArrayAlignHierarchy | ArrayAlign_ConstantRange | ArrayAlign_Equal | ArrayAlign_Multiply | ArrayAlign_PermutationCycle | ArrayAlign_Power | AudivolvNetwork | AudivolvSummary | Brainwaves | CodeSimian | CodeTree | Func | FuncPurpose_MeasureOtherFunc | FuncPurpose_SoundColorMouse | FuncPurpose_Unknown | HardCoded_CodeTree_BreedFunction | HeapQueue | HighStandards | Hypercube | Javassist | LongTermGoalsOfAudivolvDesign | MindReadingHelmet | MovementScore | NeatVsScruffy | NoSpying | Node | NormedCodeTree | PermutationCompilerAndInterpreter | Plugin | ShortTermGoalsOfAudivolvDesign | SoundCardPart | Template | TuringTests_per_second | flo | int | ob

Audivolv - HeapQueue


HeapQueue{
    Normally goes in a Node as 3 arrays (int[], int[], and flo[]), often permutation-aligned to more arrays in the same Node.
    int arrays: hqForward and hqBackward = ArrayAlign_PermutationCycle ( quantityOfIntArrays=2, sizeOfEachIntArray=Y ) ;
    hqWeight = flo array size Y, aligned to hqBackward.
    hqIdeaOfSorted = For every nonzero index x in hqForward, hqWeight[hqForward[round down x/2]] >= hqWeight[hqForward[x]].
    TODO Choose between consistent design (all 3 arrays are the same size) and efficiency (1 of the arrays does not use index 0).
    The 2 childs of index x are 2*x and 2*x+1, unless those are past the end of the array.
    The only exception is the 2 childs of index 0 are 0 and 1. 0 is its own parent and child, for efficiency.
    hqBackward[] and hqWeight[] are aligned to eachother and often other arrays in the same Node.
    When any flo in hqWeight changes{
        Approximately log(sizeOfEachIntArray)/2 quantity of ints in hqForward and hqBackward change.
        Because hqForward and hqBackward point at eachother, they always change 4 at a time, swapping 2 pairs of int.
        It changes to make hqIdeaOfSorted be true again. It runs recursively from the one that changed to its parent or a child.
    }
    Example{
        Iterate over 1000000 Nodes in a neural-network, where activation-level of each Node is in a shared HeapQueue,
        and for each Node, if it fires, update activation-level of all its child Nodes in the shared HeapQueue.
        Each iteration starts with the Node index hqForward[0], the Node with highest activation-level.
        Because that Node fires, its activation-level decreases, and hqForward[some other index] points at it instead.
    }
}

REVERSE LINKS: LongTermGoalsOfAudivolvDesign AUDIVOLV WEBSITES: http://audivolv.com | http://audivolv.sourceforge.net | http://audioevolve.com | http://instrumentsplaythemusicians.com