The collapse Java SequenceIterator methods operate on the object's sequence and the input sequence, left and right, to produce the computed scalar result of type
double.The method signatures are of the following form (where
opis the indicated operation):public SequenceIterator op(SequenceIterator weights)The following table lists the available collapse methods:
public SequenceIterator wsum(SequenceIterator weights)Calculates the weighted sum of the two sequences.public SequenceIterator wavg(SequenceIterator weights)Calculates the weighted average of the two sequences.public SequenceIterator cov(SequenceIterator other)Calculates the covariance of the two sequences.public SequenceIterator corr(SequenceIterator other)Calculates the correlation of the two sequences.Example
Following is an example code snippet demonstrating a collapse function:
{ ... SequenceIterator high = quote.high.iterator(); SequenceIterator low = quote.low.iterator(); // Calculate the correlation between low and high SequenceIterator corr = low.corr(high); ... }