Package com.opendatagroup.NumpySubset

Examples of com.opendatagroup.NumpySubset.ArrayInteger1d


import com.opendatagroup.NumpySubset.ArrayInteger1d;
import com.opendatagroup.NumpySubset.ArrayDouble1d;

public class Numpy {
    public static ArrayInteger1d indexArray(int length) {
        ArrayInteger1d out = new ArrayInteger1d(length);
        for (int i = 0;  i < length;  i++) {
            out.set(i, i);
        }
        return out;
    }
View Full Code Here


            out.set(i, 1);
        }
        return out;
    }
    public static ArrayInteger1d zerosInteger(int length) {
        ArrayInteger1d out = new ArrayInteger1d(length);
        for (int i = 0;  i < length;  i++) {
            out.set(i, 0);
        }
        return out;
    }
View Full Code Here

            out.set(i, 0);
        }
        return out;
    }
    public static ArrayInteger1d onesInteger(int length) {
        ArrayInteger1d out = new ArrayInteger1d(length);
        for (int i = 0;  i < length;  i++) {
            out.set(i, 1);
        }
        return out;
    }
View Full Code Here

        int length = max - min;
        if (length < 0) { length = 0; }
        length = (int)Math.ceil((double)length / (double)step);

        ArrayInteger1d out = new ArrayInteger1d(length);
        int j = 0;
        for (int i = min;  i < max;  i += step) {
            out.set(j, array.get(i));
            j += 1;
        }
        return out;
    }
View Full Code Here

        int count = 0;
        for (int i = 0;  i < selection.len();  i++) {
            if (selection.get(i)) { count += 1; }
        }

        ArrayInteger1d out = new ArrayInteger1d(count);
        int j = 0;
        for (int i = 0;  i < selection.len();  i++) {
            if (selection.get(i)) {
                out.set(j, array.get(i));
                j += 1;
            }
        }
        return out;
    }
View Full Code Here

        }
        return out;
    }

    public static ArrayInteger1d getfancy(ArrayInteger1d array, ArrayInteger1d selection) {
        ArrayInteger1d out = new ArrayInteger1d(selection.len());
        for (int i = 0;  i < selection.len();  i++) {
            int index = selection.get(i);
            if (index < 0) {
                index = array.len() + index;
            }
            out.set(i, array.get(index));
        }
        return out;
    }
View Full Code Here

            out.set(i, y.get(i));
        }
        return out;
    }
    public static ArrayInteger1d concatenate(ArrayInteger1d x, ArrayInteger1d y) {
        ArrayInteger1d out = new ArrayInteger1d(x.len() + y.len());
        for (int i = 0;  i < x.len();  i++) {
            out.set(i, x.get(i));
        }
        for (int i = 0;  i < y.len();  i++) {
            out.set(i, y.get(i));
        }
        return out;
    }
View Full Code Here

        }
        return out;
    }

    public static ArrayInteger1d copy(ArrayInteger1d array) {
        ArrayInteger1d out = new ArrayInteger1d(array.len());
        for (int i = 0;  i < out.len();  i++) {
            out.set(i, array.get(i));
        }
        return out;
    }
View Full Code Here

        }
        return count;
    }

    public static ArrayInteger1d cumsum(ArrayInteger1d array) {
        ArrayInteger1d out = new ArrayInteger1d(array.len());
        int sum = 0;
        for (int i = 0;  i < array.len();  i++) {
            out.set(i, sum);
            sum += array.get(i);
        }
        return out;
    }
View Full Code Here

TOP

Related Classes of com.opendatagroup.NumpySubset.ArrayInteger1d

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.