Examples of VectorAccumulator


Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

     *            the neutral value
     * @return a sum accumulator
     */
    public static VectorAccumulator asSumAccumulator(final byte neutral) {

        return new VectorAccumulator() {

            private byte result = neutral;


            @Override
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

     *            the neutral value
     * @return a product accumulator
     */
    public static VectorAccumulator asProductAccumulator(final byte neutral) {

        return new VectorAccumulator() {

            private byte result = neutral;


            @Override
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

     *
     * @return a minimum vector accumulator
     */
    public static VectorAccumulator mkMinAccumulator() {

        return new VectorAccumulator() {

            private byte result = maxByte();


            @Override
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

     *
     * @return a maximum vector accumulator
     */
    public static VectorAccumulator mkMaxAccumulator() {

        return new VectorAccumulator() {

            private byte result = minByte();


            @Override
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

    public static VectorAccumulator asFunctionAccumulator(
        final VectorAccumulator accumulator,
        final VectorFunction function)
    {

        return new VectorAccumulator() {

            @Override
            public void update(int i, byte value) {

                accumulator.update(i, function.evaluate(i, value));
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

    @Test
    public void testFold_6() {

        ByteVector a = factory().createVector(new byte[] {0, 0, 5, 0, 2, 1});

        VectorAccumulator sum = ByteVectors.asSumAccumulator((byte)0);
        VectorAccumulator product = ByteVectors.asProductAccumulator((byte)1);

        assertEquals(a.fold(sum), 6);
        // check whether the accumulator were flushed
        assertEquals(a.fold(sum), 6);
View Full Code Here

Examples of net.fec.openrq.util.linearalgebra.vector.functor.VectorAccumulator

        ByteVector a = factory().createVector(
            new byte[] {2, 0, 5, 0, 2}
            );

        VectorAccumulator sum = ByteVectors.asSumAccumulator((byte)0);
        VectorAccumulator product = ByteVectors.asProductAccumulator((byte)1);

        assertEquals(a.foldNonZero(sum), 5);
        // check whether the accumulator were flushed
        assertEquals(a.foldNonZero(sum), 5);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.