Package stallone.api.ints

Examples of stallone.api.ints.IIntArray


        return (res/(double)centers.size());
    }

    public IDoubleArray membershipToState(IClustering crisp, int state)
    {
        IIntArray clusterIndexes = crisp.getClusterIndexes();
        IDoubleArray res = Doubles.create.array(clusterIndexes.size());
        for (int i=0; i<res.size(); i++)
        {
            if (clusterIndexes.get(i) == state)
                res.set(i, 1);
            else
                res.set(i, 0);
        }
View Full Code Here


        IClustering cluster = Cluster.util.densityBased(obscat, nstates);

        System.out.println("done.");

        IIntArray ci = cluster.getClusterIndexes();
        IDoubleArray[] res = new IDoubleArray[nstates];
        for (int state=0; state<nstates; state++)
        {
            IParameterEstimator estimator = Statistics.create.parameterEstimatorGaussian1D();
            res[state] = estimator.estimate(obscat, Cluster.util.membershipToState(cluster, state));
View Full Code Here

    }

    public IIntArray giantComponent(IDoubleArray P)
    {
        List<IIntArray> C = connectedComponents(P);
        IIntArray largest = C.get(0);
        int size = C.get(0).size();
        for (int i=1; i<C.size(); i++)
        {
            if (C.get(i).size() > size)
            {
                largest = C.get(i);
                size = largest.size();
            }
        }
        return largest;
    }
View Full Code Here

    }

    public IDoubleArray estimateCmilestoning(IIntArray traj, Iterable<IIntArray> cores, int lag)
    {
        MilestoningFilter filter = new MilestoningFilter(cores);
        IIntArray filteredTraj = filter.filter(traj);
        return estimateC(filteredTraj, lag);
    }
View Full Code Here

        visited[s] = true;

        while (todo.size() > 0)
        {
            int v = ((Integer) todo.remove(0)).intValue();
            IIntArray neighbors = g.getNeighbors(v);
            for (int i = 0; i < neighbors.size(); i++)
            {
                int neighbor = neighbors.get(i);
                //System.out.println(v+":"+distances[v]+" -> "+adjList[v][i]+":"+distances[adjList[v][i]]);
                if (!visited[neighbor])
                {
                    distances[neighbor] = distances[v] + 1;
                    predecessors[neighbor] = v;
View Full Code Here

    @Override
    public IIntArray load()
    {
        //System.out.println("loading "+filename+" size = "+size()+" firstTime = "+times.get(0));
        IIntArray res = Ints.create.array(size());

        int firstTime = times.get(0);
        int currentTime = times.get(0);
        int lastData = data.get(0);
        res.set(currentTime-firstTime, lastData);

        for (int i=1; i<times.size(); i++)
        {
            while(currentTime < times.get(i))
            {
                //System.out.println(i+" "+currentTime+"\t"+firstTime+"\t"+(currentTime-firstTime)+"\t"+times.get(i));
                res.set(currentTime-firstTime, lastData);
                currentTime++;
            }
            if (currentTime == times.get(i))
            {
                lastData = data.get(i);
                res.set(currentTime-firstTime, lastData);
                currentTime++;
            }
        }
        return res;
    }
View Full Code Here

    {
        int N = dtraj.size();
        List<IIntArray> res = new ArrayList();
        for (int s = 0; s < tau; s += dt)
        {
            IIntArray I = intsNew.arrayRange(s, N, tau);
            res.add(ints.subToNew(dtraj, I));
        }
        return res;
    }
View Full Code Here

            {
                if (!Ints.util.contains(target, j) && A.get(j,j) == 0)
                    zeros.append(j);
            }

        IIntArray nonzeros = Ints.util.removeValueToNew(Ints.create.listRange(0, A.rows()), zeros);

        // clean matrix
        IDoubleArray Aclean = A.view(nonzeros.getArray(), nonzeros.getArray());

        // rhs
        IDoubleArray b = Doubles.create.array(A.rows());
        for (int i=0; i<b.size(); i++)
            b.set(i, -1);
        for (int i=0; i<target.size(); i++)
            b.set(target.get(i), 0);

        // clean vector
        IDoubleArray bclean = Doubles.util.subToNew(b, nonzeros);
        // Attention: we had done the following here... does this make sense??
        // int[] tmp = {0};
        // DoubleMatrix2D Bclean = B.viewSelection(nonzeros, tmp);

        IDoubleArray X = Algebra.util.solve(Aclean, bclean);

        // reshuffle x into full vector
        this.mfpts = Doubles.create.array(T.rows(), Double.NaN);
        for (int i=0; i<nonzeros.size(); i++)
            mfpts.set(nonzeros.get(i), X.get(i));
    }
View Full Code Here

        {
            try
            {
                loader.close();

                IIntArray res = loader.load();

                itraj++;
                if (itraj < numberOfSequences())
                {
                    loader.setSource(sources.get(itraj));
View Full Code Here

    {
        if (!(o instanceof IIntArray))
        {
            return (false);
        }
        IIntArray oo = (IIntArray) o;
        for (int i = 0; i < oo.size(); i++)
        {
            if (oo.get(i) != this.get(i))
            {
                return (false);
            }
        }
        return (true);
View Full Code Here

TOP

Related Classes of stallone.api.ints.IIntArray

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.