Tabnine Logo
ListUtilities
Code IndexAdd Tabnine to your IDE (free)

How to use
ListUtilities
in
com.oculusinfo.math.linearalgebra

Best Java code snippets using com.oculusinfo.math.linearalgebra.ListUtilities (Showing top 10 results out of 315)

origin: unchartedsoftware/aperture-tiles

List<Double> A = lists.remove(i);
List<Double> B = lists.remove(i);
lists.add(i, joinLists(A, B, epsilon));
origin: unchartedsoftware/aperture-tiles

if (equal(a, b, epsilon)) {
  while (nA < NA && equal(a, A.get(nA), epsilon)) ++nA;
  a = (nA < NA ? A.get(nA) : Double.MAX_VALUE);
  while (nB < NB && equal(b, B.get(nB), epsilon)) ++nB;
  b = (nB < NB ? B.get(nB) : Double.MAX_VALUE);
} else if (a < b) {
origin: unchartedsoftware/ensemble-clustering

List<Double> A = lists.remove(i);
List<Double> B = lists.remove(i);
lists.add(i, joinLists(A, B, epsilon));
origin: unchartedsoftware/ensemble-clustering

if (equal(a, b, epsilon)) {
  while (nA < NA && equal(a, A.get(nA), epsilon)) ++nA;
  a = (nA < NA ? A.get(nA) : Double.MAX_VALUE);
  while (nB < NB && equal(b, B.get(nB), epsilon)) ++nB;
  b = (nB < NB ? B.get(nB) : Double.MAX_VALUE);
} else if (a < b) {
origin: unchartedsoftware/aperture-tiles

@Test
public void testJoiningWithSingleton () {
  List<Double> base = Arrays.asList(0.0, 1.0, 2.0, 3.0, 4.0);
  Assert.assertEquals(Arrays.asList(-1.0, 0.0, 1.0, 2.0, 3.0, 4.0),
            ListUtilities.joinLists(base, Arrays.asList(-1.0), EPSILON));
  Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(0.0), EPSILON));
  Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(1.0), EPSILON));
  Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(2.0), EPSILON));
  Assert.assertEquals(Arrays.asList(0.0, 1.0, 2.0, 2.5, 3.0, 4.0),
            ListUtilities.joinLists(base, Arrays.asList(2.5), EPSILON));
  Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(3.0), EPSILON));
  Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(4.0), EPSILON));
  Assert.assertEquals(Arrays.asList(0.0, 1.0, 2.0, 3.0, 4.0, 5.0),
            ListUtilities.joinLists(base, Arrays.asList(5.0), EPSILON));
}
origin: unchartedsoftware/aperture-tiles

  @Test
  public void testJoiningWithZerosList () {
    List<Double> base = Arrays.asList(0.0, 1.0, 2.0, 3.0, 4.0);
    Assert.assertEquals(base, ListUtilities.joinLists(base, Arrays.asList(0.0, 0.0, 0.0, 0.0, 0.0), EPSILON));
  }
}
origin: unchartedsoftware/aperture-tiles

protected Track weightedAverageWithDirection (Track them, double ourWeight, double theirWeight) {
  double theirRelWeight = theirWeight/(ourWeight+theirWeight);
  // Get all parameterization points
  List<Double> ourParameterization = getParameterization();
  List<Double> theirParameterization = them.getParameterization();
  List<Double> joinedParameterization = ListUtilities.joinLists(ourParameterization,
                                 theirParameterization,
                                 _parameters.getPrecision());
  // Average the tracks along each parameterization point
  List<Position> meanPath = new ArrayList<Position>();
  for (double d: joinedParameterization) {
    Position pUs = getLengthParamterizedPoint(d);
    Position pThem = them.getLengthParamterizedPoint(d);
    Position weightedMean = interpolate(pUs, pThem, theirRelWeight);
    meanPath.add(weightedMean);
  }
  return createTrack(meanPath);
}
origin: unchartedsoftware/ensemble-clustering

protected Track weightedAverageWithDirection (Track them, double ourWeight, double theirWeight) {
  double theirRelWeight = theirWeight/(ourWeight+theirWeight);
  // Get all parameterization points
  List<Double> ourParameterization = getParameterization();
  List<Double> theirParameterization = them.getParameterization();
  List<Double> joinedParameterization = ListUtilities.joinLists(ourParameterization,
                                 theirParameterization,
                                 _parameters.getPrecision());
  // Average the tracks along each parameterization point
  List<Position> meanPath = new ArrayList<Position>();
  for (double d: joinedParameterization) {
    Position pUs = getLengthParamterizedPoint(d);
    Position pThem = them.getLengthParamterizedPoint(d);
    Position weightedMean = interpolate(pUs, pThem, theirRelWeight);
    meanPath.add(weightedMean);
  }
  return createTrack(meanPath);
}
origin: unchartedsoftware/aperture-tiles

private double getDistanceWithDirection (Track them) {
  List<Double> ourParameterization = getParameterization();
  List<Double> theirParameterization = them.getParameterization();
  List<Double> joinedParameterization = ListUtilities.joinLists(ourParameterization,
                                 theirParameterization,
                                 _parameters.getPrecision());
  Position pALast = null;
  Position pBLast = null;
  double dLast = 0;
  double totalDistance = 0.0;
  for (double d : joinedParameterization) {
    Position pA = getLengthParamterizedPoint(d);
    Position pB = them.getLengthParamterizedPoint(d);
    if (null != pALast) {
      double startDistance = getSegmentDistance(pALast, pBLast);
      double endDistance = getSegmentDistance(pA, pB);
      totalDistance += (startDistance + endDistance) / 2
               * (d - dLast);
    }
    dLast = d;
    pALast = pA;
    pBLast = pB;
  }
  return totalDistance / ((_length + them._length) / 2.0);
}
origin: unchartedsoftware/ensemble-clustering

private double getDistanceWithDirection (Track them) {
  List<Double> ourParameterization = getParameterization();
  List<Double> theirParameterization = them.getParameterization();
  List<Double> joinedParameterization = ListUtilities.joinLists(ourParameterization,
                                 theirParameterization,
                                 _parameters.getPrecision());
  Position pALast = null;
  Position pBLast = null;
  double dLast = 0;
  double totalDistance = 0.0;
  for (double d : joinedParameterization) {
    Position pA = getLengthParamterizedPoint(d);
    Position pB = them.getLengthParamterizedPoint(d);
    if (null != pALast) {
      double startDistance = getSegmentDistance(pALast, pBLast);
      double endDistance = getSegmentDistance(pA, pB);
      totalDistance += (startDistance + endDistance) / 2
               * (d - dLast);
    }
    dLast = d;
    pALast = pA;
    pBLast = pB;
  }
  return totalDistance / ((_length + them._length) / 2.0);
}
com.oculusinfo.math.linearalgebraListUtilities

Javadoc

Simple utilities to act on lists of objects.

Most used methods

  • joinLists
    Join together 2 ordered lists of doubles into a single, ordered list
  • equal

Popular in Java

  • Making http requests using okhttp
  • requestLocationUpdates (LocationManager)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Kernel (java.awt.image)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now