Package net.algart.math

Examples of net.algart.math.IRange


        this.wcMin = weightCoordMin.coordinates();
        this.wcMax = weightCoordMax.coordinates();
        final IRange[] ranges = new IRange[n];
        long count = 1;
        for (int k = 0; k < n; k++) {
            IRange range = IRange.valueOf(weightCoordMin.coord(k), weightCoordMax.coord(k));
            ranges[k] = range;
            if (range.size() >= Integer.MAX_VALUE || (count *= range.size()) >= Integer.MAX_VALUE)
                throw new IllegalArgumentException("Too large desired weight matrix: more than 2^31-1 elements");
        }
        assert count >= 1;
        if (weights.length != count)
            throw new IllegalArgumentException("The length of weights array " + weights.length
View Full Code Here


        Pattern newPattern = parent.scale(multipliers);
        IPoint newMin = weightCoordMin.roundedScale(multipliers);
        IPoint newMax = weightCoordMin.roundedScale(multipliers);
        long count = 1;
        for (int k = 0; k < n; k++) {
            IRange range = IRange.valueOf(newMin.coord(k), newMax.coord(k));
            if (range.size() >= Integer.MAX_VALUE || (count *= range.size()) >= Integer.MAX_VALUE)
                throw new IllegalArgumentException("Too large desired weight matrix after resizing: "
                    + "more than 2^31-1 elements");
        }
        double[] newWeights = new double[(int) count]; // zero-filled
        double newOutsideWeight = outsideWeight * newPattern.largePointCount() / this.largePointCount();
View Full Code Here

        }
        long[] dimensions = new long[n];
        long[] destPosition = new long[n];
        long[] srcPosition = new long[n];
        for (int k = 0; k < n; k++) {
            IRange range = destRegion.coordRange(k);
            dimensions[k] = range.size();
            destPosition[k] = range.min();
            srcPosition[k] = shifts.length > k ? destPosition[k] - shifts[k] : destPosition[k];
        }
        if (dest.isTiled()) {
            return new ToTiled(dest, src, continuationMode, continuationMode,
                destPosition, srcPosition, dimensions).copySubMatrix(context);
View Full Code Here

                // than Integer.MAX_VALUE points.
                // In this branch, it is theoretically possible to process up to Long.MAX_VALUE points,
                // but it is practically useless; this check allows to avoid overflow while integer summarizing.
                for (int k = 1, n = pattern.dimCount(); k < n; k++) {
                    // Starting from k=1: no sense to specially optimize summarizing along x-axis
                    IRange range = pattern.roundedCoordRange(k);
                    if (range.size() == pointCount) {
                        processAlongAxis(dest.array(), src.array(), src.dimensions(), k, range.min(), range.max());
                        return;
                    }
                }
            }
        }
View Full Code Here

                + "to the number of dimensions of the origin");
        System.arraycopy(gridIndexRanges, 0, this.gridIndexRanges, 0, gridIndexRanges.length);
        long count = 1;
        double largeCount = 1.0;
        for (int k = 0; k < this.gridIndexRanges.length; k++) {
            IRange gridIndexRange = this.gridIndexRanges[k];
            checkGridIndexRange(gridIndexRange);
            checkCoordRange(coordRange(k, gridIndexRange));
            long size = gridIndexRange.size();
            if (count != Long.MIN_VALUE) {
                count = Patterns.longMul(count, size);
            }
            largeCount *= size;
        }
View Full Code Here

    public final void process(Matrices.Region destRegion) {
        initializeProgress(destRegion);
        boolean fullyInside = true;
        for (int k = 0, n = destRegion.n(); k < n; k++) {
            IRange destRange = destRegion.coordRange(k);
            long destMin = destRange.min();
            long destMax = destRange.max();
            if (destMin < 0 || destMax >= dest.dim(k)) {
                fullyInside = false;
                break;
            }
            long srcMin = shifts.length > k ? destMin - shifts[k] : destMin;
View Full Code Here

        final int n = destRegion.n();
//        System.out.println("Copying " + destRegion + ", shifts=" + JArrays.toString(shifts, ",", 100));
        if (n == 1) {
            segmentCopier.copySegment(destRegion);
        } else { // the recursion
            final IRange destRange = destRegion.coordRange(n - 1);
            final long destMin = destRange.min();
            final long destMax = destRange.max();
            Matrices.Region.MutableIRange mutableCoordRange = new Matrices.Region.MutableIRange();
            for (long k = destMin; k <= destMax; k++) {
                destCoordinates[n - 1] = k;
                srcCoordinates[n - 1] = shifts.length >= n ? k - shifts[n - 1] : k;
                if (destRegion.sectionIsUninterruptedSegment(k)) {
View Full Code Here

        abstract void copyUninterruptedSegment(long destMin, long destMax);

        abstract void copyInterruptedSegment(Matrices.Region destRegion, long destMin, long destMax);

        final void copySegment(Matrices.Region destRegion) {
            final IRange destRange = destRegion.coordRange(0);
            if (destRegion.isRectangular()) {
                copyUninterruptedSegment(destRange.min(), destRange.max());
            } else {
                // rare situation: only non-standard implementations of Matrices.Region
                copyInterruptedSegment(destRegion, destRange.min(), destRange.max());
            }
            updateProgressForSegment(destRange);
        }
View Full Code Here

TOP

Related Classes of net.algart.math.IRange

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.