All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mianalysis.mia.process.math.Indexer Maven / Gradle / Ivy

package io.github.mianalysis.mia.process.math;

/**
 * Multidimensional indexing
 * Created by sc13967 on 15/08/2016.
 */

public class Indexer {
    private int[] dim;
    private int[] dim_m;

    public Indexer(int[] dim) {
        this.dim = dim;
        dim_m = new int[this.dim.length];

        dim_m[0] = 1;
        for (int i=1;i= dim[i]) {
                return -1;

            }
        }

        //Adding each coordinate (multiplied by the relevant dimension) to ind
        int ind = 0;
        for (int i=0;i indexerSize) return null;

        int[] coord = new int[dim_m.length];
        coord[0] = ind%dim_m[1];
        for (int i=1;i




© 2015 - 2024 Weber Informatics LLC | Privacy Policy