public virtual void TestCloneTable(ConcatVector[][][] factor3)
        {
            ConcatVectorTable concatVectorTable = ConvertArrayToVectorTable((ConcatVector[][][])factor3);
            ConcatVectorTable cloned            = concatVectorTable.CloneTable();

            for (int i = 0; i < factor3.Length; i++)
            {
                for (int j = 0; j < factor3[0].Length; j++)
                {
                    for (int k = 0; k < factor3[0][0].Length; k++)
                    {
                        NUnit.Framework.Assert.IsTrue(factor3[i][j][k].ValueEquals(cloned.GetAssignmentValue(new int[] { i, j, k }).Get(), 1.0e-5));
                    }
                }
            }
            NUnit.Framework.Assert.IsTrue(concatVectorTable.ValueEquals(cloned, 1.0e-5));
        }
        public virtual void TestProtoTable(ConcatVector[][][] factor3)
        {
            ConcatVectorTable     concatVectorTable     = ConvertArrayToVectorTable((ConcatVector[][][])factor3);
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();

            concatVectorTable.WriteToStream(byteArrayOutputStream);
            byteArrayOutputStream.Close();
            byte[] bytes = byteArrayOutputStream.ToByteArray();
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
            ConcatVectorTable    recovered            = ConcatVectorTable.ReadFromStream(byteArrayInputStream);

            for (int i = 0; i < factor3.Length; i++)
            {
                for (int j = 0; j < factor3[0].Length; j++)
                {
                    for (int k = 0; k < factor3[0][0].Length; k++)
                    {
                        NUnit.Framework.Assert.IsTrue(factor3[i][j][k].ValueEquals(recovered.GetAssignmentValue(new int[] { i, j, k }).Get(), 1.0e-5));
                    }
                }
            }
            NUnit.Framework.Assert.IsTrue(concatVectorTable.ValueEquals(recovered, 1.0e-5));
        }
 /// <summary>Does a deep comparison, using equality with tolerance checks against the vector table of values.</summary>
 /// <param name="other">the factor to compare to</param>
 /// <param name="tolerance">the tolerance to accept in differences</param>
 /// <returns>whether the two factors are within tolerance of one another</returns>
 public virtual bool ValueEquals(GraphicalModel.Factor other, double tolerance)
 {
     return(Arrays.Equals(neigborIndices, other.neigborIndices) && metaData.Equals(other.metaData) && featuresTable.ValueEquals(other.featuresTable, tolerance));
 }