Java Code Examples for org.apache.flink.types.DoubleValue#setValue()

The following examples show how to use org.apache.flink.types.DoubleValue#setValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DoubleValueParser.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, DoubleValue reusable) {
	final int endPos = nextStringEndPos(bytes, startPos, limit, delimiter);
	if (endPos < 0) {
		return -1;
	}

	if (endPos > startPos &&
			(Character.isWhitespace(bytes[startPos]) || Character.isWhitespace(bytes[(endPos - 1)]))) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_ILLEGAL_CHARACTER);
		return -1;
	}

	String str = new String(bytes, startPos, endPos - startPos, ConfigConstants.DEFAULT_CHARSET);
	try {
		double value = Double.parseDouble(str);
		reusable.setValue(value);
		this.result = reusable;
		return (endPos == limit) ? limit : endPos + delimiter.length;
	}
	catch (NumberFormatException e) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_FORMAT_ERROR);
		return -1;
	}
}
 
Example 2
Source File: DoubleValueParser.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, DoubleValue reusable) {
	final int endPos = nextStringEndPos(bytes, startPos, limit, delimiter);
	if (endPos < 0) {
		return -1;
	}

	if (endPos > startPos &&
			(Character.isWhitespace(bytes[startPos]) || Character.isWhitespace(bytes[(endPos - 1)]))) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_ILLEGAL_CHARACTER);
		return -1;
	}

	String str = new String(bytes, startPos, endPos - startPos, ConfigConstants.DEFAULT_CHARSET);
	try {
		double value = Double.parseDouble(str);
		reusable.setValue(value);
		this.result = reusable;
		return (endPos == limit) ? limit : endPos + delimiter.length;
	}
	catch (NumberFormatException e) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_FORMAT_ERROR);
		return -1;
	}
}
 
Example 3
Source File: DoubleValueParser.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public int parseField(byte[] bytes, int startPos, int limit, byte[] delimiter, DoubleValue reusable) {
	final int endPos = nextStringEndPos(bytes, startPos, limit, delimiter);
	if (endPos < 0) {
		return -1;
	}

	if (endPos > startPos &&
			(Character.isWhitespace(bytes[startPos]) || Character.isWhitespace(bytes[(endPos - 1)]))) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_ILLEGAL_CHARACTER);
		return -1;
	}

	String str = new String(bytes, startPos, endPos - startPos, ConfigConstants.DEFAULT_CHARSET);
	try {
		double value = Double.parseDouble(str);
		reusable.setValue(value);
		this.result = reusable;
		return (endPos == limit) ? limit : endPos + delimiter.length;
	}
	catch (NumberFormatException e) {
		setErrorState(ParseErrorState.NUMERIC_VALUE_FORMAT_ERROR);
		return -1;
	}
}
 
Example 4
Source File: dVMPv1.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
        public boolean isConverged(int iteration, DoubleValue value) {


/*
            if (iteration==1)
                return false;

            iteration--;

            if (iteration%epochs!=0)
                return false;

            iteration= iteration/epochs;
*/
            if (Double.isNaN(value.getValue()))
                throw new IllegalStateException("A NaN elbo");

            if (value.getValue()==Double.NEGATIVE_INFINITY)
                value.setValue(-Double.MAX_VALUE);

            double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

            double timeIteration = (System.nanoTime() - start) / 1000000000.0;

            DecimalFormat df = new DecimalFormat("0.0000");

            if (iteration==1) {
                previousELBO=value.getValue();
                logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound at first iteration: 1," + value.getValue()+ "," +
                        ((System.nanoTime() - start) / 1000000000.0) + " seconds");
                return false;
            }else if (percentage<-1){
                logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                        percentage), df.format(value.getValue()), df.format(previousELBO));
                //throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
                //        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));

                System.out.println("Global bound is not monotonically increasing: "+ iteration +","+percentage+
                        "," + (value.getValue()) +">" + previousELBO+ ","+
                        (System.nanoTime() - start) / 1000000000.0 + " seconds");
                this.previousELBO=value.getValue();
                return false;
            }else if (percentage>-1 && timeIteration < timeLimit) {
                logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                        df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                        df.format((System.nanoTime() - start) / 1000000000.0));

                System.out.println("Global bound is monotonically increasing: "+ iteration +","+percentage+
                        "," + (value.getValue()) +">" + previousELBO+ ","+
                        (System.nanoTime() - start) / 1000000000.0 + " seconds");

                this.previousELBO=value.getValue();
                return false;
            }else {
                logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                        df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));

                System.out.println("Global bound Convergence: "+ iteration +"," + percentage + "," +
                        value.getValue()+ "," + (System.nanoTime() - start) / 1000000000.0 +
                        " seconds");
                return true;
            }
        }
 
Example 5
Source File: DoubleValueSerializer.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue copy(DoubleValue from, DoubleValue reuse) {
	reuse.setValue(from.getValue());
	return reuse;
}
 
Example 6
Source File: dVMPv1.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
        public boolean isConverged(int iteration, DoubleValue value) {

/*
            if (iteration==1)
                return false;

            iteration--;
*/
            if (Double.isNaN(value.getValue()))
                throw new IllegalStateException("A NaN elbo");

            if (value.getValue()==Double.NEGATIVE_INFINITY)
                value.setValue(-Double.MAX_VALUE);

            double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

            DecimalFormat df = new DecimalFormat("0.0000");

            if (iteration==1) {
                previousELBO=value.getValue();
                logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound at first iteration: 1," + df.format(value.getValue())+ "," +
                        df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");

                return false;
            }else if (percentage<0 && percentage < -threshold){
                logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                        percentage), df.format(value.getValue()), df.format(previousELBO));
                throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
                        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
                //System.out.println("Global bound is not monotonically increasing: "+ iteration +", "+ percentage +
                // ", "+ (value.getValue() +">" + previousELBO));
                //this.previousELBO=value.getValue();
                //return false;
            }else if (percentage>0 && percentage>threshold) {
                logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                        df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound is monotonically increasing: "+ iteration +","+df.format(percentage)+
                        "," + (df.format(value.getValue()) +">" + df.format(previousELBO))+ ","+
                        df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");
                this.previousELBO=value.getValue();
                return false;
            }else {
                logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                        df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound Convergence: "+ iteration +"," + df.format(percentage) + "," +
                        df.format(value.getValue())+ "," + df.format((System.nanoTime() - start) / 1000000000.0) +
                        " seconds");
                return true;
            }
        }
 
Example 7
Source File: DistributedVI.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, DoubleValue value) {


    if (iteration==1)
        return false;

    iteration--;

    if (Double.isNaN(value.getValue()))
        throw new IllegalStateException("A NaN elbo");

    if (value.getValue()==Double.NEGATIVE_INFINITY)
        value.setValue(-Double.MAX_VALUE);

    double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

    double timeIteration = (System.nanoTime() - start) / 1000000000.0;

    DecimalFormat df = new DecimalFormat("0.0000");

    if (iteration==1) {
        previousELBO=value.getValue();
        logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound at first iteration: 1," + value.getValue()+ "," +
                ((System.nanoTime() - start) / 1000000000.0) + " seconds");
        return false;
    }else if (percentage<-1){
        logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                percentage), df.format(value.getValue()), df.format(previousELBO));
        throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
                df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
    }else if (percentage>-1 && timeIteration < timeLimit) {
        logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                df.format((System.nanoTime() - start) / 1000000000.0));

        System.out.println("Global bound is monotonically increasing: "+ iteration +","+percentage+
                "," + (value.getValue()) +">" + previousELBO+ ","+
                (System.nanoTime() - start) / 1000000000.0 + " seconds");

        this.previousELBO=value.getValue();
        return false;
    }else {
        logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));

        System.out.println("Global bound Convergence: "+ iteration +"," + percentage + "," +
                value.getValue()+ "," + (System.nanoTime() - start) / 1000000000.0 +
                " seconds");
        return true;
    }
}
 
Example 8
Source File: DistributedVI.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, DoubleValue value) {


    if (iteration==1)
        return false;

    iteration--;

    if (Double.isNaN(value.getValue()))
        throw new IllegalStateException("A NaN elbo");

    if (value.getValue()==Double.NEGATIVE_INFINITY)
        value.setValue(-Double.MAX_VALUE);

    double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

    DecimalFormat df = new DecimalFormat("0.0000");

    if (iteration==1) {
        previousELBO=value.getValue();
        logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound at first iteration: 1," + df.format(value.getValue())+ "," +
                df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");

        return false;
    }else if (percentage<0 && percentage < -threshold){
        logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                percentage), df.format(value.getValue()), df.format(previousELBO));
        throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
                df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
        //System.out.println("Global bound is not monotonically increasing: "+ iteration +", "+ percentage +
        // ", "+ (value.getValue() +">" + previousELBO));
        //this.previousELBO=value.getValue();
        //return false;
    }else if (percentage>0 && percentage>threshold) {
        logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound is monotonically increasing: "+ iteration +","+df.format(percentage)+
                "," + (df.format(value.getValue()) +">" + df.format(previousELBO))+ ","+
                df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");
        this.previousELBO=value.getValue();
        return false;
    }else {
        logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound Convergence: "+ iteration +"," + df.format(percentage) + "," +
                df.format(value.getValue())+ "," + df.format((System.nanoTime() - start) / 1000000000.0) +
                " seconds");
        return true;
    }
}
 
Example 9
Source File: ParallelVB.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, DoubleValue value) {


    if (iteration==1)
        return false;

    iteration--;

    if (Double.isNaN(value.getValue()))
        throw new IllegalStateException("A NaN elbo");

    if (value.getValue()==Double.NEGATIVE_INFINITY)
        value.setValue(-Double.MAX_VALUE);

    double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

    double timeIteration = (System.nanoTime() - start) / 1000000000.0;

    DecimalFormat df = new DecimalFormat("0.0000");

    if (iteration==1) {
        previousELBO=value.getValue();
        logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound at first iteration: 1," + value.getValue()+ "," +
                ((System.nanoTime() - start) / 1000000000.0) + " seconds");
        return false;
    }else if (percentage<-1){
        logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                percentage), df.format(value.getValue()), df.format(previousELBO));
        System.out.println("Global bound is not monotonically increasing: "+ iteration +","+percentage+
                "," + (value.getValue()) +">" + previousELBO+ ","+
                (System.nanoTime() - start) / 1000000000.0 + " seconds");
        //throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
        //        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
        return false;
    }else if (percentage>-1 && timeIteration < timeLimit) {
        logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                df.format((System.nanoTime() - start) / 1000000000.0));

        System.out.println("Global bound is monotonically increasing: "+ iteration +","+percentage+
                "," + (value.getValue()) +">" + previousELBO+ ","+
                (System.nanoTime() - start) / 1000000000.0 + " seconds");

        this.previousELBO=value.getValue();
        return false;
    }else {
        logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));

        System.out.println("Global bound Convergence: "+ iteration +"," + percentage + "," +
                value.getValue()+ "," + (System.nanoTime() - start) / 1000000000.0 +
                " seconds");
        return true;
    }
}
 
Example 10
Source File: ParallelVB.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isConverged(int iteration, DoubleValue value) {


    if (iteration==1)
        return false;

    iteration--;

    if (Double.isNaN(value.getValue()))
        throw new IllegalStateException("A NaN elbo");

    if (value.getValue()==Double.NEGATIVE_INFINITY)
        value.setValue(-Double.MAX_VALUE);

    double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

    DecimalFormat df = new DecimalFormat("0.0000");

    if (iteration==1) {
        previousELBO=value.getValue();
        logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound at first iteration: 1," + df.format(value.getValue())+ "," +
                df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");

        return false;
    }else if (percentage<0 && percentage < -threshold){
        logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                percentage), df.format(value.getValue()), df.format(previousELBO));
        //throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
        //        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
        //System.out.println("Global bound is not monotonically increasing: "+ iteration +", "+ percentage +
        // ", "+ (value.getValue() +">" + previousELBO));
        //this.previousELBO=value.getValue();
        return false;
    }else if (percentage>0 && percentage>threshold) {
        logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound is monotonically increasing: "+ iteration +","+df.format(percentage)+
                "," + (df.format(value.getValue()) +">" + df.format(previousELBO))+ ","+
                df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");
        this.previousELBO=value.getValue();
        return false;
    }else {
        logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));
        System.out.println("Global bound Convergence: "+ iteration +"," + df.format(percentage) + "," +
                df.format(value.getValue())+ "," + df.format((System.nanoTime() - start) / 1000000000.0) +
                " seconds");
        return true;
    }
}
 
Example 11
Source File: dVMP.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
        public boolean isConverged(int iteration, DoubleValue value) {

/*
            if (iteration==1)
                return false;

            iteration--;
*/
            if (Double.isNaN(value.getValue()))
                throw new IllegalStateException("A NaN elbo");

            if (value.getValue()==Double.NEGATIVE_INFINITY)
                value.setValue(-Double.MAX_VALUE);

            double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

            double timeIteration = (System.nanoTime() - start) / 1000000000.0;

            DecimalFormat df = new DecimalFormat("0.0000");

            if (iteration==1) {
                previousELBO=value.getValue();
                logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound at first iteration: 1," + value.getValue()+ "," +
                        ((System.nanoTime() - start) / 1000000000.0) + " seconds");
                return false;
            }else if (percentage<-1){
                logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                        percentage), df.format(value.getValue()), df.format(previousELBO));
                //throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
                //        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));

                System.out.println("Global bound is not monotonically increasing: "+ iteration +","+percentage+
                        "," + (value.getValue()) +">" + previousELBO+ ","+
                        (System.nanoTime() - start) / 1000000000.0 + " seconds");
                this.previousELBO=value.getValue();
                return false;
            }else if (percentage>-1 && timeIteration < timeLimit) {
                logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                        df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                        df.format((System.nanoTime() - start) / 1000000000.0));

                System.out.println("Global bound is monotonically increasing: "+ iteration +","+percentage+
                        "," + (value.getValue()) +">" + previousELBO+ ","+
                        (System.nanoTime() - start) / 1000000000.0 + " seconds");

                this.previousELBO=value.getValue();
                return false;
            }else {
                logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                        df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));

                System.out.println("Global bound Convergence: "+ iteration +"," + percentage + "," +
                        value.getValue()+ "," + (System.nanoTime() - start) / 1000000000.0 +
                        " seconds");
                return true;
            }
        }
 
Example 12
Source File: dVMP.java    From toolbox with Apache License 2.0 4 votes vote down vote up
@Override
        public boolean isConverged(int iteration, DoubleValue value) {

/*
            if (iteration==1)
                return false;

            iteration--;
*/
            if (Double.isNaN(value.getValue()))
                throw new IllegalStateException("A NaN elbo");

            if (value.getValue()==Double.NEGATIVE_INFINITY)
                value.setValue(-Double.MAX_VALUE);

            double percentage = 100*(value.getValue() - previousELBO)/Math.abs(previousELBO);

            DecimalFormat df = new DecimalFormat("0.0000");

            if (iteration==1) {
                previousELBO=value.getValue();
                logger.info("Global bound at first iteration: 1,{},{} seconds",df.format(value.getValue()),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound at first iteration: 1," + df.format(value.getValue())+ "," +
                        df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");

                return false;
            }else if (percentage<0 && percentage < -threshold){
                logger.info("Global bound is not monotonically increasing: {},{},{}<{}",iteration, df.format(
                        percentage), df.format(value.getValue()), df.format(previousELBO));
//                throw new IllegalStateException("Global bound is not monotonically increasing: "+ iteration +","+
//                        df.format(percentage) +"," + df.format(value.getValue()) +" < " + df.format(previousELBO));
                System.out.println("Global bound is not monotonically increasing: "+ iteration +", "+ percentage +
                 ", "+ (value.getValue() +">" + previousELBO));
                this.previousELBO=value.getValue();
                return false;
            }else if (percentage>0 && percentage>threshold) {
                logger.info("Global bound is monotonically increasing: {},{},{}>{},{} seconds",iteration,
                        df.format(percentage), df.format(value.getValue()), df.format(previousELBO),
                        df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound is monotonically increasing: "+ iteration +","+df.format(percentage)+
                        "," + (df.format(value.getValue()) +">" + df.format(previousELBO))+ ","+
                        df.format((System.nanoTime() - start) / 1000000000.0) + " seconds");
                this.previousELBO=value.getValue();
                return false;
            }else {
                logger.info("Global bound Convergence: {},{},{},{} seconds",iteration,df.format(percentage),
                        df.format(value.getValue()), df.format((System.nanoTime() - start) / 1000000000.0));
                System.out.println("Global bound Convergence: "+ iteration +"," + df.format(percentage) + "," +
                        df.format(value.getValue())+ "," + df.format((System.nanoTime() - start) / 1000000000.0) +
                        " seconds");
                return true;
            }
        }
 
Example 13
Source File: HITS.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue reduce(DoubleValue first, DoubleValue second)
		throws Exception {
	first.setValue(first.getValue() + second.getValue());
	return first;
}
 
Example 14
Source File: DoubleValueSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue copy(DoubleValue from, DoubleValue reuse) {
	reuse.setValue(from.getValue());
	return reuse;
}
 
Example 15
Source File: HITS.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue reduce(DoubleValue first, DoubleValue second)
		throws Exception {
	first.setValue(first.getValue() + second.getValue());
	return first;
}
 
Example 16
Source File: DoubleValueSerializer.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue copy(DoubleValue from, DoubleValue reuse) {
	reuse.setValue(from.getValue());
	return reuse;
}
 
Example 17
Source File: HITS.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@Override
public DoubleValue reduce(DoubleValue first, DoubleValue second)
		throws Exception {
	first.setValue(first.getValue() + second.getValue());
	return first;
}