Package stallone.api.ints

Examples of stallone.api.ints.IIntArray


        connectivity.perform();

        List<IIntArray> C = connectivity.getStrongComponents();
//        int[][] C = g.BFS_mult();

        IIntArray complengths = Ints.create.array(C.size());
        for (int i=0; i<complengths.size(); i++)
            complengths.set(i, C.get(i).size());
        IIntArray I = Ints.util.sortedIndexes(complengths);
        Ints.util.mirror(I);
        C = Ints.util.subset(C, I);

        this.components = C;
View Full Code Here


        for (int i=0; i<f.size(); i++)
        {
            IDoubleArray xi = f.get(i);
            double Ei = f.f(xi);
            IIntArray neighbors = f.getNeighborIndexes(i);

            double psum = 0;

            for (int j=0; j<neighbors.size(); j++)
            {
                int n = neighbors.get(j);
                IDoubleArray xj = f.get(neighbors.get(j));
                double Ej = f.f(xj);
                double pjump = (1.0 / neighbors.size()) * Math.min(1, Math.exp(-(Ej-Ei) / kT));
                psum += pjump;
                _T.set(i, n, pjump);
            }
            _T.set(i,i, 1.0-psum);
        }
View Full Code Here

    public static IIntArray readDoubleArray(String str, String delimiters)
    {
        StringTokenizer tok = new StringTokenizer(str, delimiters);
        int n = tok.countTokens();
        IIntArray res = Ints.create.array(n);
        int k = 0;
        while(tok.hasMoreTokens())
            res.set(k++, StringTools.toInt(tok.nextToken()));
        return(res);
    }
View Full Code Here

        CompactRandomClustering C = new CompactRandomClustering(nclusters, nrepeats);
        C.setInput(data);
        C.setMetric(new EuclideanDistance());
        C.perform();

        IIntArray assign = C.getClusterIndexes();
        ints.print(assign,"","\n");
    }
View Full Code Here

        int nAttempts = 0;
        while (nfound < nClusters && nAttempts <= 10)
        {
            // decide which indexes should be centers
            IIntArray I = intsNew.arrayRandomIndexes(datasize, nsought);
            ints.sort(I);
            // get corresponding data points
            IDataList datapoints = select(I);

            // add new ones
            for (int i=0; i<I.size(); i++)
            {
                if (isNew(acceptedCenters, datapoints.get(i)))
                {
                    acceptedCenterIndexes.append(I.get(i));
                    acceptedCenters.add(datapoints.get(i));
                }
            }

            nfound = acceptedCenters.size();
View Full Code Here

        // no core found -> result trajectory is empty.
        if (ifirst >= traj.size())
            return(Ints.create.array(0));

        // create an array of the right size of the remaining trajectory
        IIntArray res = Ints.create.array(traj.size()-ifirst);
        int currentCore = state2core.get(traj.get(ifirst));
        for (int i=ifirst; i<traj.size(); i++)
        {
            // switch core?
            if (state2core.containsKey(traj.get(i)))
                currentCore = state2core.get(traj.get(i));

            res.set(i-ifirst, currentCore);
        }

        return(res);
    }
View Full Code Here

       Drops all Strings which contain nothing or only whitespaces and returns
       the remaining Strings.
     */
    public static String[] purgeEmpty(String[] arr)
    {
  IIntArray drop = Ints.create.array(0);
  for (int i=0; i<arr.length; i++)
      if (StringTools.split(arr[i]).length == 0)
    drop = Ints.util.mergeToNew(drop, i);
  IIntArray include = Ints.util.removeValueToNew
      (Ints.create.arrayRange(arr.length), drop);
  return(StringTools.subarray(arr, include));
    }
View Full Code Here

  return(res);
    }

    public static IIntArray toIntArray(String[] str)
    {
  IIntArray res = Ints.create.array(str.length);
  for (int i=0; i<str.length; i++)
      res.set(i, toInt(str[i]));
  return(res);
    }
View Full Code Here

  return(res);
    }

    public static IIntArray toIntMatrix(String[][] str)
    {
  IIntArray res = Ints.create.table(str.length,str[0].length);
  int r = 0;
  for (int i=0; i<str.length; i++)
      {
    if (str[i].length > 0)
        r++;
    for (int j=0; j<str[i].length; j++)
        res.set(i,j, toInt(str[i][j]));
      }
  return(Ints.util.subRowsToNew(res, Ints.create.arrayRange(r)));
    }
View Full Code Here

    /**
       Drops the selected lines
    */
    public static String[] drop(String[] arr, IIntArray droplist)
    {
  IIntArray include = Ints.util.removeValueToNew
      (Ints.create.arrayRange(arr.length), droplist);
  return(subarray(arr, include));
    }
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.