@Override public GeneralBinaryFunction<INPUT, C1, C2, OUTPUT> copy() { return new GeneralBinaryFunction<INPUT, C1, C2, OUTPUT>( f1.copy(), f2.copy(), operation.copy(), type.createVariable()); }
@Override public GeneralBinaryFunction<INPUT, C1, C2, OUTPUT> copy() { return new GeneralBinaryFunction<INPUT, C1, C2, OUTPUT>( f1.copy(), f2.copy(), operation.copy(), type.createVariable()); }
private ParseStatus factor(List<Token> tokens, int pos) { ParseStatus status1 = signedAtom(tokens, pos); if (status1.errMsg != null) return status1; ParseStatus status2 = status1; if (ParseUtils.match(Exponent.class, tokens, status1.tokenNumber)) { status2 = factor(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealPower<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } return status2; }
private ParseStatus factor(List<Token> tokens, int pos) { ParseStatus status1 = signedAtom(tokens, pos); if (status1.errMsg != null) return status1; ParseStatus status2 = status1; if (ParseUtils.match(Exponent.class, tokens, status1.tokenNumber)) { status2 = factor(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealPower<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } return status2; }
public ParseStatus equation(List<Token> tokens, int pos) { ParseStatus status1 = term(tokens, pos); if (status1.errMsg != null) return status1; ParseStatus status2 = status1; if (ParseUtils.match(Plus.class, tokens, status1.tokenNumber)) { status2 = equation(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealAdd<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } else if (ParseUtils.match(Minus.class, tokens, status1.tokenNumber)) { status2 = equation(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealSubtract<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } return status2; }
public ParseStatus equation(List<Token> tokens, int pos) { ParseStatus status1 = term(tokens, pos); if (status1.errMsg != null) return status1; ParseStatus status2 = status1; if (ParseUtils.match(Plus.class, tokens, status1.tokenNumber)) { status2 = equation(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealAdd<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } else if (ParseUtils.match(Minus.class, tokens, status1.tokenNumber)) { status2 = equation(tokens, status1.tokenNumber+1); if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealSubtract<DoubleType,DoubleType,DoubleType>(), new DoubleType()); } return status2; }
if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealMultiply<DoubleType,DoubleType,DoubleType>(), if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealDivide<DoubleType,DoubleType,DoubleType>(), if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealMod<DoubleType,DoubleType,DoubleType>(),
if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealMultiply<DoubleType,DoubleType,DoubleType>(), if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealDivide<DoubleType,DoubleType,DoubleType>(), if (status2.errMsg != null) return status2; status2.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, new RealMod<DoubleType,DoubleType,DoubleType>(),
private static < I1 extends RealType< I1 >, I2 extends RealType< I2 >, O extends RealType< O >> void binaryAssign( BinaryOperation< I1, I2, O > op, Img< I1 > input1, Img< I2 > input2, Img< O > output, long[] span ) { long[] origin = new long[ span.length ]; O type = output.firstElement(); final Function< long[], I1 > f1 = new RealImageFunction< I1, I1 >( input1, input1.firstElement() ); final Function< long[], I2 > f2 = new RealImageFunction< I2, I2 >( input2, input2.firstElement() ); final Function< long[], O > binFunc = new GeneralBinaryFunction< long[], I1, I2, O >(f1, f2, op, type.copy()); final InputIteratorFactory< long[] > inputFactory = new PointInputIteratorFactory(); final ImageAssignment< O, O, long[] > assigner = new ImageAssignment< O, O, long[] >( output, origin, span, binFunc, null, inputFactory ); assigner.assign(); }
private ParseStatus signedAtom(List<Token> tokens, int pos) { if (ParseUtils.match(Plus.class, tokens, pos)) { return atom(tokens, pos+1); } else if (ParseUtils.match(Minus.class, tokens, pos)) { ParseStatus status = atom(tokens, pos+1); if (status.errMsg != null) return status; RealConstantFunction<long[], DoubleType> constant = new RealConstantFunction<long[], DoubleType>(new DoubleType(-1)); status.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( constant, status.function, new RealMultiply<DoubleType,DoubleType,DoubleType>(), new DoubleType()); return status; } else return atom(tokens, pos); }
private ParseStatus signedAtom(List<Token> tokens, int pos) { if (ParseUtils.match(Plus.class, tokens, pos)) { return atom(tokens, pos+1); } else if (ParseUtils.match(Minus.class, tokens, pos)) { ParseStatus status = atom(tokens, pos+1); if (status.errMsg != null) return status; RealConstantFunction<long[], DoubleType> constant = new RealConstantFunction<long[],DoubleType>(new DoubleType(),-1); status.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( constant, status.function, new RealMultiply<DoubleType,DoubleType,DoubleType>(), new DoubleType()); return status; } else return atom(tokens, pos); }
private static < I1 extends RealType< I1 >, I2 extends RealType< I2 >, O extends RealType< O >> void binaryAssign(BinaryOperation<I1, I2, O> op, RandomAccessibleInterval<I1> input1, RandomAccessibleInterval<I2> input2, RandomAccessibleInterval<O> output, long[] span) { long[] origin = new long[ span.length ]; O type = output.randomAccess().get(); final Function< long[], I1 > f1 = new RealImageFunction<I1, I1>(input1, input1.randomAccess().get()); final Function< long[], I2 > f2 = new RealImageFunction<I2, I2>(input2, input2.randomAccess().get()); final Function< long[], O > binFunc = new GeneralBinaryFunction< long[], I1, I2, O >(f1, f2, op, type.copy()); final InputIteratorFactory< long[] > inputFactory = new PointInputIteratorFactory(); final ImageAssignment< O, O, long[] > assigner = new ImageAssignment< O, O, long[] >( output, origin, span, binFunc, null, inputFactory ); assigner.assign(); }
new RealMax<DoubleType,DoubleType,DoubleType>(); status.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, op, new DoubleType()); return status;
new RealMax<DoubleType,DoubleType,DoubleType>(); status.function = new GeneralBinaryFunction<long[],DoubleType,DoubleType,DoubleType>( status1.function, status2.function, op, new DoubleType()); return status;