/* * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have * questions. */ package jdk.incubator.vector; import java.nio.ByteBuffer; #if[!byte] import java.nio.$Type$Buffer; #end[!byte] import java.nio.ByteOrder; import java.util.Objects; import java.util.function.IntUnaryOperator; import java.util.function.Function; import java.util.concurrent.ThreadLocalRandom; import jdk.internal.misc.Unsafe; import jdk.internal.vm.annotation.ForceInline; import static jdk.incubator.vector.VectorIntrinsics.*; /** * A specialized {@link Vector} representing an ordered immutable sequence of * {@code $type$} values. */ @SuppressWarnings("cast") public abstract class $abstractvectortype$ extends Vector<$Boxtype$> { $abstractvectortype$() {} private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_$TYPE$_INDEX_SCALE); // Unary operator interface FUnOp { $type$ apply(int i, $type$ a); } abstract $abstractvectortype$ uOp(FUnOp f); abstract $abstractvectortype$ uOp(Mask<$Boxtype$> m, FUnOp f); // Binary operator interface FBinOp { $type$ apply(int i, $type$ a, $type$ b); } abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, FBinOp f); abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, Mask<$Boxtype$> m, FBinOp f); // Trinary operator interface FTriOp { $type$ apply(int i, $type$ a, $type$ b, $type$ c); } abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f); abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m, FTriOp f); // Reduction operator abstract $type$ rOp($type$ v, FBinOp f); // Binary test interface FBinTest { boolean apply(int i, $type$ a, $type$ b); } abstract Mask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f); // Foreach interface FUnCon { void apply(int i, $type$ a); } abstract void forEach(FUnCon f); abstract void forEach(Mask<$Boxtype$> m, FUnCon f); // Static factories /** * Returns a vector where all lane elements are set to the default * primitive value. * * @param species species of desired vector * @return a zero vector of given species */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ zero(Species<$Boxtype$> species) { #if[FP] return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(), $Type$.$type$To$Bitstype$Bits(0.0f), species, ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits)))); #else[FP] return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(), 0, species, ((bits, s) -> (($Type$Species)s).op(i -> ($type$)bits))); #end[FP] } /** * Loads a vector from a byte array starting at an offset. *
* 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(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows: *
{@code * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue()); * }* * @param species species of desired vector * @param a the byte array * @param ix the offset into the array * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix) { Objects.requireNonNull(a); ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(), a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET, a, ix, 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(Species<$Boxtype$>, ByteBuffer, int, Mask) method} as follows: *
{@code * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m); * }* * @param species species of desired vector * @param a the byte array * @param ix the offset into the array * @param m the mask * @return a vector loaded from a byte array * @throws IndexOutOfBoundsException if {@code i < 0} or * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)} * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > a.length}, * for any vector lane index {@code N} where the mask at lane {@code N} * is set * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)} */ @ForceInline public static $abstractvectortype$ fromByteArray(Species<$Boxtype$> species, byte[] a, int ix, Mask<$Boxtype$> m) { return zero(species).blend(fromByteArray(species, a, ix), m); } /** * Loads a vector from an array starting at offset. *
* For each vector lane, where {@code N} is the vector lane index, the * array element at index {@code i + N} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array * @param i the offset into the array * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code i < 0}, or * {@code i > a.length - this.length()} */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i){ Objects.requireNonNull(a); i = VectorIntrinsics.checkIndex(i, a.length, species.length()); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(), a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET, a, i, 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 i + N} is placed into the resulting vector at lane index * {@code N}, otherwise the default element value is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array * @param i the offset into the array * @param m the mask * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code i < 0}, or * for any vector lane index {@code N} where the mask at lane {@code N} * is set {@code i > a.length - N} */ @ForceInline public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m) { return zero(species).blend(fromArray(species, a, i), 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 i + indexMap[j + N]} is placed into the * resulting vector at lane index {@code N}. * * @param species species of desired vector * @param a the array * @param i the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param indexMap the index map * @param j the offset into the index map * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code j < 0}, or * {@code j > indexMap.length - this.length()}, * or for any vector lane index {@code N} the result of * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} */ #if[byteOrShort] public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) { return (($Type$Species)species).op(n -> a[i + indexMap[j + n]]); } #else[byteOrShort] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) { Objects.requireNonNull(a); Objects.requireNonNull(indexMap); #if[longOrDouble] if (species.length() == 1) { return $abstractvectortype$.fromArray(species, a, i + indexMap[j]); } #end[longOrDouble] // Index vector: vix[0:n] = k -> i + indexMap[j + k] IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, j).add(i); vix = VectorIntrinsics.checkIndex(vix, a.length); return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(), IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix, a, i, indexMap, j, species, ($type$[] c, int idx, int[] iMap, int idy, Species<$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 i + indexMap[j + N]} is placed into the resulting vector * at lane index {@code N}. * * @param species species of desired vector * @param a the array * @param i the offset into the array, may be negative if relative * indexes in the index map compensate to produce a value within the * array bounds * @param m the mask * @param indexMap the index map * @param j the offset into the index map * @return the vector loaded from an array * @throws IndexOutOfBoundsException if {@code j < 0}, or * {@code j > indexMap.length - this.length()}, * or for any vector lane index {@code N} where the mask at lane * {@code N} is set the result of {@code i + indexMap[j + N]} is * {@code < 0} or {@code >= a.length} */ #if[byteOrShort] public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) { return (($Type$Species)species).op(m, n -> a[i + indexMap[j + n]]); } #else[byteOrShort] @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromArray(Species<$Boxtype$> species, $type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) { // @@@ This can result in out of bounds errors for unset mask lanes return zero(species).blend(fromArray(species, a, i, indexMap, j), 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(Species<$Boxtype$>, ByteBuffer, int, Mask)} method} as follows: *
{@code * return this.fromByteBuffer(b, i, this.maskAllTrue()) * }* * @param species species of desired vector * @param bb the byte buffer * @param ix the offset into the byte buffer * @return a vector loaded from a byte buffer * @throws IndexOutOfBoundsException if the offset is {@code < 0}, * or {@code > b.limit()}, * or if there are fewer than * {@code this.length() * this.elementSize() / Byte.SIZE} bytes * remaining in the byte buffer from the given offset */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix) { if (bb.order() != ByteOrder.nativeOrder()) { throw new IllegalArgumentException(); } ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE); return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(), U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix, bb, ix, 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
* {@coce EBuffer} is the primitive buffer type, {@code e} is the
* primitive element type, and {@code ESpecies} is the primitive
* species for {@code e}:
* {@code
* EBuffer eb = b.duplicate().
* order(ByteOrder.nativeOrder()).position(i).
* asEBuffer();
* e[] es = new e[this.length()];
* for (int n = 0; n < t.length; n++) {
* if (m.isSet(n))
* es[n] = eb.get(n);
* }
* Vector
*
* @param species species of desired vector
* @param bb the byte buffer
* @param ix the offset into the byte buffer
* @param m the mask
* @return a vector loaded from a byte buffer
* @throws IndexOutOfBoundsException if the offset is {@code < 0},
* or {@code > b.limit()},
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set
* {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
*/
@ForceInline
public static $abstractvectortype$ fromByteBuffer(Species<$Boxtype$> species, ByteBuffer bb, int ix, Mask<$Boxtype$> m) {
return zero(species).blend(fromByteBuffer(species, bb, ix), m);
}
/**
* Returns a vector where all lane elements are set to the primitive
* value {@code e}.
*
* @param s 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(Species<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
$Type$.$type$To$Bitstype$Bits(e), s,
((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
}
#else[FP]
@ForceInline
@SuppressWarnings("unchecked")
public static $abstractvectortype$ broadcast(Species<$Boxtype$> s, $type$ e) {
return VectorIntrinsics.broadcastCoerced(
(Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
e, s,
((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
}
#end[FP]
/**
* Returns a vector where each lane element is set to a given
* primitive value.
* )this).fromArray(es, 0, m);
* }
* For each vector lane, where {@code N} is the vector lane index, the * the primitive value at index {@code N} is placed into the resulting * vector at lane index {@code N}. * * @param s species of the desired vector * @param es the given primitive values * @return a vector where each lane element is set to a given primitive * value * @throws IndexOutOfBoundsException if {@code es.length < this.length()} */ @ForceInline @SuppressWarnings("unchecked") public static $abstractvectortype$ scalars(Species<$Boxtype$> s, $type$... es) { Objects.requireNonNull(es); int ix = VectorIntrinsics.checkIndex(0, es.length, s.length()); return VectorIntrinsics.load((Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(), es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, es, ix, s, (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 s 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(Species<$Boxtype$> s, $type$ e) { return zero(s).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 s 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(Species<$Boxtype$> s) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)s).op(i -> r.next$Type$()); } #else[intOrLong] #if[FP] public static $abstractvectortype$ random(Species<$Boxtype$> s) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)s).op(i -> r.next$Type$()); } #else[FP] public static $abstractvectortype$ random(Species<$Boxtype$> s) { ThreadLocalRandom r = ThreadLocalRandom.current(); return (($Type$Species)s).op(i -> ($type$) r.nextInt()); } #end[FP] #end[intOrLong] /** * Returns a mask where each lane is set or unset according to given * {@code boolean} values *
* For each mask lane, where {@code N} is the mask lane index, * if the given {@code boolean} value at index {@code N} is {@code true} * then the mask lane at index {@code N} is set, otherwise it is unset. * * @param species mask species * @param bits the given {@code boolean} values * @return a mask where each lane is set or unset according to the given {@code boolean} value * @throws IndexOutOfBoundsException if {@code bits.length < species.length()} */ @ForceInline public static Mask<$Boxtype$> maskFromValues(Species<$Boxtype$> species, boolean... bits) { if (species.boxType() == $Type$MaxVector.class) return new $Type$MaxVector.$Type$MaxMask(bits); switch (species.bitSize()) { case 64: return new $Type$64Vector.$Type$64Mask(bits); case 128: return new $Type$128Vector.$Type$128Mask(bits); case 256: return new $Type$256Vector.$Type$256Mask(bits); case 512: return new $Type$512Vector.$Type$512Mask(bits); default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); } } // @@@ This is a bad implementation -- makes lambdas capturing -- fix this static Mask<$Boxtype$> trueMask(Species<$Boxtype$> species) { if (species.boxType() == $Type$MaxVector.class) return $Type$MaxVector.$Type$MaxMask.TRUE_MASK; switch (species.bitSize()) { case 64: return $Type$64Vector.$Type$64Mask.TRUE_MASK; case 128: return $Type$128Vector.$Type$128Mask.TRUE_MASK; case 256: return $Type$256Vector.$Type$256Mask.TRUE_MASK; case 512: return $Type$512Vector.$Type$512Mask.TRUE_MASK; default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); } } static Mask<$Boxtype$> falseMask(Species<$Boxtype$> species) { if (species.boxType() == $Type$MaxVector.class) return $Type$MaxVector.$Type$MaxMask.FALSE_MASK; switch (species.bitSize()) { case 64: return $Type$64Vector.$Type$64Mask.FALSE_MASK; case 128: return $Type$128Vector.$Type$128Mask.FALSE_MASK; case 256: return $Type$256Vector.$Type$256Mask.FALSE_MASK; case 512: return $Type$512Vector.$Type$512Mask.FALSE_MASK; default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); } } /** * Loads a mask from a {@code boolean} array starting at an offset. *
* For each mask lane, where {@code N} is the mask lane index,
* if the array element at index {@code ix + N} is {@code true} then the
* mask lane at index {@code N} is set, otherwise it is unset.
*
* @param species mask species
* @param bits the {@code boolean} array
* @param ix the offset into the array
* @return the mask loaded from a {@code boolean} array
* @throws IndexOutOfBoundsException if {@code ix < 0}, or
* {@code ix > bits.length - species.length()}
*/
@ForceInline
@SuppressWarnings("unchecked")
public static Mask<$Boxtype$> maskFromArray(Species<$Boxtype$> species, boolean[] bits, int ix) {
Objects.requireNonNull(bits);
ix = VectorIntrinsics.checkIndex(ix, bits.length, species.length());
return VectorIntrinsics.load((Class
* Care should be taken to ensure Shuffle values produced from this
* method are consumed as constants to ensure optimal generation of
* code. For example, values held in static final fields or values
* held in loop constant local variables.
*
* This method behaves as if a shuffle is created from an array of
* mapped indexes as follows:
*
* This method behaves as if a shuffle is created from an identity
* index mapping function as follows:
*
* For each shuffle lane, where {@code N} is the shuffle lane index, the
* the {@code int} value at index {@code N} logically AND'ed by
* {@code species.length() - 1} is placed into the resulting shuffle at
* lane index {@code N}.
*
* @param species shuffle species
* @param ixs the given {@code int} values
* @return a shuffle where each lane element is set to a given
* {@code int} value
* @throws IndexOutOfBoundsException if the number of int values is
* {@code < species.length()}
*/
@ForceInline
public static Shuffle<$Boxtype$> shuffleFromValues(Species<$Boxtype$> species, int... ixs) {
if (species.boxType() == $Type$MaxVector.class)
return new $Type$MaxVector.$Type$MaxShuffle(ixs);
switch (species.bitSize()) {
case 64: return new $Type$64Vector.$Type$64Shuffle(ixs);
case 128: return new $Type$128Vector.$Type$128Shuffle(ixs);
case 256: return new $Type$256Vector.$Type$256Shuffle(ixs);
case 512: return new $Type$512Vector.$Type$512Shuffle(ixs);
default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
}
}
/**
* Loads a shuffle from an {@code int} array starting at an offset.
*
* For each shuffle lane, where {@code N} is the shuffle lane index, the
* array element at index {@code i + N} logically AND'ed by
* {@code species.length() - 1} is placed into the resulting shuffle at lane
* index {@code N}.
*
* @param species shuffle species
* @param ixs the {@code int} array
* @param i the offset into the array
* @return a shuffle loaded from the {@code int} array
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* {@code i > a.length - species.length()}
*/
@ForceInline
public static Shuffle<$Boxtype$> shuffleFromArray(Species<$Boxtype$> species, int[] ixs, int i) {
if (species.boxType() == $Type$MaxVector.class)
return new $Type$MaxVector.$Type$MaxShuffle(ixs, i);
switch (species.bitSize()) {
case 64: return new $Type$64Vector.$Type$64Shuffle(ixs, i);
case 128: return new $Type$128Vector.$Type$128Shuffle(ixs, i);
case 256: return new $Type$256Vector.$Type$256Shuffle(ixs, i);
case 512: return new $Type$512Vector.$Type$512Shuffle(ixs, i);
default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
}
}
// Ops
@Override
public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
/**
* Adds this vector to the broadcast of an input scalar.
*
* This is a vector binary operation where the primitive addition operation
* ({@code +}) is applied to lane elements.
*
* @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);
@Override
public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Adds this vector to broadcast of an input scalar,
* selecting lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive addition operation
* ({@code +}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
/**
* Subtracts the broadcast of an input scalar from this vector.
*
* This is a vector binary operation where the primitive subtraction
* operation ({@code -}) is applied to lane elements.
*
* @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);
@Override
public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Subtracts the broadcast of an input scalar from this vector, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive subtraction
* operation ({@code -}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
/**
* Multiplies this vector with the broadcast of an input scalar.
*
* This is a vector binary operation where the primitive multiplication
* operation ({@code *}) is applied to lane elements.
*
* @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);
@Override
public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Multiplies this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive multiplication
* operation ({@code *}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ neg();
@Override
public abstract $abstractvectortype$ neg(Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ abs();
@Override
public abstract $abstractvectortype$ abs(Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
@Override
public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Returns the minimum of this vector and the broadcast of an input scalar.
*
* This is a vector binary operation where the operation
* {@code (a, b) -> Math.min(a, b)} is applied to lane elements.
*
* @param s the input scalar
* @return the minimum of this vector and the broadcast of an input scalar
*/
public abstract $abstractvectortype$ min($type$ s);
@Override
public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
@Override
public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, Mask<$Boxtype$> m);
/**
* Returns the maximum of this vector and the broadcast of an input scalar.
*
* This is a vector binary operation where the operation
* {@code (a, b) -> Math.max(a, b)} is applied to lane elements.
*
* @param s the input scalar
* @return the maximum of this vector and the broadcast of an input scalar
*/
public abstract $abstractvectortype$ max($type$ s);
@Override
public abstract Mask<$Boxtype$> equal(Vector<$Boxtype$> v);
/**
* Tests if this vector is equal to the broadcast of an input scalar.
*
* This is a vector binary test operation where the primitive equals
* operation ({@code ==}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> equal($type$ s);
@Override
public abstract Mask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
/**
* Tests if this vector is not equal to the broadcast of an input scalar.
*
* This is a vector binary test operation where the primitive not equals
* operation ({@code !=}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> notEqual($type$ s);
@Override
public abstract Mask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is less than the broadcast of an input scalar.
*
* This is a vector binary test operation where the primitive less than
* operation ({@code <}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> lessThan($type$ s);
@Override
public abstract Mask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is less or equal to the broadcast of an input scalar.
*
* This is a vector binary test operation where the primitive less than
* or equal to operation ({@code <=}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> lessThanEq($type$ s);
@Override
public abstract Mask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than the broadcast of an input scalar.
*
* This is a vector binary test operation where the primitive greater than
* operation ({@code >}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> greaterThan($type$ s);
@Override
public abstract Mask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
/**
* Tests if this vector is greater than or equal to the broadcast of an
* input scalar.
*
* This is a vector binary test operation where the primitive greater than
* or equal to operation ({@code >=}) is applied to lane elements.
*
* @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 Mask<$Boxtype$> greaterThanEq($type$ s);
@Override
public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, Mask<$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, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v,
Shuffle<$Boxtype$> s, Mask<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ rearrange(Shuffle<$Boxtype$> m);
@Override
public abstract $abstractvectortype$ reshape(Species<$Boxtype$> s);
@Override
public abstract $abstractvectortype$ rotateEL(int i);
@Override
public abstract $abstractvectortype$ rotateER(int i);
@Override
public abstract $abstractvectortype$ shiftEL(int i);
@Override
public abstract $abstractvectortype$ shiftER(int i);
#if[FP]
/**
* Divides this vector by an input vector.
*
* This is a vector binary operation where the primitive division
* operation ({@code /}) is applied to lane elements.
*
* @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 vector binary operation where the primitive division
* operation ({@code /}) is applied to lane elements.
*
* @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 vector binary operation where the primitive division
* operation ({@code /}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Divides this vector by the broadcast of an input scalar, selecting lane
* elements controlled by a mask.
*
* This is a vector binary operation where the primitive division
* operation ({@code /}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Calculates the square root of this vector.
*
* This is a vector unary operation where the {@link Math#sqrt} operation
* is applied to lane elements.
*
* @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 vector unary operation where the {@link Math#sqrt} operation
* is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the square root of this vector
*/
public $abstractvectortype$ sqrt(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
}
/**
* Calculates the trigonometric tangent of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#tan} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
}
/**
* Calculates the hyperbolic tangent of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#tanh} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
}
/**
* Calculates the trigonometric sine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#sin} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
}
/**
* Calculates the hyperbolic sine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#sinh} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
}
/**
* Calculates the trigonometric cosine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#cos} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
}
/**
* Calculates the hyperbolic cosine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#cosh} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
}
/**
* Calculates the arc sine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#asin} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
}
/**
* Calculates the arc cosine of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#acos} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
}
/**
* Calculates the arc tangent of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#atan} operation applied to lane elements.
* 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(Mask<$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 vector binary operation with same semantic definition as
* {@link Math#atan2} operation applied to lane elements.
* 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 vector binary operation with same semantic definition as
* {@link Math#atan2} operation applied to lane elements.
* 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, Mask<$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, Mask<$Boxtype$> m);
/**
* Calculates the cube root of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#cbrt} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
}
/**
* Calculates the natural logarithm of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#log} operation applied to lane elements.
* 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(Mask<$Boxtype$> m) {
return uOp(m, (i, a) -> ($type$) Math.log((double) a));
}
/**
* Calculates the base 10 logarithm of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#log10} operation applied to lane elements.
* 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(Mask<$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 vector unary operation with same semantic definition as
* {@link Math#log1p} operation applied to lane elements.
* 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(Mask<$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 vector binary operation with same semantic definition as
* {@link Math#pow} operation applied to lane elements.
* 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 vector binary operation with same semantic definition as
* {@link Math#pow} operation applied to lane elements.
* 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, Mask<$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, Mask<$Boxtype$> m);
/**
* Calculates the broadcast of Euler's number {@code e} raised to the power
* of this vector.
*
* This is a vector unary operation with same semantic definition as
* {@link Math#exp} operation applied to lane elements.
* 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(Mask<$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):
*
* This is a vector unary operation with same semantic definition as
* {@link Math#expm1} operation applied to lane elements.
* 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):
*
* 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(Mask<$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):
*
* This is a vector ternary operation where the {@link Math#fma} operation
* is applied to lane elements.
*
* @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:
*
* This is a vector ternary operation where the {@link Math#fma} operation
* is applied to lane elements.
*
* @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):
*
* This is a vector ternary operation where the {@link Math#fma} operation
* is applied to lane elements.
*
* @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, Mask<$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:
*
* This is a vector ternary operation where the {@link Math#fma} operation
* is applied to lane elements.
*
* @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, Mask<$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):
*
* This is a vector binary operation with same semantic definition as
* {@link Math#hypot} operation applied to lane elements.
* 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):
*
* This is a vector binary operation with same semantic definition as
* {@link Math#hypot} operation applied to lane elements.
* 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):
*
* 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, Mask<$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):
*
* 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, Mask<$Boxtype$> m);
#end[FP]
#if[BITWISE]
/**
* Bitwise ANDs this vector with an input vector.
*
* This is a vector binary operation where the primitive bitwise AND
* operation ({@code &}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise AND
* operation ({@code &}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise AND
* operation ({@code &}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise ANDs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive bitwise AND
* operation ({@code &}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise ORs this vector with an input vector.
*
* This is a vector binary operation where the primitive bitwise OR
* operation ({@code |}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise OR
* operation ({@code |}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise OR
* operation ({@code |}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise ORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive bitwise OR
* operation ({@code |}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise XORs this vector with an input vector.
*
* This is a vector binary operation where the primitive bitwise XOR
* operation ({@code ^}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise XOR
* operation ({@code ^}) is applied to lane elements.
*
* @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 vector binary operation where the primitive bitwise XOR
* operation ({@code ^}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise XORs this vector with the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive bitwise XOR
* operation ({@code ^}) is applied to lane elements.
*
* @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, Mask<$Boxtype$> m);
/**
* Bitwise NOTs this vector.
*
* This is a vector unary operation where the primitive bitwise NOT
* operation ({@code ~}) is applied to lane elements.
*
* @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 vector unary operation where the primitive bitwise NOT
* operation ({@code ~}) is applied to lane elements.
*
* @param m the mask controlling lane selection
* @return the bitwise NOT of this vector
*/
public abstract $abstractvectortype$ not(Mask<$Boxtype$> m);
#if[byte]
/**
* Logically left shifts this vector by the broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* Logically left shifts this vector by the broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* Logically left shifts this vector by the broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements.
*
* @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
*/
#end[intOrLong]
public abstract $abstractvectortype$ shiftL(int s);
#if[byte]
/**
* Logically left shifts this vector by the broadcast of an input scalar,
* selecting lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* Logically left shifts this vector by the broadcast of an input scalar,
* selecting lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements to left shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* Logically left shifts this vector by the broadcast of an input scalar,
* selecting lane elements controlled by a mask.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements.
*
* @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 this vector by the
* broadcast of an input scalar
*/
#end[intOrLong]
public abstract $abstractvectortype$ shiftL(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically left shifts this vector by an input vector.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements.
*
* @param v the input vector
* @return the result of logically left shifting this vector by the input
* vector
*/
public abstract $abstractvectortype$ shiftL(Vector<$Boxtype$> v);
/**
* Logically left shifts this vector by an input vector, selecting lane
* elements controlled by a mask.
*
* This is a vector binary operation where the primitive logical left shift
* operation ({@code <<}) is applied to lane elements.
*
* @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$ shiftL(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a << b));
}
#end[intOrLong]
// logical, or unsigned, shift right
#if[byte]
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* Logically right shifts (or unsigned right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements.
*
* @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
*/
#end[intOrLong]
public abstract $abstractvectortype$ shiftR(int s);
#if[byte]
/**
* 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 vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* 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 vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements to logically right shift the
* element by shift value as specified by the input scalar. 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* 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 vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements.
*
* @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
*/
#end[intOrLong]
public abstract $abstractvectortype$ shiftR(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Logically right shifts (or unsigned right shifts) this vector by an
* input vector.
*
* This is a vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements.
*
* @param v the input vector
* @return the result of logically right shifting this vector by the
* input vector
*/
public abstract $abstractvectortype$ shiftR(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 vector binary operation where the primitive logical right shift
* operation ({@code >>>}) is applied to lane elements.
*
* @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$ shiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
}
#end[intOrLong]
#if[byte]
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* Arithmetically right shifts (or signed right shifts) this vector by the
* broadcast of an input scalar.
*
* This is a vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements.
*
* @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
*/
#end[intOrLong]
public abstract $abstractvectortype$ aShiftR(int s);
#if[byte]
/**
* 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 vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* 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.
*
* @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
*/
#end[byte]
#if[short]
/**
* 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 vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements to arithmetically
* right shift the element by shift value as specified by the input scalar.
* 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.
*
* @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
*/
#end[short]
#if[intOrLong]
/**
* 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 vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements.
*
* @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
*/
#end[intOrLong]
public abstract $abstractvectortype$ aShiftR(int s, Mask<$Boxtype$> m);
#if[intOrLong]
/**
* Arithmetically right shifts (or signed right shifts) this vector by an
* input vector.
*
* This is a vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements.
*
* @param v the input vector
* @return the result of arithmetically right shifting this vector by the
* input vector
*/
public abstract $abstractvectortype$ aShiftR(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 vector binary operation where the primitive arithmetic right
* shift operation ({@code >>}) is applied to lane elements.
*
* @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$ aShiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) {
return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
}
/**
* Rotates left this vector by the broadcast of an input scalar.
*
* This is a vector binary operation where the operation
* {@link $Wideboxtype$#rotateLeft} is applied to lane elements 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).
*
* @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$ rotateL(int s) {
return shiftL(s).or(shiftR(-s));
}
/**
* Rotates left this vector by the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the operation
* {@link $Wideboxtype$#rotateLeft} is applied to lane elements 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).
*
* @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$ rotateL(int s, Mask<$Boxtype$> m) {
return shiftL(s, m).or(shiftR(-s, m), m);
}
/**
* Rotates right this vector by the broadcast of an input scalar.
*
* This is a vector binary operation where the operation
* {@link $Wideboxtype$#rotateRight} is applied to lane elements 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).
*
* @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$ rotateR(int s) {
return shiftR(s).or(shiftL(-s));
}
/**
* Rotates right this vector by the broadcast of an input scalar, selecting
* lane elements controlled by a mask.
*
* This is a vector binary operation where the operation
* {@link $Wideboxtype$#rotateRight} is applied to lane elements 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).
*
* @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$ rotateR(int s, Mask<$Boxtype$> m) {
return shiftR(s, m).or(shiftL(-s, m), m);
}
#end[intOrLong]
#end[BITWISE]
@Override
public abstract void intoByteArray(byte[] a, int ix);
@Override
public abstract void intoByteArray(byte[] a, int ix, Mask<$Boxtype$> m);
@Override
public abstract void intoByteBuffer(ByteBuffer bb, int ix);
@Override
public abstract void intoByteBuffer(ByteBuffer bb, int ix, Mask<$Boxtype$> m);
// Type specific horizontal reductions
/**
* Adds all lane elements of this vector.
*
#if[FP]
* This is a vector reduction operation where the addition
* operation ({@code +}) is applied 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 vector reduction operation where the addition
* operation ({@code +}) is applied 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 vector reduction operation where the addition
* operation ({@code +}) is applied 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 vector reduction operation where the addition
* operation ({@code +}) is applied 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(Mask<$Boxtype$> m);
/**
* Multiplies all lane elements of this vector.
*
#if[FP]
* This is a vector reduction operation where the
* multiplication operation ({@code *}) is applied 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 vector reduction operation where the
* multiplication operation ({@code *}) is applied 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 vector reduction operation where the
* multiplication operation ({@code *}) is applied 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 vector reduction operation where the
* multiplication operation ({@code *}) is applied 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(Mask<$Boxtype$> m);
/**
* Returns the minimum lane element of this vector.
*
* This is an associative vector reduction operation where the operation
* {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
* 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 vector reduction operation where the operation
* {@code (a, b) -> Math.min(a, b)} is applied 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(Mask<$Boxtype$> m);
/**
* Returns the maximum lane element of this vector.
*
* This is an associative vector reduction operation where the operation
* {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
* 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 vector reduction operation where the operation
* {@code (a, b) -> Math.max(a, b)} is applied 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(Mask<$Boxtype$> m);
#if[BITWISE]
/**
* Logically ORs all lane elements of this vector.
*
* This is an associative vector reduction operation where the logical OR
* operation ({@code |}) is applied 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 vector reduction operation where the logical OR
* operation ({@code |}) is applied 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(Mask<$Boxtype$> m);
/**
* Logically ANDs all lane elements of this vector.
*
* This is an associative vector reduction operation where the logical AND
* operation ({@code |}) is applied 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 vector reduction operation where the logical AND
* operation ({@code |}) is applied 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(Mask<$Boxtype$> m);
/**
* Logically XORs all lane elements of this vector.
*
* This is an associative vector reduction operation where the logical XOR
* operation ({@code ^}) is applied 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 vector reduction operation where the logical XOR
* operation ({@code ^}) is applied 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(Mask<$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$ get(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:
*
* For each vector lane, where {@code N} is the vector lane index,
* the lane element at index {@code N} is stored into the array at index
* {@code i + N}.
*
* @param a the array
* @param i the offset into the array
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* {@code i > a.length - this.length()}
*/
public abstract void intoArray($type$[] a, int i);
/**
* Stores this vector into an array starting at offset and using a mask.
*
* For each vector lane, where {@code N} is the vector lane index,
* if the mask lane at index {@code N} is set then the lane element at
* index {@code N} is stored into the array index {@code i + N}.
*
* @param a the array
* @param i the offset into the array
* @param m the mask
* @throws IndexOutOfBoundsException if {@code i < 0}, or
* for any vector lane index {@code N} where the mask at lane {@code N}
* is set {@code i >= a.length - N}
*/
public abstract void intoArray($type$[] a, int i, Mask<$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 i + indexMap[j + N]}.
*
* @param a the array
* @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param indexMap the index map
* @param j the offset into the index map
* @throws IndexOutOfBoundsException if {@code j < 0}, or
* {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} the result of
* {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
public void intoArray($type$[] a, int i, int[] indexMap, int j) {
forEach((n, e) -> a[i + indexMap[j + n]] = e);
}
#else[byteOrShort]
public abstract void intoArray($type$[] a, int i, int[] indexMap, int j);
#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 i + indexMap[j + N]}.
*
* @param a the array
* @param i the offset into the array, may be negative if relative
* indexes in the index map compensate to produce a value within the
* array bounds
* @param m the mask
* @param indexMap the index map
* @param j the offset into the index map
* @throws IndexOutOfBoundsException if {@code j < 0}, or
* {@code j > indexMap.length - this.length()},
* or for any vector lane index {@code N} where the mask at lane
* {@code N} is set the result of {@code i + indexMap[j + N]} is
* {@code < 0} or {@code >= a.length}
*/
#if[byteOrShort]
public void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) {
forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
}
#else[byteOrShort]
public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j);
#end[byteOrShort]
// Species
@Override
public abstract Species<$Boxtype$> species();
/**
* Class representing {@link $abstractvectortype$}'s of the same {@link Vector.Shape Shape}.
*/
static final class $Type$Species extends Vector.AbstractSpecies<$Boxtype$> {
final Function<$type$[], $Type$Vector> vectorFactory;
final 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) Species.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(Vector.Shape 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 Vector.Shape#S_64_BIT Shape.S_64_BIT}. */
public static final Species<$Boxtype$> SPECIES_64 = new $Type$Species(Shape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class,
$Type$64Vector::new, $Type$64Vector.$Type$64Mask::new);
/** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_128_BIT Shape.S_128_BIT}. */
public static final Species<$Boxtype$> SPECIES_128 = new $Type$Species(Shape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class,
$Type$128Vector::new, $Type$128Vector.$Type$128Mask::new);
/** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_256_BIT Shape.S_256_BIT}. */
public static final Species<$Boxtype$> SPECIES_256 = new $Type$Species(Shape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class,
$Type$256Vector::new, $Type$256Vector.$Type$256Mask::new);
/** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_512_BIT Shape.S_512_BIT}. */
public static final Species<$Boxtype$> SPECIES_512 = new $Type$Species(Shape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class,
$Type$512Vector::new, $Type$512Vector.$Type$512Mask::new);
/** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_Max_BIT Shape.S_Max_BIT}. */
public static final Species<$Boxtype$> SPECIES_MAX = new $Type$Species(Shape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class,
$Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new);
/**
* Preferred species for {@link $Type$Vector}s.
* A preferred species is a species of maximal bit size for the platform.
*/
public static final Species<$Boxtype$> SPECIES_PREFERRED = (Species<$Boxtype$>) preferredSpecies();
}
{@code
* int[] a = new int[species.length()];
* for (int i = 0; i < a.length; i++) {
* a[i] = f.applyAsInt(i);
* }
* return this.shuffleFromValues(a);
* }
*
* @param species shuffle species
* @param f the lane index mapping function
* @return a shuffle of mapped indexes
*/
@ForceInline
public static Shuffle<$Boxtype$> shuffle(Species<$Boxtype$> species, IntUnaryOperator f) {
if (species.boxType() == $Type$MaxVector.class)
return new $Type$MaxVector.$Type$MaxShuffle(f);
switch (species.bitSize()) {
case 64: return new $Type$64Vector.$Type$64Shuffle(f);
case 128: return new $Type$128Vector.$Type$128Shuffle(f);
case 256: return new $Type$256Vector.$Type$256Shuffle(f);
case 512: return new $Type$512Vector.$Type$512Shuffle(f);
default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
}
}
/**
* Returns a shuffle where each lane element is the value of its
* corresponding lane index.
* {@code
* return this.shuffle(i -> i);
* }
*
* @param species shuffle species
* @return a shuffle of lane indexes
*/
@ForceInline
public static Shuffle<$Boxtype$> shuffleIota(Species<$Boxtype$> species) {
if (species.boxType() == $Type$MaxVector.class)
return new $Type$MaxVector.$Type$MaxShuffle(AbstractShuffle.IDENTITY);
switch (species.bitSize()) {
case 64: return new $Type$64Vector.$Type$64Shuffle(AbstractShuffle.IDENTITY);
case 128: return new $Type$128Vector.$Type$128Shuffle(AbstractShuffle.IDENTITY);
case 256: return new $Type$256Vector.$Type$256Shuffle(AbstractShuffle.IDENTITY);
case 512: return new $Type$512Vector.$Type$512Shuffle(AbstractShuffle.IDENTITY);
default: throw new IllegalArgumentException(Integer.toString(species.bitSize()));
}
}
/**
* Returns a shuffle where each lane element is set to a given
* {@code int} value logically AND'ed by the species length minus one.
* {@code
* this.exp().sub(this.species().broadcast(1))
* }
* {@code
* this.exp(m).sub(this.species().broadcast(1), m)
* }
* {@code
* this.mul(v1).add(v2)
* }
* {@code
* this.fma(this.species().broadcast(s1), this.species().broadcast(s2))
* }
* {@code
* this.mul(v1, m).add(v2, m)
* }
* {@code
* this.fma(this.species().broadcast(s1), this.species().broadcast(s2), m)
* }
* {@code
* this.mul(this).add(v.mul(v)).sqrt()
* }
* {@code
* this.mul(this).add(this.species().broadcast(v * v)).sqrt()
* }
* {@code
* this.mul(this, m).add(v.mul(v), m).sqrt(m)
* }
* {@code
* this.mul(this, m).add(this.species().broadcast(v * v), m).sqrt(m)
* }
* {@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.
*