diff --git a/java/source/infodynamics/measures/continuous/ConditionalMutualInfoCalculatorMultiVariate.java b/java/source/infodynamics/measures/continuous/ConditionalMutualInfoCalculatorMultiVariate.java index bdc8b4a..2cff666 100755 --- a/java/source/infodynamics/measures/continuous/ConditionalMutualInfoCalculatorMultiVariate.java +++ b/java/source/infodynamics/measures/continuous/ConditionalMutualInfoCalculatorMultiVariate.java @@ -623,6 +623,38 @@ public interface ConditionalMutualInfoCalculatorMultiVariate public double[] computeLocalUsingPreviousObservations(double states1[][], double states2[][], double[][] condStates) throws Exception; + /** + *
As per {@link #computeLocalUsingPreviousObservations(double[][], double[][], double[][])} + * but can only be used where dimensions of + * states1 and states2 have been set to 1.
+ * + * @param states1 series of univariate observations for variable 1 + * @param states2 series of univariate observations for variable 2 + * Length must matchstates1, and their indices must correspond.
+ * @param condStates series of multivariate observations for the conditional
+ * (first index is time or observation index, second is variable number).
+ * Length must match states1, and their indices must correspond.
+ * @return the series of local conditional MI values.
+ * @throws Exception
+ */
+ public double[] computeLocalUsingPreviousObservations(double states1[], double states2[], double[][] condStates)
+ throws Exception;
+
+ /**
+ * As per {@link #computeLocalUsingPreviousObservations(double[][], double[][], double[][])} + * but can only be used all dimensions have been set to 1.
+ * + * @param states1 series of univariate observations for variable 1 + * @param states2 series of univariate observations for variable 2. + * Length must matchstates1, and their indices must correspond.
+ * @param condStates series of univariate observations for the conditional.
+ * Length must match states1, and their indices must correspond.
+ * @return the series of local conditional MI values.
+ * @throws Exception
+ */
+ public double[] computeLocalUsingPreviousObservations(double states1[], double states2[], double[] condStates)
+ throws Exception;
+
/**
* @throws Exception if the implementing class computes MI without
* explicit observations (e.g. see
diff --git a/java/source/infodynamics/measures/continuous/ConditionalMutualInfoMultiVariateCommon.java b/java/source/infodynamics/measures/continuous/ConditionalMutualInfoMultiVariateCommon.java
index 0647686..782e3fd 100755
--- a/java/source/infodynamics/measures/continuous/ConditionalMutualInfoMultiVariateCommon.java
+++ b/java/source/infodynamics/measures/continuous/ConditionalMutualInfoMultiVariateCommon.java
@@ -934,6 +934,34 @@ public abstract class ConditionalMutualInfoMultiVariateCommon implements
// Compute the MI
return miSurrogateCalculator.computeAverageLocalOfObservations();
}
+
+ @Override
+ public double[] computeLocalUsingPreviousObservations(double[] states1, double[] states2, double[][] condStates)
+ throws Exception {
+ if ((dimensionsVar1 != 1) || (dimensionsVar2 != 1)) {
+ throw new Exception("The number of source and dest dimensions (having been initialised to " +
+ dimensionsVar1 + " and " + dimensionsVar2 + ") can only be 1 when " +
+ "the univariate computeLocalUsingPreviousObservations(double[],double[],double[][]) " +
+ "method is called");
+ }
+ return computeLocalUsingPreviousObservations(MatrixUtils.reshape(states1, states1.length, 1),
+ MatrixUtils.reshape(states2, states2.length, 1),
+ condStates);
+ }
+
+ @Override
+ public double[] computeLocalUsingPreviousObservations(double[] states1, double[] states2, double[] condStates)
+ throws Exception {
+ if ((dimensionsVar1 != 1) || (dimensionsVar2 != 1) || (dimensionsCond != 1)) {
+ throw new Exception("The number of source, dest and conditional dimensions (having been initialised to " +
+ dimensionsVar1 + ", " + dimensionsVar2 + " and " + dimensionsCond + ") can only be 1 when " +
+ "the univariate computeLocalUsingPreviousObservations(double[],double[],double[]) " +
+ "method is called");
+ }
+ return computeLocalUsingPreviousObservations(MatrixUtils.reshape(states1, states1.length, 1),
+ MatrixUtils.reshape(states2, states2.length, 1),
+ MatrixUtils.reshape(condStates, condStates.length, 1));
+ }
@Override
public void setDebug(boolean debug) {