--- old/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java 2019-04-19 11:38:02.888671100 -0700 +++ new/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java 2019-04-19 11:38:02.429701500 -0700 @@ -125,26 +125,26 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: *

{@code
-     * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
+     * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
      * }
* * @param species species of desired vector * @param a the byte array - * @param ix the offset into the array + * @param offset the offset into the array * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or - * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} + * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector fromByteArray(VectorSpecies species, byte[] a, int ix) { + public static DoubleVector fromByteArray(VectorSpecies species, byte[] a, int offset) { Objects.requireNonNull(a); - ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE); + offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class) species.boxType(), double.class, species.length(), - a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET, - a, ix, species, + a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET, + a, offset, species, (c, idx, s) -> { ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder()); DoubleBuffer tb = bbc.asDoubleBuffer(); @@ -161,51 +161,48 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: *

{@code
-     * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
+     * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
      * }
* * @param species species of desired vector * @param a the byte array - * @param ix the offset into the array + * @param offset the offset into the array * @param m the mask * @return a vector loaded from a byte array - * @throws IndexOutOfBoundsException if {@code i < 0} or - * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} - * @throws IndexOutOfBoundsException if the offset is {@code < 0}, - * or {@code > a.length}, + * @throws IndexOutOfBoundsException if {@code offset < 0} or * for any vector lane index {@code N} where the mask at lane {@code N} * is set - * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)} + * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline - public static DoubleVector fromByteArray(VectorSpecies species, byte[] a, int ix, VectorMask m) { - return zero(species).blend(fromByteArray(species, a, ix), m); + public static DoubleVector fromByteArray(VectorSpecies species, byte[] a, int offset, VectorMask m) { + return zero(species).blend(fromByteArray(species, a, offset), m); } /** * Loads a vector from an array starting at offset. *

* For each vector lane, where {@code N} is the vector lane index, the - * array element at index {@code i + N} is placed into the + * array element at index {@code offset + N} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code i < 0}, or - * {@code i > a.length - this.length()} + * @throws IndexOutOfBoundsException if {@code offset < 0}, or + * {@code offset > a.length - species.length()} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector fromArray(VectorSpecies species, double[] a, int i){ + public static DoubleVector fromArray(VectorSpecies species, double[] a, int offset){ Objects.requireNonNull(a); - i = VectorIntrinsics.checkIndex(i, a.length, species.length()); + offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); return VectorIntrinsics.load((Class) species.boxType(), double.class, species.length(), - a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_DOUBLE_BASE_OFFSET, - a, i, species, + a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_DOUBLE_BASE_OFFSET, + a, offset, species, (c, idx, s) -> ((DoubleSpecies)s).op(n -> c[idx + n])); } @@ -215,22 +212,22 @@ *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the array element at - * index {@code i + N} is placed into the resulting vector at lane index + * index {@code offset + N} is placed into the resulting vector at lane index * {@code N}, otherwise the default element value is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @param m the mask * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code i < 0}, or + * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} - * is set {@code i > a.length - N} + * is set {@code offset > a.length - N} */ @ForceInline - public static DoubleVector fromArray(VectorSpecies species, double[] a, int i, VectorMask m) { - return zero(species).blend(fromArray(species, a, i), m); + public static DoubleVector fromArray(VectorSpecies species, double[] a, int offset, VectorMask m) { + return zero(species).blend(fromArray(species, a, offset), m); } /** @@ -238,40 +235,40 @@ * map. *

* For each vector lane, where {@code N} is the vector lane index, the - * array element at index {@code i + indexMap[j + N]} is placed into the + * array element at index {@code a_offset + indexMap[i_offset + N]} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > indexMap.length - species.length()}, * or for any vector lane index {@code N} the result of - * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} + * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector fromArray(VectorSpecies species, double[] a, int i, int[] indexMap, int j) { + public static DoubleVector fromArray(VectorSpecies species, double[] a, int a_offset, int[] indexMap, int i_offset) { Objects.requireNonNull(a); Objects.requireNonNull(indexMap); if (species.length() == 1) { - return DoubleVector.fromArray(species, a, i + indexMap[j]); + return DoubleVector.fromArray(species, a, a_offset + indexMap[i_offset]); } - // Index vector: vix[0:n] = k -> i + indexMap[j + k] - IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, j).add(i); + // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k] + IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset); vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorIntrinsics.loadWithMap((Class) species.boxType(), double.class, species.length(), IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_DOUBLE_BASE_OFFSET, vix, - a, i, indexMap, j, species, + a, a_offset, indexMap, i_offset, species, (double[] c, int idx, int[] iMap, int idy, VectorSpecies s) -> ((DoubleSpecies)s).op(n -> c[idx + iMap[idy+n]])); } @@ -282,29 +279,29 @@ *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the array element at - * index {@code i + indexMap[j + N]} is placed into the resulting vector + * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector * at lane index {@code N}. * * @param species species of desired vector * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param m the mask * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @return the vector loaded from an array - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > indexMap.length - species.length()}, * or for any vector lane index {@code N} where the mask at lane - * {@code N} is set the result of {@code i + indexMap[j + N]} is + * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector fromArray(VectorSpecies species, double[] a, int i, VectorMask m, int[] indexMap, int j) { + public static DoubleVector fromArray(VectorSpecies species, double[] a, int a_offset, VectorMask m, int[] indexMap, int i_offset) { // @@@ This can result in out of bounds errors for unset mask lanes - return zero(species).blend(fromArray(species, a, i, indexMap, j), m); + return zero(species).blend(fromArray(species, a, a_offset, indexMap, i_offset), m); } @@ -317,31 +314,31 @@ *

* This method behaves as if it returns the result of calling the * byte buffer, offset, and mask accepting - * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows: + * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows: *

{@code
-     *   return this.fromByteBuffer(b, i, this.maskAllTrue())
+     *   return fromByteBuffer(b, offset, VectorMask.allTrue())
      * }
* * @param species species of desired vector * @param bb the byte buffer - * @param ix the offset into the byte buffer + * @param offset the offset into the byte buffer * @return a vector loaded from a byte buffer * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > b.limit()}, * or if there are fewer than - * {@code this.length() * this.elementSize() / Byte.SIZE} bytes + * {@code species.length() * species.elementSize() / Byte.SIZE} bytes * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int ix) { + public static DoubleVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } - ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE); + offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class) species.boxType(), double.class, species.length(), - U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix, - bb, ix, species, + U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset, + bb, offset, species, (c, idx, s) -> { ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder()); DoubleBuffer tb = bbc.asDoubleBuffer(); @@ -359,77 +356,77 @@ * the returned vector is loaded with a mask from a primitive array * obtained from the primitive buffer. * The following pseudocode expresses the behaviour, where - * {@coce EBuffer} is the primitive buffer type, {@code e} is the - * primitive element type, and {@code ESpecies} is the primitive + * {@code EBuffer} is the primitive buffer type, {@code e} is the + * primitive element type, and {@code ESpecies} is the primitive * species for {@code e}: *
{@code
      * EBuffer eb = b.duplicate().
-     *     order(ByteOrder.nativeOrder()).position(i).
+     *     order(ByteOrder.nativeOrder()).position(offset).
      *     asEBuffer();
-     * e[] es = new e[this.length()];
+     * e[] es = new e[species.length()];
      * for (int n = 0; n < t.length; n++) {
      *     if (m.isSet(n))
      *         es[n] = eb.get(n);
      * }
-     * Vector r = ((ESpecies)this).fromArray(es, 0, m);
+     * EVector r = EVector.fromArray(es, 0, m);
      * }
* * @param species species of desired vector * @param bb the byte buffer - * @param ix the offset into the byte buffer + * @param offset the offset into the byte buffer * @param m the mask * @return a vector loaded from a byte buffer * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > b.limit()}, * for any vector lane index {@code N} where the mask at lane {@code N} * is set - * {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)} + * {@code offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline - public static DoubleVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int ix, VectorMask m) { - return zero(species).blend(fromByteBuffer(species, bb, ix), m); + public static DoubleVector fromByteBuffer(VectorSpecies species, ByteBuffer bb, int offset, VectorMask m) { + return zero(species).blend(fromByteBuffer(species, bb, offset), m); } /** * Returns a vector where all lane elements are set to the primitive * value {@code e}. * - * @param s species of the desired vector + * @param species species of the desired vector * @param e the value * @return a vector of vector where all lane elements are set to * the primitive value {@code e} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector broadcast(VectorSpecies s, double e) { + public static DoubleVector broadcast(VectorSpecies species, double e) { return VectorIntrinsics.broadcastCoerced( - (Class) s.boxType(), double.class, s.length(), - Double.doubleToLongBits(e), s, + (Class) species.boxType(), double.class, species.length(), + Double.doubleToLongBits(e), species, ((bits, sp) -> ((DoubleSpecies)sp).op(i -> Double.longBitsToDouble((long)bits)))); } /** - * Returns a vector where each lane element is set to a given - * primitive value. + * Returns a vector where each lane element is set to given + * primitive values. *

* For each vector lane, where {@code N} is the vector lane index, the * the primitive value at index {@code N} is placed into the resulting * vector at lane index {@code N}. * - * @param s species of the desired vector + * @param species species of the desired vector * @param es the given primitive values - * @return a vector where each lane element is set to a given primitive - * value - * @throws IndexOutOfBoundsException if {@code es.length < this.length()} + * @return a vector where each lane element is set to given primitive + * values + * @throws IndexOutOfBoundsException if {@code es.length < species.length()} */ @ForceInline @SuppressWarnings("unchecked") - public static DoubleVector scalars(VectorSpecies s, double... es) { + public static DoubleVector scalars(VectorSpecies species, double... es) { Objects.requireNonNull(es); - int ix = VectorIntrinsics.checkIndex(0, es.length, s.length()); - return VectorIntrinsics.load((Class) s.boxType(), double.class, s.length(), + int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); + return VectorIntrinsics.load((Class) species.boxType(), double.class, species.length(), es, Unsafe.ARRAY_DOUBLE_BASE_OFFSET, - es, ix, s, + es, ix, species, (c, idx, sp) -> ((DoubleSpecies)sp).op(n -> c[idx + n])); } @@ -438,14 +435,14 @@ * value {@code e}, all other lane elements are set to the default * value. * - * @param s species of the desired vector + * @param species species of the desired vector * @param e the value * @return a vector where the first lane element is set to the primitive * value {@code e} */ @ForceInline - public static final DoubleVector single(VectorSpecies s, double e) { - return zero(s).with(0, e); + public static final DoubleVector single(VectorSpecies species, double e) { + return zero(species).with(0, e); } /** @@ -455,25 +452,28 @@ * The semantics are equivalent to calling * {@link ThreadLocalRandom#nextDouble()} * - * @param s species of the desired vector + * @param species species of the desired vector * @return a vector where each lane elements is set to a randomly * generated primitive value */ - public static DoubleVector random(VectorSpecies s) { + public static DoubleVector random(VectorSpecies species) { ThreadLocalRandom r = ThreadLocalRandom.current(); - return ((DoubleSpecies)s).op(i -> r.nextDouble()); + return ((DoubleSpecies)species).op(i -> r.nextDouble()); } // Ops + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector add(Vector v); /** * Adds this vector to the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive addition operation - * ({@code +}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive addition operation + * ({@code +}) to each lane. * * @param s the input scalar * @return the result of adding this vector to the broadcast of an input @@ -481,6 +481,9 @@ */ public abstract DoubleVector add(double s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector add(Vector v, VectorMask m); @@ -488,8 +491,8 @@ * Adds this vector to broadcast of an input scalar, * selecting lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive addition operation - * ({@code +}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive addition operation + * ({@code +}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -498,14 +501,17 @@ */ public abstract DoubleVector add(double s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector sub(Vector v); /** * Subtracts the broadcast of an input scalar from this vector. *

- * This is a vector binary operation where the primitive subtraction - * operation ({@code -}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive subtraction + * operation ({@code -}) to each lane. * * @param s the input scalar * @return the result of subtracting the broadcast of an input @@ -513,6 +519,9 @@ */ public abstract DoubleVector sub(double s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector sub(Vector v, VectorMask m); @@ -520,8 +529,8 @@ * Subtracts the broadcast of an input scalar from this vector, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive subtraction - * operation ({@code -}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive subtraction + * operation ({@code -}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -530,14 +539,17 @@ */ public abstract DoubleVector sub(double s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector mul(Vector v); /** * Multiplies this vector with the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive multiplication - * operation ({@code *}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive multiplication + * operation ({@code *}) to each lane. * * @param s the input scalar * @return the result of multiplying this vector with the broadcast of an @@ -545,6 +557,9 @@ */ public abstract DoubleVector mul(double s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector mul(Vector v, VectorMask m); @@ -552,8 +567,8 @@ * Multiplies this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

- * This is a vector binary operation where the primitive multiplication - * operation ({@code *}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive multiplication + * operation ({@code *}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -562,60 +577,87 @@ */ public abstract DoubleVector mul(double s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector neg(); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector neg(VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector abs(); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector abs(VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector min(Vector v); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector min(Vector v, VectorMask m); /** * Returns the minimum of this vector and the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements. + * This is a lane-wise binary operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to each lane. * * @param s the input scalar * @return the minimum of this vector and the broadcast of an input scalar */ public abstract DoubleVector min(double s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector max(Vector v); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector max(Vector v, VectorMask m); /** * Returns the maximum of this vector and the broadcast of an input scalar. *

- * This is a vector binary operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements. + * This is a lane-wise binary operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to each lane. * * @param s the input scalar * @return the maximum of this vector and the broadcast of an input scalar */ public abstract DoubleVector max(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask equal(Vector v); /** * Tests if this vector is equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive equals - * operation ({@code ==}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive equals + * operation ({@code ==}) each lane. * * @param s the input scalar * @return the result mask of testing if this vector is equal to the @@ -623,14 +665,17 @@ */ public abstract VectorMask equal(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask notEqual(Vector v); /** * Tests if this vector is not equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive not equals - * operation ({@code !=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive not equals + * operation ({@code !=}) to each lane. * * @param s the input scalar * @return the result mask of testing if this vector is not equal to the @@ -638,14 +683,17 @@ */ public abstract VectorMask notEqual(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask lessThan(Vector v); /** * Tests if this vector is less than the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive less than - * operation ({@code <}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive less than + * operation ({@code <}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is less than the @@ -653,14 +701,17 @@ */ public abstract VectorMask lessThan(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask lessThanEq(Vector v); /** * Tests if this vector is less or equal to the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive less than - * or equal to operation ({@code <=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive less than + * or equal to operation ({@code <=}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is less than or equal @@ -668,14 +719,17 @@ */ public abstract VectorMask lessThanEq(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask greaterThan(Vector v); /** * Tests if this vector is greater than the broadcast of an input scalar. *

- * This is a vector binary test operation where the primitive greater than - * operation ({@code >}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive greater than + * operation ({@code >}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is greater than the @@ -683,6 +737,9 @@ */ public abstract VectorMask greaterThan(double s); + /** + * {@inheritDoc} + */ @Override public abstract VectorMask greaterThanEq(Vector v); @@ -690,8 +747,8 @@ * Tests if this vector is greater than or equal to the broadcast of an * input scalar. *

- * This is a vector binary test operation where the primitive greater than - * or equal to operation ({@code >=}) is applied to lane elements. + * This is a lane-wise binary test operation which applies the primitive greater than + * or equal to operation ({@code >=}) to each lane. * * @param s the input scalar * @return the mask result of testing if this vector is greater than or @@ -699,6 +756,9 @@ */ public abstract VectorMask greaterThanEq(double s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector blend(Vector v, VectorMask m); @@ -719,33 +779,54 @@ */ public abstract DoubleVector blend(double s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector rearrange(Vector v, VectorShuffle s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector rearrange(VectorShuffle m); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector reshape(VectorSpecies s); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector rotateEL(int i); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector rotateER(int i); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector shiftEL(int i); + /** + * {@inheritDoc} + */ @Override public abstract DoubleVector shiftER(int i); /** * Divides this vector by an input vector. *

- * This is a vector binary operation where the primitive division - * operation ({@code /}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive division + * operation ({@code /}) to each lane. * * @param v the input vector * @return the result of dividing this vector by the input vector @@ -755,8 +836,8 @@ /** * Divides this vector by the broadcast of an input scalar. *

- * This is a vector binary operation where the primitive division - * operation ({@code /}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive division + * operation ({@code /}) to each lane. * * @param s the input scalar * @return the result of dividing this vector by the broadcast of an input @@ -768,8 +849,8 @@ * Divides this vector by an input vector, selecting lane elements * controlled by a mask. *

- * This is a vector binary operation where the primitive division - * operation ({@code /}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive division + * operation ({@code /}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection @@ -781,8 +862,8 @@ * Divides this vector by the broadcast of an input scalar, selecting lane * elements controlled by a mask. *

- * This is a vector binary operation where the primitive division - * operation ({@code /}) is applied to lane elements. + * This is a lane-wise binary operation which applies the primitive division + * operation ({@code /}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection @@ -794,8 +875,8 @@ /** * Calculates the square root of this vector. *

- * This is a vector unary operation where the {@link Math#sqrt} operation - * is applied to lane elements. + * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation + * to each lane. * * @return the square root of this vector */ @@ -805,8 +886,8 @@ * Calculates the square root of this vector, selecting lane elements * controlled by a mask. *

- * This is a vector unary operation where the {@link Math#sqrt} operation - * is applied to lane elements. + * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation + * to each lane. * * @param m the mask controlling lane selection * @return the square root of this vector @@ -818,8 +899,8 @@ /** * Calculates the trigonometric tangent of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#tan} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#tan} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#tan}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#tan} @@ -849,8 +930,8 @@ /** * Calculates the hyperbolic tangent of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#tanh} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#tanh} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#tanh}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#tanh} @@ -880,8 +961,8 @@ /** * Calculates the trigonometric sine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#sin} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#sin} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#sin}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#sin} @@ -911,8 +992,8 @@ /** * Calculates the hyperbolic sine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#sinh} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#sinh} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#sinh}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#sinh} @@ -942,8 +1023,8 @@ /** * Calculates the trigonometric cosine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#cos} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#cos} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#cos}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#cos} @@ -973,8 +1054,8 @@ /** * Calculates the hyperbolic cosine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#cosh} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#cosh} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#cosh}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#cosh} @@ -1004,8 +1085,8 @@ /** * Calculates the arc sine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#asin} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#asin} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#asin}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#asin} @@ -1035,8 +1116,8 @@ /** * Calculates the arc cosine of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#acos} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#acos} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#acos}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#acos} @@ -1066,8 +1147,8 @@ /** * Calculates the arc tangent of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#atan} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#atan} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#atan}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#atan} @@ -1097,8 +1178,8 @@ /** * Calculates the arc tangent of this vector divided by an input vector. *

- * This is a vector binary operation with same semantic definition as - * {@link Math#atan2} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#atan2} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#atan2}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#atan2} @@ -1116,8 +1197,8 @@ * Calculates the arc tangent of this vector divided by the broadcast of an * an input scalar. *

- * This is a vector binary operation with same semantic definition as - * {@link Math#atan2} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#atan2} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#atan2}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#atan2} @@ -1160,8 +1241,8 @@ /** * Calculates the cube root of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#cbrt} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#cbrt} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#cbrt}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#cbrt} @@ -1191,8 +1272,8 @@ /** * Calculates the natural logarithm of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#log} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#log} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#log}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#log} @@ -1222,8 +1303,8 @@ /** * Calculates the base 10 logarithm of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#log10} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#log10} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#log10}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#log10} @@ -1254,8 +1335,8 @@ * Calculates the natural logarithm of the sum of this vector and the * broadcast of {@code 1}. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#log1p} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#log1p} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#log1p}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#log1p} @@ -1287,8 +1368,8 @@ /** * Calculates this vector raised to the power of an input vector. *

- * This is a vector binary operation with same semantic definition as - * {@link Math#pow} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#pow} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#pow}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#pow} @@ -1306,8 +1387,8 @@ * Calculates this vector raised to the power of the broadcast of an input * scalar. *

- * This is a vector binary operation with same semantic definition as - * {@link Math#pow} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#pow} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#pow}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#pow} @@ -1353,8 +1434,8 @@ * Calculates the broadcast of Euler's number {@code e} raised to the power * of this vector. *

- * This is a vector unary operation with same semantic definition as - * {@link Math#exp} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#exp} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#exp}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#exp} @@ -1389,11 +1470,11 @@ * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code
-     *   this.exp().sub(this.species().broadcast(1))
+     *   this.exp().sub(EVector.broadcast(this.species(), 1))
      * }
*

- * This is a vector unary operation with same semantic definition as - * {@link Math#expm1} operation applied to lane elements. + * This is a lane-wise unary operation with same semantic definition as + * {@link Math#expm1} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#expm1}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#expm1} @@ -1414,7 +1495,7 @@ * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code
-     *   this.exp(m).sub(this.species().broadcast(1), m)
+     *   this.exp(m).sub(EVector.broadcast(this.species(), 1), m)
      * }
*

* Semantics for rounding, monotonicity, and special cases are @@ -1437,8 +1518,8 @@ * this.mul(v1).add(v2) * } *

- * This is a vector ternary operation where the {@link Math#fma} operation - * is applied to lane elements. + * This is a lane-wise ternary operation which applies the {@link Math#fma} operation + * to each lane. * * @param v1 the first input vector * @param v2 the second input vector @@ -1452,11 +1533,11 @@ * scalar summed with the broadcast of a second input scalar. * More specifically as if the following: *

{@code
-     *   this.fma(this.species().broadcast(s1), this.species().broadcast(s2))
+     *   this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2))
      * }
*

- * This is a vector ternary operation where the {@link Math#fma} operation - * is applied to lane elements. + * This is a lane-wise ternary operation which applies the {@link Math#fma} operation + * to each lane. * * @param s1 the first input scalar * @param s2 the second input scalar @@ -1474,8 +1555,8 @@ * this.mul(v1, m).add(v2, m) * } *

- * This is a vector ternary operation where the {@link Math#fma} operation - * is applied to lane elements. + * This is a lane-wise ternary operation which applies the {@link Math#fma} operation + * to each lane. * * @param v1 the first input vector * @param v2 the second input vector @@ -1493,11 +1574,11 @@ * elements controlled by a mask * More specifically as if the following: *

{@code
-     *   this.fma(this.species().broadcast(s1), this.species().broadcast(s2), m)
+     *   this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2), m)
      * }
*

- * This is a vector ternary operation where the {@link Math#fma} operation - * is applied to lane elements. + * This is a lane-wise ternary operation which applies the {@link Math#fma} operation + * to each lane. * * @param s1 the first input scalar * @param s2 the second input scalar @@ -1516,8 +1597,8 @@ * this.mul(this).add(v.mul(v)).sqrt() * } *

- * This is a vector binary operation with same semantic definition as - * {@link Math#hypot} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#hypot} operation applied to each lane. * The implementation is not required to return same * results as {@link Math#hypot}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#hypot} @@ -1538,11 +1619,11 @@ * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code
-     *   this.mul(this).add(this.species().broadcast(v * v)).sqrt()
+     *   this.mul(this).add(EVector.broadcast(this.species(), s * s)).sqrt()
      * }
*

- * This is a vector binary operation with same semantic definition as - * {@link Math#hypot} operation applied to lane elements. + * This is a lane-wise binary operation with same semantic definition as + * {@link Math#hypot} operation applied to each. * The implementation is not required to return same * results as {@link Math#hypot}, but adheres to rounding, monotonicity, * and special case semantics as defined in the {@link Math#hypot} @@ -1583,7 +1664,7 @@ * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code
-     *   this.mul(this, m).add(this.species().broadcast(v * v), m).sqrt(m)
+     *   this.mul(this, m).add(EVector.broadcast(this.species(), s * s), m).sqrt(m)
      * }
*

* Semantics for rounding, monotonicity, and special cases are @@ -1597,15 +1678,27 @@ public abstract DoubleVector hypot(double s, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteArray(byte[] a, int ix); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteArray(byte[] a, int ix, VectorMask m); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix); + /** + * {@inheritDoc} + */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask m); @@ -1614,8 +1707,8 @@ /** * Adds all lane elements of this vector. *

- * This is a vector reduction operation where the addition - * operation ({@code +}) is applied to lane elements, + * This is a cross-lane reduction operation which applies the addition + * operation ({@code +}) to lane elements, * and the identity value is {@code 0.0}. * *

The value of a floating-point sum is a function both of the input values as well @@ -1635,8 +1728,8 @@ * Adds all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is a vector reduction operation where the addition - * operation ({@code +}) is applied to lane elements, + * This is a cross-lane reduction operation which applies the addition + * operation ({@code +}) to lane elements, * and the identity value is {@code 0.0}. * *

The value of a floating-point sum is a function both of the input values as well @@ -1656,8 +1749,8 @@ /** * Multiplies all lane elements of this vector. *

- * This is a vector reduction operation where the - * multiplication operation ({@code *}) is applied to lane elements, + * This is a cross-lane reduction operation which applies the + * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1.0}. * *

The order of multiplication operations of this method @@ -1676,8 +1769,8 @@ * Multiplies all lane elements of this vector, selecting lane elements * controlled by a mask. *

- * This is a vector reduction operation where the - * multiplication operation ({@code *}) is applied to lane elements, + * This is a cross-lane reduction operation which applies the + * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1.0}. * *

The order of multiplication operations of this method @@ -1696,8 +1789,8 @@ /** * Returns the minimum lane element of this vector. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to lane elements, * and the identity value is * {@link Double#POSITIVE_INFINITY}. * @@ -1709,8 +1802,8 @@ * Returns the minimum lane element of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.min(a, b)} to lane elements, * and the identity value is * {@link Double#POSITIVE_INFINITY}. * @@ -1722,8 +1815,8 @@ /** * Returns the maximum lane element of this vector. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to lane elements, * and the identity value is * {@link Double#NEGATIVE_INFINITY}. * @@ -1735,8 +1828,8 @@ * Returns the maximum lane element of this vector, selecting lane elements * controlled by a mask. *

- * This is an associative vector reduction operation where the operation - * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, + * This is an associative cross-lane reduction operation which applies the operation + * {@code (a, b) -> Math.max(a, b)} to lane elements, * and the identity value is * {@link Double#NEGATIVE_INFINITY}. * @@ -1756,7 +1849,7 @@ * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ - public abstract double get(int i); + public abstract double lane(int i); /** * Replaces the lane element of this vector at lane index {@code i} with @@ -1803,30 +1896,30 @@ *

* For each vector lane, where {@code N} is the vector lane index, * the lane element at index {@code N} is stored into the array at index - * {@code i + N}. + * {@code offset + N}. * * @param a the array - * @param i the offset into the array - * @throws IndexOutOfBoundsException if {@code i < 0}, or - * {@code i > a.length - this.length()} + * @param offset the offset into the array + * @throws IndexOutOfBoundsException if {@code offset < 0}, or + * {@code offset > a.length - this.length()} */ - public abstract void intoArray(double[] a, int i); + public abstract void intoArray(double[] a, int offset); /** * Stores this vector into an array starting at offset and using a mask. *

* For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the lane element at - * index {@code N} is stored into the array index {@code i + N}. + * index {@code N} is stored into the array index {@code offset + N}. * * @param a the array - * @param i the offset into the array + * @param offset the offset into the array * @param m the mask - * @throws IndexOutOfBoundsException if {@code i < 0}, or + * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} - * is set {@code i >= a.length - N} + * is set {@code offset >= a.length - N} */ - public abstract void intoArray(double[] a, int i, VectorMask m); + public abstract void intoArray(double[] a, int offset, VectorMask m); /** * Stores this vector into an array using indexes obtained from an index @@ -1834,20 +1927,20 @@ *

* For each vector lane, where {@code N} is the vector lane index, the * lane element at index {@code N} is stored into the array at index - * {@code i + indexMap[j + N]}. + * {@code a_offset + indexMap[i_offset + N]}. * * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param indexMap the index map - * @param j the offset into the index map - * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * @param i_offset the offset into the index map + * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or + * {@code i_offset > indexMap.length - this.length()}, * or for any vector lane index {@code N} the result of - * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} + * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ - public abstract void intoArray(double[] a, int i, int[] indexMap, int j); + public abstract void intoArray(double[] a, int a_offset, int[] indexMap, int i_offset); /** * Stores this vector into an array using indexes obtained from an index @@ -1856,24 +1949,27 @@ * For each vector lane, where {@code N} is the vector lane index, * if the mask lane at index {@code N} is set then the lane element at * index {@code N} is stored into the array at index - * {@code i + indexMap[j + N]}. + * {@code a_offset + indexMap[i_offset + N]}. * * @param a the array - * @param i the offset into the array, may be negative if relative + * @param a_offset the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param m the mask * @param indexMap the index map - * @param j the offset into the index map + * @param i_offset the offset into the index map * @throws IndexOutOfBoundsException if {@code j < 0}, or - * {@code j > indexMap.length - this.length()}, + * {@code i_offset > indexMap.length - this.length()}, * or for any vector lane index {@code N} where the mask at lane - * {@code N} is set the result of {@code i + indexMap[j + N]} is + * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ - public abstract void intoArray(double[] a, int i, VectorMask m, int[] indexMap, int j); + public abstract void intoArray(double[] a, int a_offset, VectorMask m, int[] indexMap, int i_offset); // Species + /** + * {@inheritDoc} + */ @Override public abstract VectorSpecies species();