Package gnu.trove.list

Examples of gnu.trove.list.TDoubleList


        sort(0, size);
    }

    /** {@inheritDoc} */
    public void sort(int fromIndex, int toIndex) {
        TDoubleList tmp = subList(fromIndex, toIndex);
        double[] vals = tmp.toArray();
        Arrays.sort(vals);
        set(fromIndex, vals);
    }
View Full Code Here


        };
    }

    /** {@inheritDoc} */
    public TDoubleList grep(TDoubleProcedure condition) {
        TDoubleList ret = new TDoubleLinkedList();
        for (TDoubleLink l = head; got(l); l = l.getNext()) {
            if (condition.execute(l.getValue()))
                ret.add(l.getValue());
        }
        return ret;
    }
View Full Code Here

        return ret;
    }

    /** {@inheritDoc} */
    public TDoubleList inverseGrep(TDoubleProcedure condition) {
        TDoubleList ret = new TDoubleLinkedList();
        for (TDoubleLink l = head; got(l); l = l.getNext()) {
            if (!condition.execute(l.getValue()))
                ret.add(l.getValue());
        }
        return ret;
    }
View Full Code Here

    List<LabelList> labels = new ArrayList<LabelList>();
    try {
      for(String line; (line = reader.readLine()) != null; lineNumber++) {
        if(!line.startsWith(COMMENT) && line.length() > 0) {
          List<String> entries = tokenize(line);
          TDoubleList attributes = new TDoubleArrayList(entries.size());
          LabelList labellist = null;
          for(String entry : entries) {
            try {
              double attribute = Double.parseDouble(entry);
              attributes.add(attribute);
            }
            catch(NumberFormatException e) {
              if(labellist == null) {
                labellist = new LabelList(1);
              }
              labellist.add(entry);
            }
          }

          if(dimensionality < 0) {
            dimensionality = attributes.size();
          }
          else if(dimensionality != attributes.size()) {
            throw new IllegalArgumentException("Differing dimensionality in line " + lineNumber + ":" + attributes.size() + " != " + dimensionality);
          }
          vectors.add(ParameterizationFunction.STATIC.newNumberVector(attributes, ArrayLikeUtil.TDOUBLELISTADAPTER));
          labels.add(labellist);
        }
      }
View Full Code Here

        return result;
    }

    @Override
    public TDoubleList getAsDoubleArray() {
        TDoubleList result = new TDoubleArrayList(size());
        for (JsonElement element : array) {
            result.add(element.getAsDouble());
        }
        return result;
    }
View Full Code Here

        return data.getStringList();
    }

    @Override
    public TDoubleList getAsDoubleArray() {
        TDoubleList result = new TDoubleArrayList(data.getDoubleCount());
        for (int i = 0; i < data.getDoubleCount(); ++i) {
            result.add(data.getDouble(i));
        }
        return result;
    }
View Full Code Here

    protected abstract TObjectDoubleMap<String> gatherMetrics();

    private void displayMetrics(TObjectDoubleMap<String> metrics, StringBuilder builder) {
        final List<String> activities = Lists.newArrayList();
        final TDoubleList values = new TDoubleArrayList();
        sortMetrics(metrics, activities, values);

        for (int i = 0; i < limit && i < activities.size(); ++i) {
            builder.append(activities.get(i));
            builder.append(": ");
            builder.append(format.format(values.get(i)));
            builder.append(unit);
            builder.append("\n");
        }
    }
View Full Code Here

TOP

Related Classes of gnu.trove.list.TDoubleList

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.