* Bytes are composed into primitive lane elements according to the * native byte order of the underlying platform *

* 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: *

{@code * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue()); * }* * @param species species of desired vector * @param a the byte array * @param offset the offset into the array * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset) { Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), 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()); $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();} return (($Type$Species)s).op(i -> tb.get()); }); } /** * Loads a vector from a byte array starting at an offset and using a * mask. *

* Bytes are composed into primitive lane elements according to the * native byte order of the underlying platform. *

* 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: *

{@code * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m); * }* * @param species species of desired vector * @param a the byte array * @param offset the offset into the array * @param m the mask * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code offset < 0} or * for any vector lane index {@code N} where the mask at lane {@code N} * is set * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset, VectorMask<$Boxtype$> 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 offset + N} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array * @param offset the offset into the array * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code offset < 0}, or * {@code offset > a.length - species.length()} */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset){ Objects.requireNonNull(a); offset = VectorIntrinsics.checkIndex(offset, a.length, species.length()); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET, a, offset, species, (c, idx, s) -> (($Type$Species)s).op(n -> c[idx + n])); } /** * Loads a vector from 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 array element at * 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 offset the offset into the array * @param m the mask * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} * is set {@code offset > a.length - N} */ @ForceInline public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset, VectorMask<$Boxtype$> m) { return zero(species).blend(fromArray(species, a, offset), m); } /** * Loads a vector from an array using indexes obtained from an index * map. *

* For each vector lane, where {@code N} is the vector lane index, 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 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 i_offset the offset into the index map * @return the vector loaded from an array * @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 a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ #if[byteOrShort] public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) { return (($Type$Species)species).op(n -> a[a_offset + indexMap[i_offset + n]]); } #else[byteOrShort] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) { Objects.requireNonNull(a); Objects.requireNonNull(indexMap); #if[longOrDouble] if (species.length() == 1) { return $abstractvectortype$.fromArray(species, a, a_offset + indexMap[i_offset]); } #end[longOrDouble] // 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<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), IntVector.species(species.indexShape()).vectorType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix, a, a_offset, indexMap, i_offset, species, ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) -> (($Type$Species)s).op(n -> c[idx + iMap[idy+n]])); } #end[byteOrShort] /** * Loads a vector from an array using indexes obtained from an index * map 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 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 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 i_offset the offset into the index map * @return the vector loaded from an array * @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 a_offset + indexMap[i_offset + N]} is * {@code < 0} or {@code >= a.length} */ #if[byteOrShort] public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset) { return (($Type$Species)species).op(m, n -> a[a_offset + indexMap[i_offset + n]]); } #else[byteOrShort] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, VectorMask<$Boxtype$> 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, a_offset, indexMap, i_offset), m); } #end[byteOrShort] /** * Loads a vector from a {@link ByteBuffer byte buffer} starting at an * offset into the byte buffer. *

* Bytes are composed into primitive lane elements according to the * native byte order of the underlying platform. *

* 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: *

{@code * return fromByteBuffer(b, offset, VectorMask.allTrue()) * }* * @param species species of desired vector * @param bb 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 species.length() * species.elementSize() / Byte.SIZE} bytes * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), 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()); $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();} return (($Type$Species)s).op(i -> tb.get()); }); } /** * Loads a vector from a {@link ByteBuffer byte buffer} starting at an * offset into the byte buffer and using a mask. *

* This method behaves as if the byte buffer is viewed as a primitive * {@link java.nio.Buffer buffer} for the primitive element type, * according to the native byte order of the underlying platform, and * the returned vector is loaded with a mask from a primitive array * obtained from the primitive buffer. * The following pseudocode expresses the behaviour, where * {@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(offset). * asEBuffer(); * e[] es = new e[species.length()]; * for (int n = 0; n < t.length; n++) { * if (m.isSet(n)) * es[n] = eb.get(n); * } * EVector r = EVector.fromArray(es, 0, m); * }* * @param species species of desired vector * @param bb 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 offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)} */ @ForceInline public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset, VectorMask<$Boxtype$> 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 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} */ #if[FP] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) { return VectorIntrinsics.broadcastCoerced( (Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), $Type$.$type$To$Bitstype$Bits(e), species, ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits)))); } #else[FP] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) { return VectorIntrinsics.broadcastCoerced( (Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), e, species, ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits))); } #end[FP] /** * 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 species species of the desired vector * @param es the given primitive values * @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 $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> species, $type$... es) { Objects.requireNonNull(es); int ix = VectorIntrinsics.checkIndex(0, es.length, species.length()); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.vectorType(), $type$.class, species.length(), es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, es, ix, species, (c, idx, sp) -> (($Type$Species)sp).op(n -> c[idx + n])); } /** * Returns a vector where the first lane element is set to the primtive * value {@code e}, all other lane elements are set to the default * value. * * @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 $abstractvectortype$ single(VectorSpecies<$Boxtype$> species, $type$ e) { return zero(species).with(0, e); } /** * Returns a vector where each lane element is set to a randomly * generated primitive value. * * The semantics are equivalent to calling #if[byteOrShort] * ($type$){@link ThreadLocalRandom#nextInt()} #else[byteOrShort] * {@link ThreadLocalRandom#next$Type$()} #end[byteOrShort] * * @param species species of the desired vector * @return a vector where each lane elements is set to a randomly * generated primitive value */ #if[intOrLong] public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)species).op(i -> r.next$Type$()); } #else[intOrLong] #if[FP] public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)species).op(i -> r.next$Type$()); } #else[FP] public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)species).op(i -> ($type$) r.nextInt()); } #end[FP] #end[intOrLong] // Ops /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ add(Vector<$Boxtype$> v); /** * Adds this vector to the broadcast of an input scalar. *

* 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 * scalar */ public abstract $abstractvectortype$ add($type$ s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Adds this vector to broadcast of an input scalar, * selecting lane elements controlled by a mask. *

* 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 * @return the result of adding this vector to the broadcast of an input * scalar */ public abstract $abstractvectortype$ add($type$ s, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v); /** * Subtracts the broadcast of an input scalar from this vector. *

* 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 * scalar from this vector */ public abstract $abstractvectortype$ sub($type$ s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Subtracts the broadcast of an input scalar from this vector, selecting * lane elements controlled by a mask. *

* 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 * @return the result of subtracting the broadcast of an input * scalar from this vector */ public abstract $abstractvectortype$ sub($type$ s, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v); /** * Multiplies this vector with the broadcast of an input scalar. *

* 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 * input scalar */ public abstract $abstractvectortype$ mul($type$ s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Multiplies this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

* 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 * @return the result of multiplying this vector with the broadcast of an * input scalar */ public abstract $abstractvectortype$ mul($type$ s, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ neg(); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ neg(VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ abs(); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ abs(VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ min(Vector<$Boxtype$> v); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Returns the minimum of this vector and the broadcast of an input scalar. *

* 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 $abstractvectortype$ min($type$ s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ max(Vector<$Boxtype$> v); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Returns the maximum of this vector and the broadcast of an input scalar. *

* 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 $abstractvectortype$ max($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> equal(Vector<$Boxtype$> v); /** * Tests if this vector is equal to the broadcast of an input scalar. *

* 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 * broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> equal($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> notEqual(Vector<$Boxtype$> v); /** * Tests if this vector is not equal to the broadcast of an input scalar. *

* 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 * broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> notEqual($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> lessThan(Vector<$Boxtype$> v); /** * Tests if this vector is less than the broadcast of an input scalar. *

* 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 * broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> lessThan($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v); /** * Tests if this vector is less or equal to the broadcast of an input scalar. *

* 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 * to the broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> lessThanEq($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> greaterThan(Vector<$Boxtype$> v); /** * Tests if this vector is greater than the broadcast of an input scalar. *

* 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 * broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> greaterThan($type$ s); /** * {@inheritDoc} */ @Override public abstract VectorMask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v); /** * Tests if this vector is greater than or equal to the broadcast of an * input scalar. *

* 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 * equal to the broadcast of an input scalar */ public abstract VectorMask<$Boxtype$> greaterThanEq($type$ s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Blends the lane elements of this vector with those of the broadcast of an * input scalar, selecting lanes controlled by a mask. *

* For each lane of the mask, at lane index {@code N}, if the mask lane * is set then the lane element at {@code N} from the input vector is * selected and placed into the resulting vector at {@code N}, * otherwise the the lane element at {@code N} from this input vector is * selected and placed into the resulting vector at {@code N}. * * @param s the input scalar * @param m the mask controlling lane selection * @return the result of blending the lane elements of this vector with * those of the broadcast of an input scalar */ public abstract $abstractvectortype$ blend($type$ s, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v, VectorShuffle<$Boxtype$> s, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ rearrange(VectorShuffle<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ rotateLanesLeft(int i); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ rotateLanesRight(int i); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ shiftLanesLeft(int i); /** * {@inheritDoc} */ @Override public abstract $abstractvectortype$ shiftLanesRight(int i); #if[FP] /** * Divides this vector by an input vector. *

* 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 */ public abstract $abstractvectortype$ div(Vector<$Boxtype$> v); /** * Divides this vector by the broadcast of an input scalar. *

* 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 * scalar */ public abstract $abstractvectortype$ div($type$ s); /** * Divides this vector by an input vector, selecting lane elements * controlled by a mask. *

* 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 * @return the result of dividing this vector by the input vector */ public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Divides this vector by the broadcast of an input scalar, selecting lane * elements controlled by a mask. *

* 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 * @return the result of dividing this vector by the broadcast of an input * scalar */ public abstract $abstractvectortype$ div($type$ s, VectorMask<$Boxtype$> m); /** * Calculates the square root of this vector. *

* This is a lane-wise unary operation which applies the {@link Math#sqrt} operation * to each lane. * * @return the square root of this vector */ public abstract $abstractvectortype$ sqrt(); /** * Calculates the square root of this vector, selecting lane elements * controlled by a mask. *

* 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 */ public $abstractvectortype$ sqrt(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a)); } /** * Calculates the trigonometric tangent of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the tangent of this vector */ public $abstractvectortype$ tan() { return uOp((i, a) -> ($type$) Math.tan((double) a)); } /** * Calculates the trigonometric tangent of this vector, selecting lane * elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#tan} * * @param m the mask controlling lane selection * @return the tangent of this vector */ public $abstractvectortype$ tan(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.tan((double) a)); } /** * Calculates the hyperbolic tangent of this vector. *

* 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} * specifications. The computed result will be within 2.5 ulps of the * exact result. * * @return the hyperbolic tangent of this vector */ public $abstractvectortype$ tanh() { return uOp((i, a) -> ($type$) Math.tanh((double) a)); } /** * Calculates the hyperbolic tangent of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#tanh} * * @param m the mask controlling lane selection * @return the hyperbolic tangent of this vector */ public $abstractvectortype$ tanh(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.tanh((double) a)); } /** * Calculates the trigonometric sine of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the sine of this vector */ public $abstractvectortype$ sin() { return uOp((i, a) -> ($type$) Math.sin((double) a)); } /** * Calculates the trigonometric sine of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#sin} * * @param m the mask controlling lane selection * @return the sine of this vector */ public $abstractvectortype$ sin(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.sin((double) a)); } /** * Calculates the hyperbolic sine of this vector. *

* 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} * specifications. The computed result will be within 2.5 ulps of the * exact result. * * @return the hyperbolic sine of this vector */ public $abstractvectortype$ sinh() { return uOp((i, a) -> ($type$) Math.sinh((double) a)); } /** * Calculates the hyperbolic sine of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#sinh} * * @param m the mask controlling lane selection * @return the hyperbolic sine of this vector */ public $abstractvectortype$ sinh(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.sinh((double) a)); } /** * Calculates the trigonometric cosine of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the cosine of this vector */ public $abstractvectortype$ cos() { return uOp((i, a) -> ($type$) Math.cos((double) a)); } /** * Calculates the trigonometric cosine of this vector, selecting lane * elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#cos} * * @param m the mask controlling lane selection * @return the cosine of this vector */ public $abstractvectortype$ cos(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.cos((double) a)); } /** * Calculates the hyperbolic cosine of this vector. *

* 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} * specifications. The computed result will be within 2.5 ulps of the * exact result. * * @return the hyperbolic cosine of this vector */ public $abstractvectortype$ cosh() { return uOp((i, a) -> ($type$) Math.cosh((double) a)); } /** * Calculates the hyperbolic cosine of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#cosh} * * @param m the mask controlling lane selection * @return the hyperbolic cosine of this vector */ public $abstractvectortype$ cosh(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.cosh((double) a)); } /** * Calculates the arc sine of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the arc sine of this vector */ public $abstractvectortype$ asin() { return uOp((i, a) -> ($type$) Math.asin((double) a)); } /** * Calculates the arc sine of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#asin} * * @param m the mask controlling lane selection * @return the arc sine of this vector */ public $abstractvectortype$ asin(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.asin((double) a)); } /** * Calculates the arc cosine of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the arc cosine of this vector */ public $abstractvectortype$ acos() { return uOp((i, a) -> ($type$) Math.acos((double) a)); } /** * Calculates the arc cosine of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#acos} * * @param m the mask controlling lane selection * @return the arc cosine of this vector */ public $abstractvectortype$ acos(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.acos((double) a)); } /** * Calculates the arc tangent of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the arc tangent of this vector */ public $abstractvectortype$ atan() { return uOp((i, a) -> ($type$) Math.atan((double) a)); } /** * Calculates the arc tangent of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#atan} * * @param m the mask controlling lane selection * @return the arc tangent of this vector */ public $abstractvectortype$ atan(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.atan((double) a)); } /** * Calculates the arc tangent of this vector divided by an input vector. *

* 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} * specifications. The computed result will be within 2 ulps of the * exact result. * * @param v the input vector * @return the arc tangent of this vector divided by the input vector */ public $abstractvectortype$ atan2(Vector<$Boxtype$> v) { return bOp(v, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b)); } /** * Calculates the arc tangent of this vector divided by the broadcast of an * an input scalar. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @param s the input scalar * @return the arc tangent of this vector over the input vector */ public abstract $abstractvectortype$ atan2($type$ s); /** * Calculates the arc tangent of this vector divided by an input vector, * selecting lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#atan2} * * @param v the input vector * @param m the mask controlling lane selection * @return the arc tangent of this vector divided by the input vector */ public $abstractvectortype$ atan2(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b)); } /** * Calculates the arc tangent of this vector divided by the broadcast of an * an input scalar, selecting lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#atan2} * * @param s the input scalar * @param m the mask controlling lane selection * @return the arc tangent of this vector over the input vector */ public abstract $abstractvectortype$ atan2($type$ s, VectorMask<$Boxtype$> m); /** * Calculates the cube root of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the cube root of this vector */ public $abstractvectortype$ cbrt() { return uOp((i, a) -> ($type$) Math.cbrt((double) a)); } /** * Calculates the cube root of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#cbrt} * * @param m the mask controlling lane selection * @return the cube root of this vector */ public $abstractvectortype$ cbrt(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a)); } /** * Calculates the natural logarithm of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the natural logarithm of this vector */ public $abstractvectortype$ log() { return uOp((i, a) -> ($type$) Math.log((double) a)); } /** * Calculates the natural logarithm of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#log} * * @param m the mask controlling lane selection * @return the natural logarithm of this vector */ public $abstractvectortype$ log(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.log((double) a)); } /** * Calculates the base 10 logarithm of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the base 10 logarithm of this vector */ public $abstractvectortype$ log10() { return uOp((i, a) -> ($type$) Math.log10((double) a)); } /** * Calculates the base 10 logarithm of this vector, selecting lane elements * controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#log10} * * @param m the mask controlling lane selection * @return the base 10 logarithm of this vector */ public $abstractvectortype$ log10(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.log10((double) a)); } /** * Calculates the natural logarithm of the sum of this vector and the * broadcast of {@code 1}. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the natural logarithm of the sum of this vector and the broadcast * of {@code 1} */ public $abstractvectortype$ log1p() { return uOp((i, a) -> ($type$) Math.log1p((double) a)); } /** * Calculates the natural logarithm of the sum of this vector and the * broadcast of {@code 1}, selecting lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#log1p} * * @param m the mask controlling lane selection * @return the natural logarithm of the sum of this vector and the broadcast * of {@code 1} */ public $abstractvectortype$ log1p(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.log1p((double) a)); } /** * Calculates this vector raised to the power of an input vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @param v the input vector * @return this vector raised to the power of an input vector */ public $abstractvectortype$ pow(Vector<$Boxtype$> v) { return bOp(v, (i, a, b) -> ($type$) Math.pow((double) a, (double) b)); } /** * Calculates this vector raised to the power of the broadcast of an input * scalar. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @param s the input scalar * @return this vector raised to the power of the broadcast of an input * scalar. */ public abstract $abstractvectortype$ pow($type$ s); /** * Calculates this vector raised to the power of an input vector, selecting * lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#pow} * * @param v the input vector * @param m the mask controlling lane selection * @return this vector raised to the power of an input vector */ public $abstractvectortype$ pow(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return bOp(v, m, (i, a, b) -> ($type$) Math.pow((double) a, (double) b)); } /** * Calculates this vector raised to the power of the broadcast of an input * scalar, selecting lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#pow} * * @param s the input scalar * @param m the mask controlling lane selection * @return this vector raised to the power of the broadcast of an input * scalar. */ public abstract $abstractvectortype$ pow($type$ s, VectorMask<$Boxtype$> m); /** * Calculates the broadcast of Euler's number {@code e} raised to the power * of this vector. *

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the broadcast of Euler's number {@code e} raised to the power of * this vector */ public $abstractvectortype$ exp() { return uOp((i, a) -> ($type$) Math.exp((double) a)); } /** * Calculates the broadcast of Euler's number {@code e} raised to the power * of this vector, selecting lane elements controlled by a mask. *

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#exp} * * @param m the mask controlling lane selection * @return the broadcast of Euler's number {@code e} raised to the power of * this vector */ public $abstractvectortype$ exp(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.exp((double) a)); } /** * Calculates the broadcast of Euler's number {@code e} raised to the power * of this vector minus the broadcast of {@code -1}. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

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

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @return the broadcast of Euler's number {@code e} raised to the power of * this vector minus the broadcast of {@code -1} */ public $abstractvectortype$ expm1() { return uOp((i, a) -> ($type$) Math.expm1((double) a)); } /** * Calculates the broadcast of Euler's number {@code e} raised to the power * of this vector minus the broadcast of {@code -1}, selecting lane elements * controlled by a mask * More specifically as if the following (ignoring any differences in * numerical accuracy): *

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

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#expm1} * * @param m the mask controlling lane selection * @return the broadcast of Euler's number {@code e} raised to the power of * this vector minus the broadcast of {@code -1} */ public $abstractvectortype$ expm1(VectorMask<$Boxtype$> m) { return uOp(m, (i, a) -> ($type$) Math.expm1((double) a)); } /** * Calculates the product of this vector and a first input vector summed * with a second input vector. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code * this.mul(v1).add(v2) * }*

* 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 * @return the product of this vector and the first input vector summed with * the second input vector */ public abstract $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2); /** * Calculates the product of this vector and the broadcast of a first input * scalar summed with the broadcast of a second input scalar. * More specifically as if the following: *

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

* 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 * @return the product of this vector and the broadcast of a first input * scalar summed with the broadcast of a second input scalar */ public abstract $abstractvectortype$ fma($type$ s1, $type$ s2); /** * Calculates the product of this vector and a first input vector summed * with a second input vector, selecting lane elements controlled by a mask. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code * this.mul(v1, m).add(v2, m) * }*

* 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 * @param m the mask controlling lane selection * @return the product of this vector and the first input vector summed with * the second input vector */ public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) { return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c)); } /** * Calculates the product of this vector and the broadcast of a first input * scalar summed with the broadcast of a second input scalar, selecting lane * elements controlled by a mask * More specifically as if the following: *

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

* 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 * @param m the mask controlling lane selection * @return the product of this vector and the broadcast of a first input * scalar summed with the broadcast of a second input scalar */ public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, VectorMask<$Boxtype$> m); /** * Calculates square root of the sum of the squares of this vector and an * input vector. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code * this.mul(this).add(v.mul(v)).sqrt() * }*

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @param v the input vector * @return square root of the sum of the squares of this vector and an input * vector */ public $abstractvectortype$ hypot(Vector<$Boxtype$> v) { return bOp(v, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b)); } /** * Calculates square root of the sum of the squares of this vector and the * broadcast of an input scalar. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

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

* 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} * specifications. The computed result will be within 1 ulp of the * exact result. * * @param s the input scalar * @return square root of the sum of the squares of this vector and the * broadcast of an input scalar */ public abstract $abstractvectortype$ hypot($type$ s); /** * Calculates square root of the sum of the squares of this vector and an * input vector, selecting lane elements controlled by a mask. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

{@code * this.mul(this, m).add(v.mul(v), m).sqrt(m) * }*

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#hypot} * * @param v the input vector * @param m the mask controlling lane selection * @return square root of the sum of the squares of this vector and an input * vector */ public $abstractvectortype$ hypot(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b)); } /** * Calculates square root of the sum of the squares of this vector and the * broadcast of an input scalar, selecting lane elements controlled by a * mask. * More specifically as if the following (ignoring any differences in * numerical accuracy): *

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

* Semantics for rounding, monotonicity, and special cases are * described in {@link $abstractvectortype$#hypot} * * @param s the input scalar * @param m the mask controlling lane selection * @return square root of the sum of the squares of this vector and the * broadcast of an input scalar */ public abstract $abstractvectortype$ hypot($type$ s, VectorMask<$Boxtype$> m); #end[FP] #if[BITWISE] /** * Bitwise ANDs this vector with an input vector. *

* This is a lane-wise binary operation which applies the primitive bitwise AND * operation ({@code &}) to each lane. * * @param v the input vector * @return the bitwise AND of this vector with the input vector */ public abstract $abstractvectortype$ and(Vector<$Boxtype$> v); /** * Bitwise ANDs this vector with the broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive bitwise AND * operation ({@code &}) to each lane. * * @param s the input scalar * @return the bitwise AND of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ and($type$ s); /** * Bitwise ANDs this vector with an input vector, selecting lane elements * controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise AND * operation ({@code &}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise AND of this vector with the input vector */ public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Bitwise ANDs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise AND * operation ({@code &}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection * @return the bitwise AND of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ and($type$ s, VectorMask<$Boxtype$> m); /** * Bitwise ORs this vector with an input vector. *

* This is a lane-wise binary operation which applies the primitive bitwise OR * operation ({@code |}) to each lane. * * @param v the input vector * @return the bitwise OR of this vector with the input vector */ public abstract $abstractvectortype$ or(Vector<$Boxtype$> v); /** * Bitwise ORs this vector with the broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive bitwise OR * operation ({@code |}) to each lane. * * @param s the input scalar * @return the bitwise OR of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ or($type$ s); /** * Bitwise ORs this vector with an input vector, selecting lane elements * controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise OR * operation ({@code |}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise OR of this vector with the input vector */ public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Bitwise ORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise OR * operation ({@code |}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection * @return the bitwise OR of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ or($type$ s, VectorMask<$Boxtype$> m); /** * Bitwise XORs this vector with an input vector. *

* This is a lane-wise binary operation which applies the primitive bitwise XOR * operation ({@code ^}) to each lane. * * @param v the input vector * @return the bitwise XOR of this vector with the input vector */ public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v); /** * Bitwise XORs this vector with the broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive bitwise XOR * operation ({@code ^}) to each lane. * * @param s the input scalar * @return the bitwise XOR of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ xor($type$ s); /** * Bitwise XORs this vector with an input vector, selecting lane elements * controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise XOR * operation ({@code ^}) to each lane. * * @param v the input vector * @param m the mask controlling lane selection * @return the bitwise XOR of this vector with the input vector */ public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m); /** * Bitwise XORs this vector with the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive bitwise XOR * operation ({@code ^}) to each lane. * * @param s the input scalar * @param m the mask controlling lane selection * @return the bitwise XOR of this vector with the broadcast of an input * scalar */ public abstract $abstractvectortype$ xor($type$ s, VectorMask<$Boxtype$> m); /** * Bitwise NOTs this vector. *

* This is a lane-wise unary operation which applies the primitive bitwise NOT * operation ({@code ~}) to each lane. * * @return the bitwise NOT of this vector */ public abstract $abstractvectortype$ not(); /** * Bitwise NOTs this vector, selecting lane elements controlled by a mask. *

* This is a lane-wise unary operation which applies the primitive bitwise NOT * operation ({@code ~}) to each lane. * * @param m the mask controlling lane selection * @return the bitwise NOT of this vector */ public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m); /** * Logically left shifts this vector by the broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane to left shift the * element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to left shift * @return the result of logically left shifting left this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftLeft(int s); /** * Logically left shifts this vector by the broadcast of an input scalar, * selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane to left shift the * element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to left shift * @param m the mask controlling lane selection * @return the result of logically left shifting left this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftLeft(int s, VectorMask<$Boxtype$> m); /** * Logically left shifts this vector by an input vector. *

* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @return the result of logically left shifting this vector by the input * vector */ public abstract $abstractvectortype$ shiftLeft(Vector<$Boxtype$> v); /** * Logically left shifts this vector by an input vector, selecting lane * elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical left shift * operation ({@code <<}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @param m the mask controlling lane selection * @return the result of logically left shifting this vector by the input * vector */ public $abstractvectortype$ shiftLeft(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return blend(shiftLeft(v), m); } // logical, or unsigned, shift right /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive logical right shift * operation ({@code >>>}) to each lane to logically right shift the * element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to right shift * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftRight(int s); /** * Logically right shifts (or unsigned right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. *

* This is a lane-wise binary operation which applies the primitive logical right shift * operation ({@code >>}) to each lane to logically right shift the * element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of logically right shifting this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftRight(int s, VectorMask<$Boxtype$> m); /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector. *

* This is a lane-wise binary operation which applies the primitive logical right shift * operation ({@code >>>}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @return the result of logically right shifting this vector by the * input vector */ public abstract $abstractvectortype$ shiftRight(Vector<$Boxtype$> v); /** * Logically right shifts (or unsigned right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive logical right shift * operation ({@code >>>}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift value * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @param m the mask controlling lane selection * @return the result of logically right shifting this vector by the * input vector */ public $abstractvectortype$ shiftRight(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return blend(shiftRight(v), m); } /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar. *

* This is a lane-wise binary operation which applies the primitive arithmetic right * shift operation ({@code >>}) to each lane to arithmetically * right shift the element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to right shift * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftArithmeticRight(int s); /** * Arithmetically right shifts (or signed right shifts) this vector by the * broadcast of an input scalar, selecting lane elements controlled by a * mask. *

* This is a lane-wise binary operation which applies the primitive arithmetic right * shift operation ({@code >>}) to each lane to arithmetically * right shift the element by shift value as specified by the input scalar. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param s the input scalar; the number of the bits to right shift * @param m the mask controlling lane selection * @return the result of arithmetically right shifting this vector by the * broadcast of an input scalar */ public abstract $abstractvectortype$ shiftArithmeticRight(int s, VectorMask<$Boxtype$> m); /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector. *

* This is a lane-wise binary operation which applies the primitive arithmetic right * shift operation ({@code >>}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @return the result of arithmetically right shifting this vector by the * input vector */ public abstract $abstractvectortype$ shiftArithmeticRight(Vector<$Boxtype$> v); /** * Arithmetically right shifts (or signed right shifts) this vector by an * input vector, selecting lane elements controlled by a mask. *

* This is a lane-wise binary operation which applies the primitive arithmetic right * shift operation ({@code >>}) to each lane. For each lane of this vector, the * shift value is the corresponding lane of input vector. #if[byte] * Only the 3 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. * The shift distance actually used is therefore always in the range 0 to 7, inclusive. #end[byte] #if[short] * Only the 4 lowest-order bits of shift value are used. It is as if the shift * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. * The shift distance actually used is therefore always in the range 0 to 15, inclusive. #end[short] * * @param v the input vector * @param m the mask controlling lane selection * @return the result of arithmetically right shifting this vector by the * input vector */ public $abstractvectortype$ shiftArithmeticRight(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) { return blend(shiftArithmeticRight(v), m); } /** * Rotates left this vector by the broadcast of an input scalar. *

#if[intOrLong] * This is a lane-wise binary operation which applies the operation * {@link $Wideboxtype$#rotateLeft} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). #end[intOrLong] #if[byte] * This is a lane-wise binary operation which produces the result of rotating left the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x7. #end[byte] #if[short] * This is a lane-wise binary operation which produces the result of rotating left the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x15. #end[short] * * @param s the input scalar; the number of the bits to rotate left * @return the result of rotating left this vector by the broadcast of an * input scalar */ @ForceInline public final $abstractvectortype$ rotateLeft(int s) { return shiftLeft(s).or(shiftRight(-s)); } /** * Rotates left this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

#if[intOrLong] * This is a lane-wise binary operation which applies the operation * {@link $Wideboxtype$#rotateLeft} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). #end[intOrLong] #if[byte] * This is a lane-wise binary operation which produces the result of rotating left the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x7. #end[byte] #if[short] * This is a lane-wise binary operation which produces the result of rotating left the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x15. #end[short] * * @param s the input scalar; the number of the bits to rotate left * @param m the mask controlling lane selection * @return the result of rotating left this vector by the broadcast of an * input scalar */ @ForceInline public final $abstractvectortype$ rotateLeft(int s, VectorMask<$Boxtype$> m) { return shiftLeft(s, m).or(shiftRight(-s, m), m); } /** * Rotates right this vector by the broadcast of an input scalar. *

#if[intOrLong] * This is a lane-wise binary operation which applies the operation * {@link $Wideboxtype$#rotateRight} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). #end[intOrLong] #if[byte] * This is a lane-wise binary operation which produces the result of rotating right the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x7. #end[byte] #if[short] * This is a lane-wise binary operation which produces the result of rotating right the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x15. #end[short] * * @param s the input scalar; the number of the bits to rotate right * @return the result of rotating right this vector by the broadcast of an * input scalar */ @ForceInline public final $abstractvectortype$ rotateRight(int s) { return shiftRight(s).or(shiftLeft(-s)); } /** * Rotates right this vector by the broadcast of an input scalar, selecting * lane elements controlled by a mask. *

#if[intOrLong] * This is a lane-wise binary operation which applies the operation * {@link $Wideboxtype$#rotateRight} to each lane and where * lane elements of this vector apply to the first argument, and lane * elements of the broadcast vector apply to the second argument (the * rotation distance). #end[intOrLong] #if[byte] * This is a lane-wise binary operation which produces the result of rotating right the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 8 is a no-op, so only the 3 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x7. #end[byte] #if[short] * This is a lane-wise binary operation which produces the result of rotating right the two's * complement binary representation of each lane of first operand (this vector) by input scalar. * Rotation by any multiple of 16 is a no-op, so only the 4 lowest-order bits of input value are used. * It is as if the input value were subjected to a bitwise logical * AND operator ({@code &}) with the mask value 0x15. #end[short] * * @param s the input scalar; the number of the bits to rotate right * @param m the mask controlling lane selection * @return the result of rotating right this vector by the broadcast of an * input scalar */ @ForceInline public final $abstractvectortype$ rotateRight(int s, VectorMask<$Boxtype$> m) { return shiftRight(s, m).or(shiftLeft(-s, m), m); } #end[BITWISE] /** * {@inheritDoc} */ @Override public abstract void intoByteArray(byte[] a, int ix); /** * {@inheritDoc} */ @Override public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m); /** * {@inheritDoc} */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix); /** * {@inheritDoc} */ @Override public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<$Boxtype$> m); // Type specific horizontal reductions /** * Adds all lane elements of this vector. *

#if[FP] * 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 * as the order of addition operations. The order of addition operations of this method * is intentionally not defined to allow for JVM to generate optimal machine * code for the underlying platform at runtime. If the platform supports a vector * instruction to add all values in the vector, or if there is some other efficient machine * code sequence, then the JVM has the option of generating this machine code. Otherwise, * the default implementation of adding vectors sequentially from left to right is used. * For this reason, the output of this method may vary for the same input values. #else[FP] * This is an associative cross-lane reduction operation which applies the addition * operation ({@code +}) to lane elements, * and the identity value is {@code 0}. #end[FP] * * @return the addition of all the lane elements of this vector */ public abstract $type$ addAll(); /** * Adds all lane elements of this vector, selecting lane elements * controlled by a mask. *

#if[FP] * 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 * as the order of addition operations. The order of addition operations of this method * is intentionally not defined to allow for JVM to generate optimal machine * code for the underlying platform at runtime. If the platform supports a vector * instruction to add all values in the vector, or if there is some other efficient machine * code sequence, then the JVM has the option of generating this machine code. Otherwise, * the default implementation of adding vectors sequentially from left to right is used. * For this reason, the output of this method may vary on the same input values. #else[FP] * This is an associative cross-lane reduction operation which applies the addition * operation ({@code +}) to lane elements, * and the identity value is {@code 0}. #end[FP] * * @param m the mask controlling lane selection * @return the addition of the selected lane elements of this vector */ public abstract $type$ addAll(VectorMask<$Boxtype$> m); /** * Multiplies all lane elements of this vector. *

#if[FP] * 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 * is intentionally not defined to allow for JVM to generate optimal machine * code for the underlying platform at runtime. If the platform supports a vector * instruction to multiply all values in the vector, or if there is some other efficient machine * code sequence, then the JVM has the option of generating this machine code. Otherwise, * the default implementation of multiplying vectors sequentially from left to right is used. * For this reason, the output of this method may vary on the same input values. #else[FP] * This is an associative cross-lane reduction operation which applies the * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1}. #end[FP] * * @return the multiplication of all the lane elements of this vector */ public abstract $type$ mulAll(); /** * Multiplies all lane elements of this vector, selecting lane elements * controlled by a mask. *

#if[FP] * 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 * is intentionally not defined to allow for JVM to generate optimal machine * code for the underlying platform at runtime. If the platform supports a vector * instruction to multiply all values in the vector, or if there is some other efficient machine * code sequence, then the JVM has the option of generating this machine code. Otherwise, * the default implementation of multiplying vectors sequentially from left to right is used. * For this reason, the output of this method may vary on the same input values. #else[FP] * This is an associative cross-lane reduction operation which applies the * multiplication operation ({@code *}) to lane elements, * and the identity value is {@code 1}. #end[FP] * * @param m the mask controlling lane selection * @return the multiplication of all the lane elements of this vector */ public abstract $type$ mulAll(VectorMask<$Boxtype$> m); /** * Returns the minimum lane element of this vector. *

* 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 #if[FP] * {@link $Boxtype$#POSITIVE_INFINITY}. #else[FP] * {@link $Boxtype$#MAX_VALUE}. #end[FP] * * @return the minimum lane element of this vector */ public abstract $type$ minAll(); /** * Returns the minimum lane element of this vector, selecting lane elements * controlled by a mask. *

* 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 #if[FP] * {@link $Boxtype$#POSITIVE_INFINITY}. #else[FP] * {@link $Boxtype$#MAX_VALUE}. #end[FP] * * @param m the mask controlling lane selection * @return the minimum lane element of this vector */ public abstract $type$ minAll(VectorMask<$Boxtype$> m); /** * Returns the maximum lane element of this vector. *

* 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 #if[FP] * {@link $Boxtype$#NEGATIVE_INFINITY}. #else[FP] * {@link $Boxtype$#MIN_VALUE}. #end[FP] * * @return the maximum lane element of this vector */ public abstract $type$ maxAll(); /** * Returns the maximum lane element of this vector, selecting lane elements * controlled by a mask. *

* 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 #if[FP] * {@link $Boxtype$#NEGATIVE_INFINITY}. #else[FP] * {@link $Boxtype$#MIN_VALUE}. #end[FP] * * @param m the mask controlling lane selection * @return the maximum lane element of this vector */ public abstract $type$ maxAll(VectorMask<$Boxtype$> m); #if[BITWISE] /** * Logically ORs all lane elements of this vector. *

* This is an associative cross-lane reduction operation which applies the logical OR * operation ({@code |}) to lane elements, * and the identity value is {@code 0}. * * @return the logical OR all the lane elements of this vector */ public abstract $type$ orAll(); /** * Logically ORs all lane elements of this vector, selecting lane elements * controlled by a mask. *

* This is an associative cross-lane reduction operation which applies the logical OR * operation ({@code |}) to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection * @return the logical OR all the lane elements of this vector */ public abstract $type$ orAll(VectorMask<$Boxtype$> m); /** * Logically ANDs all lane elements of this vector. *

* This is an associative cross-lane reduction operation which applies the logical AND * operation ({@code |}) to lane elements, * and the identity value is {@code -1}. * * @return the logical AND all the lane elements of this vector */ public abstract $type$ andAll(); /** * Logically ANDs all lane elements of this vector, selecting lane elements * controlled by a mask. *

* This is an associative cross-lane reduction operation which applies the logical AND * operation ({@code |}) to lane elements, * and the identity value is {@code -1}. * * @param m the mask controlling lane selection * @return the logical AND all the lane elements of this vector */ public abstract $type$ andAll(VectorMask<$Boxtype$> m); /** * Logically XORs all lane elements of this vector. *

* This is an associative cross-lane reduction operation which applies the logical XOR * operation ({@code ^}) to lane elements, * and the identity value is {@code 0}. * * @return the logical XOR all the lane elements of this vector */ public abstract $type$ xorAll(); /** * Logically XORs all lane elements of this vector, selecting lane elements * controlled by a mask. *

* This is an associative cross-lane reduction operation which applies the logical XOR * operation ({@code ^}) to lane elements, * and the identity value is {@code 0}. * * @param m the mask controlling lane selection * @return the logical XOR all the lane elements of this vector */ public abstract $type$ xorAll(VectorMask<$Boxtype$> m); #end[BITWISE] // Type specific accessors /** * Gets the lane element at lane index {@code i} * * @param i the lane index * @return the lane element at lane index {@code i} * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ public abstract $type$ lane(int i); /** * Replaces the lane element of this vector at lane index {@code i} with * value {@code e}. *

* This is a cross-lane operation and behaves as if it returns the result * of blending this vector with an input vector that is the result of * broadcasting {@code e} and a mask that has only one lane set at lane * index {@code i}. * * @param i the lane index of the lane element to be replaced * @param e the value to be placed * @return the result of replacing the lane element of this vector at lane * index {@code i} with value {@code e}. * @throws IllegalArgumentException if the index is is out of range * ({@code < 0 || >= length()}) */ public abstract $abstractvectortype$ with(int i, $type$ e); // Type specific extractors /** * Returns an array containing the lane elements of this vector. *

* This method behaves as if it {@link #intoArray($type$[], int)} stores} * this vector into an allocated array and returns the array as follows: *

{@code * $type$[] a = new $type$[this.length()]; * this.intoArray(a, 0); * return a; * }* * @return an array containing the the lane elements of this vector */ @ForceInline public final $type$[] toArray() { $type$[] a = new $type$[species().length()]; intoArray(a, 0); return a; } /** * Stores this vector into an array starting at offset. *

* 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 offset + N}. * * @param a the array * @param offset the offset into the array * @throws IndexOutOfBoundsException if {@code offset < 0}, or * {@code offset > a.length - this.length()} */ public abstract void intoArray($type$[] 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 offset + N}. * * @param a the array * @param offset the offset into the array * @param m the mask * @throws IndexOutOfBoundsException if {@code offset < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} * is set {@code offset >= a.length - N} */ public abstract void intoArray($type$[] a, int offset, VectorMask<$Boxtype$> m); /** * Stores this vector into an array using indexes obtained from an index * map. *

* 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 a_offset + indexMap[i_offset + N]}. * * @param a the array * @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 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 a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length} */ #if[byteOrShort] public void intoArray($type$[] a, int a_offset, int[] indexMap, int i_offset) { forEach((n, e) -> a[a_offset + indexMap[i_offset + n]] = e); } #else[byteOrShort] public abstract void intoArray($type$[] a, int a_offset, int[] indexMap, int i_offset); #end[byteOrShort] /** * Stores this vector into an array using indexes obtained from an index * map 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 at index
* {@code a_offset + indexMap[i_offset + N]}.
*
* @param a the array
* @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 i_offset the offset into the index map
* @throws IndexOutOfBoundsException if {@code j < 0}, or
* {@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 a_offset + indexMap[i_offset + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
public void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset) {
forEach(m, (n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
}
#else[byteOrShort]
public abstract void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset);
#end[byteOrShort]
// Species
/**
* {@inheritDoc}
*/
@Override
public abstract VectorSpecies<$Boxtype$> species();
/**
* Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
*/
static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
final Function<$type$[], $Type$Vector> vectorFactory;
private $Type$Species(VectorShape shape,
Class vectorType,
Class maskType,
Function<$type$[], $Type$Vector> vectorFactory,
Function

* A preferred species is a species chosen by the platform that has a * shape of maximal bit size. A preferred species for different element * types will have the same shape, and therefore vectors, masks, and * shuffles created from such species will be shape compatible. * * @return the preferred species for an element type of {@code $type$} */ private static $Type$Species preferredSpecies() { return ($Type$Species) VectorSpecies.ofPreferred($type$.class); } /** * Finds a species for an element type of {@code $type$} and shape. * * @param s the shape * @return a species for an element type of {@code $type$} and shape * @throws IllegalArgumentException if no such species exists for the shape */ static $Type$Species species(VectorShape s) { Objects.requireNonNull(s); switch (s) { case S_64_BIT: return ($Type$Species) SPECIES_64; case S_128_BIT: return ($Type$Species) SPECIES_128; case S_256_BIT: return ($Type$Species) SPECIES_256; case S_512_BIT: return ($Type$Species) SPECIES_512; case S_Max_BIT: return ($Type$Species) SPECIES_MAX; default: throw new IllegalArgumentException("Bad shape: " + s); } } /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_64_BIT VectorShape.S_64_BIT}. */ public static final VectorSpecies<$Boxtype$> SPECIES_64 = new $Type$Species(VectorShape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class, $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new, $Type$64Vector.$Type$64Shuffle::new, $Type$64Vector.$Type$64Shuffle::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_128_BIT VectorShape.S_128_BIT}. */ public static final VectorSpecies<$Boxtype$> SPECIES_128 = new $Type$Species(VectorShape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class, $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new, $Type$128Vector.$Type$128Shuffle::new, $Type$128Vector.$Type$128Shuffle::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_256_BIT VectorShape.S_256_BIT}. */ public static final VectorSpecies<$Boxtype$> SPECIES_256 = new $Type$Species(VectorShape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class, $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new, $Type$256Vector.$Type$256Shuffle::new, $Type$256Vector.$Type$256Shuffle::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_512_BIT VectorShape.S_512_BIT}. */ public static final VectorSpecies<$Boxtype$> SPECIES_512 = new $Type$Species(VectorShape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class, $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new, $Type$512Vector.$Type$512Shuffle::new, $Type$512Vector.$Type$512Shuffle::new); /** Species representing {@link $Type$Vector}s of {@link VectorShape#S_Max_BIT VectorShape.S_Max_BIT}. */ public static final VectorSpecies<$Boxtype$> SPECIES_MAX = new $Type$Species(VectorShape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class, $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new, $Type$MaxVector.$Type$MaxShuffle::new, $Type$MaxVector.$Type$MaxShuffle::new); /** * Preferred species for {@link $Type$Vector}s. * A preferred species is a species of maximal bit size for the platform. */ public static final VectorSpecies<$Boxtype$> SPECIES_PREFERRED = (VectorSpecies<$Boxtype$>) preferredSpecies(); }