@Override public Object visitMultivectorComponent(GAPPMultivectorComponent gappMultivectorComponent, Object arg) { return new GAPPMultivectorComponent( gappMultivectorComponent.getName(), gappMultivectorComponent.getBladeIndex()); //Strings are immutable! }
public GAPPDotVectors(GAPPMultivectorComponent destination, LinkedList<GAPPVector> parts, String bladeName) { this.destination = new GAPPMultivector(destination.getName()); this.destSelector = new Selector(destination.getBladeIndex(), (byte) 1, bladeName); this.parts = parts; }
@Override public Object visitCalculateMvCoeff(GAPPCalculateMvCoeff gappCalculateMvCoeff, Object arg) { result.append("calculateMvCoeff "); result.append(gappCalculateMvCoeff.getDestination().getName()); result.append("["); result.append(Integer.toString(gappCalculateMvCoeff.getDestination().getBladeIndex())); result.append("]"); result.append(" = "); result.append(gappCalculateMvCoeff.getType().toString()); result.append("("); printMultivector(gappCalculateMvCoeff.getOperand1()); if (gappCalculateMvCoeff.getOperand2() != null) { result.append(","); printMultivector(gappCalculateMvCoeff.getOperand2()); } result.append(");\n"); return null; }
@Override public Object visitCalculateMvCoeff(GAPPCalculateMvCoeff gappCalculateMvCoeff, Object arg) { final String destMv = GAPPOpenCLCodeGenerator.getVarName(gappCalculateMvCoeff.getDestination().getName()); final Integer thisMvSetCount = mvBladeMap.get(destMv).size(); final String bladeCoeff = getBladeCoeff(destMv,thisMvSetCount); result.append(bladeCoeff); result.append(" = "); visitCalculateOp(gappCalculateMvCoeff.getType(), GAPPOpenCLCodeGenerator.getVarName(gappCalculateMvCoeff.getOperand1().getName()), GAPPOpenCLCodeGenerator.getVarName(gappCalculateMvCoeff.getOperand2().getName())); result.append(";\n"); mvBladeMap.get(destMv).put(gappCalculateMvCoeff.getDestination().getBladeIndex(),bladeCoeff); return null; }
target.setEntry(gappCalculateCoeff.getDestination().getBladeIndex(), result);
@Override public Object visitConstant(Constant constant, Object arg) { //arg must be filled! GAPPMultivectorComponent destination = (GAPPMultivectorComponent) arg; PosSelectorset selSet = new PosSelectorset(); selSet.add(new PosSelector(destination.getBladeIndex(), algebra.getBlade(destination.getBladeIndex()).toString())); Valueset valSet = new Valueset(); valSet.add(new GAPPConstant(((constant.isNegated()) ? -1 : 1) * constant.getValue())); gapp.addInstruction(new GAPPAssignMv(new GAPPMultivector(destination.getName()), selSet, valSet)); return null; }
GAPPDotVectors dotVectors = new GAPPDotVectors(destination, parts, algebra.getBlade(destination.getBladeIndex()).toString()); selDest.add(new PosSelector(altDestination.getBladeIndex(), algebra.getBlade(altDestination.getBladeIndex()).toString())); selSrc.add(new Selector(destination.getBladeIndex(), (byte) -1, algebra.getBlade(destination.getBladeIndex()).toString()));
@Override public Object visitMvComponent(MvComponent mvComponent, Object arg) { //arg must be filled! GAPPMultivectorComponent destination = (GAPPMultivectorComponent) arg; PosSelectorset selDestSet = new PosSelectorset(); selDestSet.add(new PosSelector(destination.getBladeIndex(), algebra.getBlade(destination.getBladeIndex()).toString())); Selectorset selSrcSet = new Selectorset(); selSrcSet.add(new Selector( mvComponent.getMultivectorComponent().getBladeIndex(), (mvComponent.isNegated()) ? (byte) -1 : (byte) 1, algebra.getBlade(mvComponent.getMultivectorComponent().getBladeIndex()).toString())); gapp.addInstruction(new GAPPSetMv( new GAPPMultivector(destination.getName()), new GAPPMultivector(mvComponent.getMultivectorComponent().getName()), selDestSet, selSrcSet)); return null; }
selDest.add(new PosSelector(altDestination.getBladeIndex(), algebra.getBlade(altDestination.getBladeIndex()).toString())); selSrc.add(new Selector(destination.getBladeIndex(), (byte) -1, algebra.getBlade(destination.getBladeIndex()).toString()));