Package cc.redberry.core.tensor

Examples of cc.redberry.core.tensor.TensorBuilder


         * @param tensor
         * @param transformation
         * @return
         */
        public static Tensor applyToEachChild(Tensor tensor, final Transformation transformation) {
            TensorBuilder builder = null;
            Tensor c, oc;
            for (int i = 0, size = tensor.size(); i < size; ++i) {
                c = transformation.transform(oc = tensor.get(i));
                if (builder != null || c != oc) {
                    if (builder == null) {
                        builder = tensor.getBuilder();
                        for (int j = 0; j < i; ++j)
                            builder.put(tensor.get(j));
                    }
                    builder.put(c);
                }
            }
            if (builder == null)
                return tensor;
            return builder.build();
        }
View Full Code Here


         * @param tensor
         * @param transformation
         * @return result
         */
        public static Tensor applyToEachChild(Tensor tensor, final Transformation transformation) {
            TensorBuilder builder = null;
            Tensor c, oc;
            for (int i = 0, size = tensor.size(); i < size; ++i) {
                c = transformation.transform(oc = tensor.get(i));
                if (builder != null || c != oc) {
                    if (builder == null) {
                        builder = tensor.getBuilder();
                        for (int j = 0; j < i; ++j)
                            builder.put(tensor.get(j));
                    }
                    builder.put(c);
                }
            }
            if (builder == null)
                return tensor;
            return builder.build();
        }
View Full Code Here

         * @param tensor
         * @param transformation
         * @return result
         */
        public static Tensor applyToEachChild(Tensor tensor, final Transformation transformation) {
            TensorBuilder builder = null;
            Tensor c, oc;
            for (int i = 0, size = tensor.size(); i < size; ++i) {
                c = transformation.transform(oc = tensor.get(i));
                if (builder != null || c != oc) {
                    if (builder == null) {
                        builder = tensor.getBuilder();
                        for (int j = 0; j < i; ++j)
                            builder.put(tensor.get(j));
                    }
                    builder.put(c);
                }
            }
            if (builder == null)
                return tensor;
            return builder.build();
        }
View Full Code Here

TOP

Related Classes of cc.redberry.core.tensor.TensorBuilder

Copyright © 2018 www.massapicom. 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.