org.apache.sis.math.Vector.subList()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.sis.math.Vector.subList()方法的一些代码示例,展示了Vector.subList()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Vector.subList()方法的具体详情如下:
包路径:org.apache.sis.math.Vector
类名称:Vector
方法名:subList

Vector.subList介绍

[英]Returns a view which contain the values of this vector in the given index range. The returned view will contain the values from index lower inclusive to upper exclusive.

Implementation note: this method delegates its work #subSampling(int,int,int)(lower, 1, upper - lower). This method is declared final in order to force subclasses to override subSampling(…) instead.
[中]返回一个视图,其中包含给定索引范围内此向量的值。返回的视图将包含从索引下限到上限的值。
实现说明:此方法委派其工作[$0$]。此方法被声明为final,以强制子类重写子采样(…)。

代码示例

代码示例来源:origin: apache/sis

/**
 * Wraps the given array in a vector of length {@link #numPoints}. This method should be
 * invoked only when this builder has been created by {@link #LinearTransformBuilder()}.
 * This can be identified by {@code sources != null} or {@code gridSize == null}.
 */
private Vector vector(final double[] data) {
  assert gridSize == null;
  return Vector.create(data, false).subList(0, numPoints);
}

代码示例来源:origin: org.apache.sis.core/sis-referencing

/**
 * Wraps the given array in a vector of length {@link #numPoints}. This method should be
 * invoked only when this builder has been created by {@link #LinearTransformBuilder()}.
 * This can be identified by {@code sources != null} or {@code gridSize == null}.
 */
private Vector vector(final double[] data) {
  assert gridSize == null;
  return Vector.create(data, false).subList(0, numPoints);
}

代码示例来源:origin: apache/sis

final int offset = buffer.arrayOffset();
return ArrayVector.newInstance(buffer.array(), isUnsigned)
    .subList(offset + buffer.position(), offset + buffer.limit());

代码示例来源:origin: apache/sis

v = v.subList(dimension, length);                               // Skip the first coordinate.
length -= dimension;
if (length == 0) {

代码示例来源:origin: org.apache.sis.core/sis-feature

v = v.subList(dimension, length);                               // Skip the first coordinate.
length -= dimension;
if (length == 0) {

代码示例来源:origin: apache/sis

assertEquals(i*10, v3.floatValue(i), 0f);
assertSame("Should be able to restitute the original vector.", v1, v3.subList( 0, 40));
assertSame("Should be able to restitute the original vector.", v2, v3.subList(40, 60));

代码示例来源:origin: apache/sis

/**
 * Tests the case where values in a grid are repeated vertically.
 */
@Test
public void testVertical() {
  Vector vec = Vector.create(new int[] {
      10, 12, 15, 18,
      10, 12, 15, 18,
      10, 12, 15, 18}, false);
  vec = new RepeatedVector(vec, vec.repetitions(), 0);
  assertArrayEquals(new int[] {1,4}, vec.repetitions());
  assertEquals(10, vec.intValue  ( 0));
  assertEquals(12, vec.shortValue( 1));
  assertEquals(15, vec.longValue ( 2));
  assertEquals(18, vec.intValue  ( 3));
  assertEquals(10, vec.intValue  ( 4));
  assertEquals(18, vec.shortValue( 7));
  assertEquals(10, vec.longValue ( 8));
  assertEquals(15, vec.intValue  (10));
  Vector sub = vec.subList(0, 4);
  assertFalse("Expected the backing array.", sub instanceof RepeatedVector);
  assertArrayEquals(new float[] {10, 12, 15, 18}, sub.floatValues(), (float) STRICT);
}

相关文章