Package stallone.api.ints

Examples of stallone.api.ints.IIntArray


    @Override
    public IIntArray load()
    {
        int size = size();
        IIntArray res = Ints.create.array(size);
        for (int i=0; i<size; i++)
            res.set(i, get(i));
        return res;
    }
View Full Code Here


        ArrayList<IIntArray> leaves = cmd.mc.getLeafIndexes();
        PrintStream[] out = new PrintStream[leaves.size()];
        for (int i=0; i<out.length; i++)
        {
            out[i] = new PrintStream(cmd.outPrefix+"_cluster-"+(i+1)+".dat");
            IIntArray leaf = leaves.get(i);
            System.out.println("leaf size = "+leaf.size());
            for (int j=0; j<leaf.size(); j++)
            {
                IDoubleArray data = cmd.data.getSequence(0).get(leaf.get(j));
                out[i].println(data.get(0));
            }
            out[i].close();
        }
       
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

        // rearrange lifetimes by states
        int nstatesAfterSplit = nstates;
        for (int i = 0; i < nstates; i++)
        {
            IIntArray I = ints.findAll(states, i);

            exitTimeIndexesByState[i] = I.getArray();

            exitTimesByState[i] = doubles.subToNew(exitTimes, I).getArray();

            // if there is more than one event, try splitting
            if (exitTimesByState[i].length > 1)
View Full Code Here

   
    @Override
    public IIntArray getNeighborIndexes(int index)
    {
        IIntArray neighborMultiIndexes = getNeighborMultiIndexes(getMultiIndex(index));
        preNeighborIndexes.setView(0, neighborMultiIndexes.rows());
        for (int i=0; i<neighborMultiIndexes.rows(); i++)
            preNeighborIndexes.set(i, getIndex(neighborMultiIndexes.getRow(i)));
        return(preNeighborIndexes);
    }
View Full Code Here

            intArrays.print(ptr[t]," ");
            System.out.println();
            */
        }
        //System.exit(0);
        IIntArray path = intsNew.array(ntime);
        path.set(ntime-1, doubleArrays.maxIndex(T1[ntime-1]));
        for (int t=ntime-2; t>=0; t--)
        {
            path.set(t, ptr[t+1][path.get(t+1)]);
        }

        return path;
    }
View Full Code Here

    }

    @Override
    public IDataSequence getNeighbors(int index)
    {
        IIntArray neighborMultiIndexes = getNeighborMultiIndexes(getMultiIndex(index));
        preNeighbors.setSize(neighborMultiIndexes.size());
        for (int i=0; i<preNeighbors.size(); i++)
            preNeighbors.set(i, getPoint(neighborMultiIndexes.get(i)));
        return(preNeighbors);
    }
View Full Code Here

        // define leaves
        int nClusters = _clusterMethodFull.getNumberOfClusters();
        for (int i=0; i<nClusters; i++)
        {
            IDoubleArray leafCenter = centers.get(i);
            IIntArray leafIndexes = ints.findAll(micro2macro, i);
            leaves.add(new Leaf(leafCenter, leafIndexes));
        }
    }
View Full Code Here

        //System.out.println("Reassignment table: "+IntArrays.toString(reassign));

        // assignment
        IDiscretization assignment = this.clusterMethodLeaves.getClusterAssignment();
        IDataSequence centers = this.clusterMethodLeaves.getClusterCenters();
        IIntArray micro2macroLeaf = cluster.discretize(subset, assignment);
        // update global assignment
        for (int i=0; i<leaf.indexes.size(); i++)
        {
            int globalIndex = leaf.indexes.get(i);
            int newClusterIndex = reassign[micro2macroLeaf.get(i)];
            micro2macro.set(globalIndex, newClusterIndex);
        }
        // create new leaves
        IIntArray[] newLeaveIndexes = new IIntArray[nPieces];
        for (int i=0; i<nPieces; i++)
View Full Code Here

    }
   
    public boolean split(IIntArray leafIndexes)
    {
        boolean couldsplit = false;
        IIntArray I = ints.sortedIndexes(leafIndexes);
        for (int i=I.size()-1; i>=0; i--)
        {
            int splitIndex = leafIndexes.get(I.get(i));
            if (split(splitIndex))
                couldsplit = true;
        }
        return couldsplit;
    }
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.