/** * Copies a SetVectorArgument instance * @param arg The argument * @return The copied argument */ private SetVectorArgument copyArgument(SetVectorArgument arg) { if (arg.isConstant()) { ConstantSetVectorArgument c = (ConstantSetVectorArgument) arg; return new ConstantSetVectorArgument(c.getValue()); } else { PairSetOfVariablesAndIndices pair = (PairSetOfVariablesAndIndices) arg; return new PairSetOfVariablesAndIndices((GAPPSetOfVariables) GAPPValueHolderCopier.copyValueHolder(pair.getSetOfVariable()), copySelectorset(pair.getSelectors())); } }
@Override public Object visitSetVector(GAPPSetVector gappSetVector, Object arg) { LinkedList<SetVectorArgument> entries = gappSetVector.getEntries(); for (SetVectorArgument entry: entries) { if (!entry.isConstant()) { PairSetOfVariablesAndIndices pair = (PairSetOfVariablesAndIndices) entry; String name = pair.getSetOfVariable().getName(); if (multivectors.contains(name)) { pair.setSetOfVariable(new GAPPMultivector(name)); } else { if (vectors.contains(name)) { pair.setSetOfVariable(new GAPPVector(name)); } else { System.err.println("Multivector/Vector "+name+" is not declared!"); } } } } vectors.add(gappSetVector.getDestination().getName()); return null; }
/** * Prints a SetVectorArgument instance * @param arg The argument */ private void printArgument(SetVectorArgument arg) { if (arg.isConstant()) result.append(((ConstantSetVectorArgument) arg).getValue()); else { PairSetOfVariablesAndIndices pair = (PairSetOfVariablesAndIndices) arg; result.append(pair.getSetOfVariable().prettyPrint()); printSelectors(pair.getSelectors()); } }
@Override public Object visitSetVector(GAPPSetVector gappSetVector, Object arg) { curLine++; for (SetVectorArgument curArg: gappSetVector.getEntries()) if (!curArg.isConstant()) { PairSetOfVariablesAndIndices p = (PairSetOfVariablesAndIndices) curArg; access(p.getSetOfVariable()); } return null; }
++wholeVectorSize; else wholeVectorSize += ((PairSetOfVariablesAndIndices)setVectorArg).getSelectors().size(); Iterator<Selector> itSelector = pair.getSelectors().iterator(); GAPPOpenCLCodeGenerator.getVarName(pair.getSetOfVariable().getName())));
PairSetOfVariablesAndIndices pair = (PairSetOfVariablesAndIndices) last; if (pair.getSetOfVariable().getName().equals(mvC.getName())) { pair.getSelectors().add(sel); } else { Selectorset selSet = new Selectorset(); selSet.add(sel); last = new PairSetOfVariablesAndIndices(new GAPPMultivector(mvC.getName()), selSet); list.add(last); Selectorset selSet = new Selectorset(); selSet.add(sel); last = new PairSetOfVariablesAndIndices(new GAPPMultivector(mvC.getName()), selSet); list.add(last);
} else { PairSetOfVariablesAndIndices p = (PairSetOfVariablesAndIndices) curArg; size += p.getSelectors().size(); } else { PairSetOfVariablesAndIndices p = (PairSetOfVariablesAndIndices) curArg; MultivectorWithValues source = getMultivector(p.getSetOfVariable().getName()); for (Selector sel: p.getSelectors()) { destination.setEntry(i, sel.getSign() * source.getEntries()[sel.getIndex()]); i++;