[MINOR] Bug fixes and reuse of spoof instructions

- This patch allows adding the lineage dags corresponding to
  the spoof instructions to lineage cache. With codegen
  autoencoder with batch wise preprocessing takes 330 seconds,
  where with codegen and lineage caching it takes 215 sescond.
- This patch fixes the missing re-hashing of the lineage items
  after attaching the spoof lineage dags to the main dag.
- Furthermore, this patch introduces a inner iteration counter
  for l2svm.
diff --git a/scripts/builtin/l2svm.dml b/scripts/builtin/l2svm.dml
index f411fb9..fd99109 100644
--- a/scripts/builtin/l2svm.dml
+++ b/scripts/builtin/l2svm.dml
@@ -48,7 +48,7 @@
 
 m_l2svm = function(Matrix[Double] X, Matrix[Double] Y, Boolean intercept = FALSE,
     Double epsilon = 0.001, Double lambda = 1, Integer maxIterations = 100, 
-    Boolean verbose = FALSE, Integer columnId = -1)
+    Integer maxii = 20, Boolean verbose = FALSE, Integer columnId = -1)
   return(Matrix[Double] model)
 {
   #check input parameter assertions
@@ -110,7 +110,8 @@
     wd = lambda * sum(w * s)
     dd = lambda * sum(s * s)
     continue1 = TRUE
-    while(continue1){
+    iiter = 0
+    while(continue1 & iiter < maxii){
       tmp_Xw = Xw + step_sz*Xd
       out = 1 - Y * (tmp_Xw)
       sv = (out > 0)
@@ -119,6 +120,9 @@
       h = dd + sum(Xd * sv * Xd)
       step_sz = step_sz - g/h
       continue1 = (g*g/h >= epsilon)
+      if(verbose)
+        print("Inner Iter:" + toString(iiter))
+      iiter = iiter + 1
     }
 
     #update weights
diff --git a/src/main/java/org/apache/sysds/runtime/instructions/cp/SpoofCPInstruction.java b/src/main/java/org/apache/sysds/runtime/instructions/cp/SpoofCPInstruction.java
index f4e262e..6f47ed5 100644
--- a/src/main/java/org/apache/sysds/runtime/instructions/cp/SpoofCPInstruction.java
+++ b/src/main/java/org/apache/sysds/runtime/instructions/cp/SpoofCPInstruction.java
@@ -99,6 +99,11 @@
 	
 	@Override
 	public Pair<String, LineageItem> getLineageItem(ExecutionContext ec) {
+		//return the lineage item if already traced once
+		LineageItem li = ec.getLineage().get(output.getName());
+		if (li != null)
+			return Pair.of(output.getName(), li);
+
 		//read and deepcopy the corresponding lineage DAG (pre-codegen)
 		LineageItem LIroot = LineageCodegenItem.getCodegenLTrace(getOperatorClass().getName()).deepCopy();
 		
diff --git a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java
index 6a235b6..20c9b67 100644
--- a/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java
+++ b/src/main/java/org/apache/sysds/runtime/lineage/LineageCacheConfig.java
@@ -188,6 +188,7 @@
 			&& !(inst instanceof ListIndexingCPInstruction);
 		boolean rightop = (ArrayUtils.contains(REUSE_OPCODES, inst.getOpcode())
 			|| (inst.getOpcode().equals("append") && isVectorAppend(inst, ec))
+			|| (inst.getOpcode().startsWith("spoof"))
 			|| (inst instanceof DataGenCPInstruction) && ((DataGenCPInstruction) inst).isMatrixCall());
 		boolean updateInplace = (inst instanceof MatrixIndexingCPInstruction)
 			&& ec.getMatrixObject(((ComputationCPInstruction)inst).input1).getUpdateType().isInPlace();
diff --git a/src/main/java/org/apache/sysds/runtime/lineage/LineageItem.java b/src/main/java/org/apache/sysds/runtime/lineage/LineageItem.java
index 90119cc..e34979d 100644
--- a/src/main/java/org/apache/sysds/runtime/lineage/LineageItem.java
+++ b/src/main/java/org/apache/sysds/runtime/lineage/LineageItem.java
@@ -102,6 +102,11 @@
 		return _data;
 	}
 	
+	public void fixHash() {
+		_hash = 0;
+		_hash = hashCode();
+	}
+
 	public boolean isVisited() {
 		return _visited;
 	}
diff --git a/src/main/java/org/apache/sysds/runtime/lineage/LineageItemUtils.java b/src/main/java/org/apache/sysds/runtime/lineage/LineageItemUtils.java
index 1b1b558..268fd12 100644
--- a/src/main/java/org/apache/sysds/runtime/lineage/LineageItemUtils.java
+++ b/src/main/java/org/apache/sysds/runtime/lineage/LineageItemUtils.java
@@ -36,6 +36,7 @@
 import org.apache.sysds.hops.Hop;
 import org.apache.sysds.hops.IndexingOp;
 import org.apache.sysds.hops.LiteralOp;
+import org.apache.sysds.hops.ParameterizedBuiltinOp;
 import org.apache.sysds.hops.ReorgOp;
 import org.apache.sysds.hops.TernaryOp;
 import org.apache.sysds.hops.UnaryOp;
@@ -212,6 +213,11 @@
 		}
 		else if (root instanceof IndexingOp)
 			li = new LineageItem(name, "rightIndex", LIinputs);
+		else if (root instanceof ParameterizedBuiltinOp) {
+			String opcode = ((ParameterizedBuiltinOp) root).getOp().toString();
+			if (opcode.equalsIgnoreCase("replace"))
+				li = new LineageItem(name, opcode, LIinputs);
+		}
 		else if (root instanceof SpoofFusedOp)
 			li = LineageCodegenItem.getCodegenLTrace(((SpoofFusedOp) root).getClassName());
 		
@@ -375,6 +381,8 @@
 				rReplaceDagLeaves(li, newleaves);
 		}
 
+		//fix the hash codes bottom-up, as the inputs have changed
+		root.fixHash();
 		root.setVisited();
 	}