Search in sources :

Example 46 with CNode

use of org.apache.sysml.hops.codegen.cplan.CNode in project incubator-systemml by apache.

the class CPlanComparisonTest method testNotEqualBinaryDAG3.

@Test
public void testNotEqualBinaryDAG3() {
    CNode c1 = createCNodeData(DataType.MATRIX);
    CNode c2 = createCNodeData(DataType.MATRIX);
    CNode c3 = createCNodeData(DataType.MATRIX);
    // DAG 3a: (c1+c3)*(c2+c3)
    CNode b1a = new CNodeBinary(c1, c3, BinType.PLUS);
    CNode b2a = new CNodeBinary(c2, c3, BinType.PLUS);
    CNode b3a = new CNodeBinary(b1a, b2a, BinType.MULT);
    // DAG 3b: (c1+c2)*(c3+c3)
    CNode b1b = new CNodeBinary(c1, c2, BinType.PLUS);
    CNode b2b = new CNodeBinary(c3, c3, BinType.PLUS);
    CNode b3b = new CNodeBinary(b1b, b2b, BinType.MULT);
    Assert.assertNotEquals(b3a, b3b);
}
Also used : CNode(org.apache.sysml.hops.codegen.cplan.CNode) CNodeBinary(org.apache.sysml.hops.codegen.cplan.CNodeBinary) Test(org.junit.Test)

Example 47 with CNode

use of org.apache.sysml.hops.codegen.cplan.CNode in project incubator-systemml by apache.

the class CPlanComparisonTest method testNotEqualTernaryNodes.

@Test
public void testNotEqualTernaryNodes() {
    CNode c1 = createCNodeData(DataType.MATRIX);
    CNode c2 = createCNodeData(DataType.SCALAR);
    CNode c3 = createCNodeData(DataType.MATRIX);
    CNode ter1 = new CNodeTernary(c1, c2, c3, TernaryType.MINUS_MULT);
    CNode ter2 = new CNodeTernary(c1, c2, c3, TernaryType.PLUS_MULT);
    Assert.assertNotEquals(ter1, ter2);
}
Also used : CNode(org.apache.sysml.hops.codegen.cplan.CNode) CNodeTernary(org.apache.sysml.hops.codegen.cplan.CNodeTernary) Test(org.junit.Test)

Example 48 with CNode

use of org.apache.sysml.hops.codegen.cplan.CNode in project incubator-systemml by apache.

the class CPlanComparisonTest method testNotEqualBinaryNodes.

@Test
public void testNotEqualBinaryNodes() {
    CNode c1 = createCNodeData(DataType.MATRIX);
    CNode c2 = createCNodeData(DataType.SCALAR);
    Assert.assertNotEquals(new CNodeBinary(c1, c2, BinType.PLUS), new CNodeBinary(c1, c2, BinType.MULT));
}
Also used : CNode(org.apache.sysml.hops.codegen.cplan.CNode) CNodeBinary(org.apache.sysml.hops.codegen.cplan.CNodeBinary) Test(org.junit.Test)

Example 49 with CNode

use of org.apache.sysml.hops.codegen.cplan.CNode in project incubator-systemml by apache.

the class CPlanComparisonTest method testNotEqualBinaryDAG2.

@Test
public void testNotEqualBinaryDAG2() {
    CNode c1 = createCNodeData(DataType.MATRIX);
    CNode c2 = createCNodeData(DataType.MATRIX);
    CNode c3 = createCNodeData(DataType.MATRIX);
    // DAG 2a: (c1*c2)*c3
    CNode b1a = new CNodeBinary(c1, c2, BinType.MULT);
    CNode b2a = new CNodeBinary(b1a, c3, BinType.MULT);
    // DAG 2b: (c1*c2)*c1
    CNode b1b = new CNodeBinary(c1, c2, BinType.MULT);
    CNode b2b = new CNodeBinary(b1b, c1, BinType.MULT);
    Assert.assertNotEquals(b2a, b2b);
}
Also used : CNode(org.apache.sysml.hops.codegen.cplan.CNode) CNodeBinary(org.apache.sysml.hops.codegen.cplan.CNodeBinary) Test(org.junit.Test)

Example 50 with CNode

use of org.apache.sysml.hops.codegen.cplan.CNode in project incubator-systemml by apache.

the class CPlanComparisonTest method testEqualBinaryNodes.

@Test
public void testEqualBinaryNodes() {
    CNode c1 = createCNodeData(DataType.MATRIX);
    CNode c2 = createCNodeData(DataType.SCALAR);
    CNode bin1 = new CNodeBinary(c1, c2, BinType.PLUS);
    CNode bin2 = new CNodeBinary(c1, c2, BinType.PLUS);
    Assert.assertEquals(bin1.hashCode(), bin2.hashCode());
    Assert.assertEquals(bin1, bin2);
}
Also used : CNode(org.apache.sysml.hops.codegen.cplan.CNode) CNodeBinary(org.apache.sysml.hops.codegen.cplan.CNodeBinary) Test(org.junit.Test)

Aggregations

CNode (org.apache.sysml.hops.codegen.cplan.CNode)64 CNodeBinary (org.apache.sysml.hops.codegen.cplan.CNodeBinary)27 Test (org.junit.Test)26 CNodeUnary (org.apache.sysml.hops.codegen.cplan.CNodeUnary)21 Hop (org.apache.sysml.hops.Hop)19 CNodeData (org.apache.sysml.hops.codegen.cplan.CNodeData)17 CNodeTernary (org.apache.sysml.hops.codegen.cplan.CNodeTernary)16 HashMap (java.util.HashMap)13 Pair (org.apache.sysml.runtime.matrix.data.Pair)11 ArrayList (java.util.ArrayList)9 HashSet (java.util.HashSet)9 AggBinaryOp (org.apache.sysml.hops.AggBinaryOp)8 MemoTableEntry (org.apache.sysml.hops.codegen.template.CPlanMemoTable.MemoTableEntry)8 CNodeMultiAgg (org.apache.sysml.hops.codegen.cplan.CNodeMultiAgg)7 AggUnaryOp (org.apache.sysml.hops.AggUnaryOp)6 BinaryOp (org.apache.sysml.hops.BinaryOp)6 LiteralOp (org.apache.sysml.hops.LiteralOp)6 UnaryOp (org.apache.sysml.hops.UnaryOp)6 CNodeCell (org.apache.sysml.hops.codegen.cplan.CNodeCell)5 CNodeRow (org.apache.sysml.hops.codegen.cplan.CNodeRow)5