ByteVector
relies on preview features of the Java platform:
ByteVector
refers to one or more preview APIs:MemorySegment
.
Vector
representing an ordered immutable sequence of
byte
values.
Field Summary
Modifier and TypeFieldDescriptionstatic final VectorSpecies
<Byte> Species representingByteVector
s ofVectorShape.S_128_BIT
.static final VectorSpecies
<Byte> Species representingByteVector
s ofVectorShape.S_256_BIT
.static final VectorSpecies
<Byte> Species representingByteVector
s ofVectorShape.S_512_BIT
.static final VectorSpecies
<Byte> Species representingByteVector
s ofVectorShape.S_64_BIT
.static final VectorSpecies
<Byte> Species representingByteVector
s ofVectorShape.S_Max_BIT
.static final VectorSpecies
<Byte> Preferred species forByteVector
s. 
Method Summary
Modifier and TypeMethodDescriptionfinal ByteVector
abs()
Returns the absolute value of this vector.final ByteVector
add
(byte e) Adds this vector to the broadcast of an input scalar.final ByteVector
add
(byte e, VectorMask<Byte> m) Adds this vector to the broadcast of an input scalar, selecting lane elements controlled by a mask.final ByteVector
Adds this vector to a second input vector.final ByteVector
add
(Vector<Byte> v, VectorMask<Byte> m) Adds this vector to a second input vector, selecting lanes under the control of a mask.abstract ByteVector
addIndex
(int scale) Adds the lanes of this vector to their corresponding lane numbers, scaled by a given constant.final ByteVector
and
(byte e) Computes the bitwise logical conjunction (&
) of this vector and a scalar.final ByteVector
Computes the bitwise logical conjunction (&
) of this vector and a second input vector.final ByteVector
bitwiseBlend
(byte bits, byte mask) Blends together the bits of a vector and a scalar under the control of another scalar, which supplies mask bits.final ByteVector
bitwiseBlend
(byte bits, Vector<Byte> mask) Blends together the bits of a vector and a scalar under the control of another vector, which supplies mask bits.final ByteVector
bitwiseBlend
(Vector<Byte> bits, byte mask) Blends together the bits of two vectors under the control of a scalar, which supplies mask bits.final ByteVector
bitwiseBlend
(Vector<Byte> bits, Vector<Byte> mask) Blends together the bits of two vectors under the control of a third, which supplies mask bits.final ByteVector
blend
(byte e, VectorMask<Byte> m) Replaces selected lanes of this vector with a scalar value under the control of a mask.final ByteVector
blend
(long e, VectorMask<Byte> m) Replaces selected lanes of this vector with a scalar value under the control of a mask.abstract ByteVector
blend
(Vector<Byte> v, VectorMask<Byte> m) Replaces selected lanes of this vector with corresponding lanes from a second input vector under the control of a mask.abstract ByteVector
broadcast
(byte e) Returns a vector of the same species as this one where all lane elements are set to the primitive valuee
.abstract ByteVector
broadcast
(long e) Returns a vector of the same species as this one where all lane elements are set to the primitive valuee
.static ByteVector
broadcast
(VectorSpecies<Byte> species, byte e) Returns a vector of the given species where all lane elements are set to the primitive valuee
.static ByteVector
broadcast
(VectorSpecies<Byte> species, long e) Returns a vector of the given species where all lane elements are set to the primitive valuee
.final <F> Vector
<F> castShape
(VectorSpecies<F> toSpecies, int part) Convenience method for converting a vector from one lane type to another, reshaping as needed when lane sizes change.final <F> Vector
<F> Checks that this vector has the given element type, and returns this vector unchanged.final <F> Vector
<F> check
(VectorSpecies<F> species) Checks that this vector has the given species, and returns this vector unchanged.abstract VectorMask
<Byte> compare
(VectorOperators.Comparison op, byte e) Tests this vector by comparing it with an input scalar, according to the given comparison operation.final VectorMask
<Byte> compare
(VectorOperators.Comparison op, byte e, VectorMask<Byte> m) Tests this vector by comparing it with an input scalar, according to the given comparison operation, in lanes selected by a mask.abstract VectorMask
<Byte> compare
(VectorOperators.Comparison op, long e) Tests this vector by comparing it with an input scalar, according to the given comparison operation.final VectorMask
<Byte> compare
(VectorOperators.Comparison op, long e, VectorMask<Byte> m) Tests this vector by comparing it with an input scalar, according to the given comparison operation, in lanes selected by a mask.abstract VectorMask
<Byte> compare
(VectorOperators.Comparison op, Vector<Byte> v) Tests this vector by comparing it with another input vector, according to the given comparison operation.abstract ByteVector
compress
(VectorMask<Byte> m) Compresses the lane elements of this vector selecting lanes under the control of a specific mask.final <F> Vector
<F> convert
(VectorOperators.Conversion<Byte, F> conv, int part) Convert this vector to a vector of the same shape and a new element type, converting lane values from the currentETYPE
to a new lane type (calledFTYPE
here) according to the indicated conversion.abstract <F> Vector
<F> convertShape
(VectorOperators.Conversion<Byte, F> conv, VectorSpecies<F> rsp, int part) Converts this vector to a vector of the given species, shape and element type, converting lane values from the currentETYPE
to a new lane type (calledFTYPE
here) according to the indicated conversion.final ByteVector
div
(byte e) Divides this vector by the broadcast of an input scalar.final ByteVector
div
(byte e, VectorMask<Byte> m) Divides this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask.final ByteVector
Divides this vector by a second input vector.final ByteVector
div
(Vector<Byte> v, VectorMask<Byte> m) Divides this vector by a second input vector under the control of a mask.final VectorMask
<Byte> eq
(byte e) Tests if this vector is equal to an input scalar.final VectorMask
<Byte> Tests if this vector is equal to another input vector.final boolean
Indicates whether this vector is identical to some other object.abstract ByteVector
expand
(VectorMask<Byte> m) Expands the lane elements of this vector under the control of a specific mask.static ByteVector
fromArray
(VectorSpecies<Byte> species, byte[] a, int offset) Loads a vector from an array of typebyte[]
starting at an offset.static ByteVector
fromArray
(VectorSpecies<Byte> species, byte[] a, int offset, int[] indexMap, int mapOffset) Gathers a new vector composed of elements from an array of typebyte[]
, using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.static ByteVector
fromArray
(VectorSpecies<Byte> species, byte[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Gathers a new vector composed of elements from an array of typebyte[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.static ByteVector
fromArray
(VectorSpecies<Byte> species, byte[] a, int offset, VectorMask<Byte> m) Loads a vector from an array of typebyte[]
starting at an offset and using a mask.static ByteVector
fromBooleanArray
(VectorSpecies<Byte> species, boolean[] a, int offset) Loads a vector from an array of typeboolean[]
starting at an offset.static ByteVector
fromBooleanArray
(VectorSpecies<Byte> species, boolean[] a, int offset, int[] indexMap, int mapOffset) Gathers a new vector composed of elements from an array of typeboolean[]
, using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.static ByteVector
fromBooleanArray
(VectorSpecies<Byte> species, boolean[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Gathers a new vector composed of elements from an array of typeboolean[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.static ByteVector
fromBooleanArray
(VectorSpecies<Byte> species, boolean[] a, int offset, VectorMask<Byte> m) Loads a vector from an array of typeboolean[]
starting at an offset and using a mask.static ByteVector
fromMemorySegment
(VectorSpecies<Byte> species, MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo) Loads a vector from a memory segment^{PREVIEW} starting at an offset into the memory segment.static ByteVector
fromMemorySegment
(VectorSpecies<Byte> species, MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo, VectorMask<Byte> m) Loads a vector from a memory segment^{PREVIEW} starting at an offset into the memory segment and using a mask.protected final Object
final int
hashCode()
Returns a hash code value for the vector.final void
intoArray
(byte[] a, int offset) Stores this vector into an array of typebyte[]
starting at an offset.final void
intoArray
(byte[] a, int offset, int[] indexMap, int mapOffset) Scatters this vector into an array of typebyte[]
using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.final void
intoArray
(byte[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Scatters this vector into an array of typebyte[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.final void
intoArray
(byte[] a, int offset, VectorMask<Byte> m) Stores this vector into an array of typebyte[]
starting at offset and using a mask.final void
intoBooleanArray
(boolean[] a, int offset) Stores this vector into an array of typeboolean[]
starting at an offset.final void
intoBooleanArray
(boolean[] a, int offset, int[] indexMap, int mapOffset) Scatters this vector into an array of typeboolean[]
using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.final void
intoBooleanArray
(boolean[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Scatters this vector into an array of typeboolean[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map.final void
intoBooleanArray
(boolean[] a, int offset, VectorMask<Byte> m) Stores this vector into an array of typeboolean[]
starting at offset and using a mask.final void
intoMemorySegment
(MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo) Stores this vector into a memory segment^{PREVIEW} starting at an offset using explicit byte order.final void
intoMemorySegment
(MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo, VectorMask<Byte> m) Stores this vector into a memory segment^{PREVIEW} starting at an offset using explicit byte order and a mask.abstract byte
lane
(int i) Gets the lane element at lane indexi
final ByteVector
lanewise
(VectorOperators.Binary op, byte e) Combines the lane values of this vector with the value of a broadcast scalar.final ByteVector
lanewise
(VectorOperators.Binary op, byte e, VectorMask<Byte> m) Combines the lane values of this vector with the value of a broadcast scalar, with selection of lane elements controlled by a mask.final ByteVector
lanewise
(VectorOperators.Binary op, long e) Combines the lane values of this vector with the value of a broadcast scalar.final ByteVector
lanewise
(VectorOperators.Binary op, long e, VectorMask<Byte> m) Combines the corresponding lane values of this vector with those of a second input vector, with selection of lane elements controlled by a mask.abstract ByteVector
lanewise
(VectorOperators.Binary op, Vector<Byte> v) Combines the corresponding lane values of this vector with those of a second input vector.abstract ByteVector
lanewise
(VectorOperators.Binary op, Vector<Byte> v, VectorMask<Byte> m) Combines the corresponding lane values of this vector with those of a second input vector, with selection of lane elements controlled by a mask.final ByteVector
lanewise
(VectorOperators.Ternary op, byte e1, byte e2) Combines the lane values of this vector with the values of two broadcast scalars.final ByteVector
lanewise
(VectorOperators.Ternary op, byte e1, byte e2, VectorMask<Byte> m) Combines the lane values of this vector with the values of two broadcast scalars, with selection of lane elements controlled by a mask.final ByteVector
lanewise
(VectorOperators.Ternary op, byte e1, Vector<Byte> v2) Combines the lane values of this vector with the values of another vector and a broadcast scalar.final ByteVector
lanewise
(VectorOperators.Ternary op, byte e1, Vector<Byte> v2, VectorMask<Byte> m) Combines the lane values of this vector with the values of another vector and a broadcast scalar, with selection of lane elements controlled by a mask.final ByteVector
lanewise
(VectorOperators.Ternary op, Vector<Byte> v1, byte e2) Combines the lane values of this vector with the values of another vector and a broadcast scalar.final ByteVector
lanewise
(VectorOperators.Ternary op, Vector<Byte> v1, byte e2, VectorMask<Byte> m) Combines the lane values of this vector with the values of another vector and a broadcast scalar, with selection of lane elements controlled by a mask.abstract ByteVector
Combines the corresponding lane values of this vector with the lanes of a second and a third input vector.abstract ByteVector
lanewise
(VectorOperators.Ternary op, Vector<Byte> v1, Vector<Byte> v2, VectorMask<Byte> m) Combines the corresponding lane values of this vector with the lanes of a second and a third input vector, with selection of lane elements controlled by a mask.abstract ByteVector
Operates on the lane values of this vector.abstract ByteVector
lanewise
(VectorOperators.Unary op, VectorMask<Byte> m) Operates on the lane values of this vector, with selection of lane elements controlled by a mask.final VectorMask
<Byte> lt
(byte e) Tests if this vector is less than an input scalar.final VectorMask
<Byte> Tests if this vector is less than another input vector.final VectorMask
<Byte> maskAll
(boolean bit) Returns a mask of same species as this vector, where each lane is set or unset according to given single boolean, which is broadcast to all lanes.final ByteVector
max
(byte e) Computes the larger of this vector and the broadcast of an input scalar.final ByteVector
Computes the larger of this vector and a second input vector.final ByteVector
min
(byte e) Computes the smaller of this vector and the broadcast of an input scalar.final ByteVector
Computes the smaller of this vector and a second input vector.final ByteVector
mul
(byte e) Multiplies this vector by the broadcast of an input scalar.final ByteVector
mul
(byte e, VectorMask<Byte> m) Multiplies this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask.final ByteVector
Multiplies this vector by a second input vector.final ByteVector
mul
(Vector<Byte> v, VectorMask<Byte> m) Multiplies this vector by a second input vector under the control of a mask.final ByteVector
neg()
Negates this vector.final ByteVector
not()
Computes the bitwise logical complement (~
) of this vector.final ByteVector
or
(byte e) Computes the bitwise logical disjunction (
) of this vector and a scalar.final ByteVector
Computes the bitwise logical disjunction (
) of this vector and a second input vector.abstract ByteVector
Rearranges the lane elements of this vector, selecting lanes under the control of a specific shuffle.abstract ByteVector
rearrange
(VectorShuffle<Byte> s, Vector<Byte> v) Rearranges the lane elements of two vectors, selecting lanes under the control of a specific shuffle, using both normal and exceptional indexes in the shuffle to steer data.abstract ByteVector
rearrange
(VectorShuffle<Byte> s, VectorMask<Byte> m) Rearranges the lane elements of this vector, selecting lanes under the control of a specific shuffle and a mask.abstract byte
Returns a value accumulated from all the lanes of this vector.abstract byte
Returns a value accumulated from selected lanes of this vector, controlled by a mask.final ByteVector
Views this vector as a vector of the same shape and contents but a lane type ofbyte
, where the bytes are extracted from the lanes according to littleendian order.Reinterprets this vector as a vector of the same shape and contents but a lane type ofdouble
, where the lanes are assembled from successive bytes according to littleendian order.Reinterprets this vector as a vector of the same shape and contents but a lane type offloat
, where the lanes are assembled from successive bytes according to littleendian order.Reinterprets this vector as a vector of the same shape and contents but a lane type ofint
, where the lanes are assembled from successive bytes according to littleendian order.Reinterprets this vector as a vector of the same shape and contents but a lane type oflong
, where the lanes are assembled from successive bytes according to littleendian order.Reinterprets this vector as a vector of the same shape and contents but a lane type ofshort
, where the lanes are assembled from successive bytes according to littleendian order.abstract ByteVector
selectFrom
(Vector<Byte> v) Using index values stored in the lanes of this vector, assemble values stored in second vectorv
.abstract ByteVector
selectFrom
(Vector<Byte> s, VectorMask<Byte> m) Using index values stored in the lanes of this vector, assemble values stored in second vector, under the control of a mask.abstract ByteVector
slice
(int origin) Slices a segment of adjacent lanes, starting at a givenorigin
lane in the current vector.abstract ByteVector
Slices a segment of adjacent lanes, starting at a givenorigin
lane in the current vector, and continuing (as needed) into an immediately following vector.final ByteVector
slice
(int origin, Vector<Byte> w, VectorMask<Byte> m) Slices a segment of adjacent lanes under the control of a mask, starting at a givenorigin
lane in the current vector, and continuing (as needed) into an immediately following vector.final VectorSpecies
<Byte> species()
Returns the species of this vector.final ByteVector
sub
(byte e) Subtracts an input scalar from this vector.final ByteVector
sub
(byte e, VectorMask<Byte> m) Subtracts an input scalar from this vector under the control of a mask.final ByteVector
Subtracts a second input vector from this vector.final ByteVector
sub
(Vector<Byte> v, VectorMask<Byte> m) Subtracts a second input vector from this vector under the control of a mask.abstract VectorMask
<Byte> Tests the lanes of this vector according to the given operation.abstract VectorMask
<Byte> test
(VectorOperators.Test op, VectorMask<Byte> m) Test selected lanes of this vector, according to the given operation.final byte[]
toArray()
Returns an array of typebyte[]
containing all the lane values.final double[]
Returns adouble[]
array containing all the lane values, converted to the typedouble
.final int[]
Returns anint[]
array containing all the lane values, converted to the typeint
.final long[]
Returns along[]
array containing all the lane values, converted to the typelong
.final VectorShuffle
<Byte> Converts this vector into a shuffle, converting the lane values toint
and regarding them as source indexes.final String
toString()
Returns a string representation of this vector, of the form"[0,1,2...]"
, reporting the lane values of this vector, in lane order.abstract ByteVector
unslice
(int origin) Reverses a slice(), inserting the current vector as a slice within a "background" input of zero lane values.abstract ByteVector
Reverses a slice(), inserting the current vector as a slice within another "background" input vector, which is regarded as one or the other input to a hypothetical subsequentslice()
operation.abstract ByteVector
unslice
(int origin, Vector<Byte> w, int part, VectorMask<Byte> m) Reverses a slice(), inserting (under the control of a mask) the current vector as a slice within another "background" input vector, which is regarded as one or the other input to a hypothetical subsequentslice()
operation.final Vector
<?> Views this vector as a vector of the same shape, length, and contents, but a lane type that is a floatingpoint type.final ByteVector
Views this vector as a vector of the same shape, length, and contents, but a lane type that is not a floatingpoint type.abstract ByteVector
withLane
(int i, byte e) Replaces the lane element of this vector at lane indexi
with valuee
.static ByteVector
zero
(VectorSpecies<Byte> species) Returns a vector of the given species where all lane elements are set to zero, the default primitive value.Methods declared in class jdk.incubator.vector.Vector
bitSize, byteSize, compare, elementSize, elementType, length, reduceLanesToLong, reduceLanesToLong, reinterpretShape, shape

Field Details

SPECIES_64
Species representingByteVector
s ofVectorShape.S_64_BIT
. 
SPECIES_128
Species representingByteVector
s ofVectorShape.S_128_BIT
. 
SPECIES_256
Species representingByteVector
s ofVectorShape.S_256_BIT
. 
SPECIES_512
Species representingByteVector
s ofVectorShape.S_512_BIT
. 
SPECIES_MAX
Species representingByteVector
s ofVectorShape.S_Max_BIT
. 
SPECIES_PREFERRED
Preferred species forByteVector
s. A preferred species is a species of maximal bitsize for the platform.


Method Details

zero
Returns a vector of the given species where all lane elements are set to zero, the default primitive value. Parameters:
species
 species of the desired zero vector Returns:
 a zero vector

broadcast
Returns a vector of the same species as this one where all lane elements are set to the primitive valuee
. The contents of the current vector are discarded; only the species is relevant to this operation.This method returns the value of this expression:
ByteVector.broadcast(this.species(), e)
. API Note:
 Unlike the similar method named
broadcast()
in the supertypeVector
, this method does not need to validate its argument, and cannot throwIllegalArgumentException
. This method is therefore preferable to the supertype method.  Parameters:
e
 the value to broadcast Returns:
 a vector where all lane elements are set to
the primitive value
e
 See Also:

broadcast
Returns a vector of the given species where all lane elements are set to the primitive valuee
. Parameters:
species
 species of the desired vectore
 the value to broadcast Returns:
 a vector where all lane elements are set to
the primitive value
e
 See Also:

broadcast
Returns a vector of the same species as this one where all lane elements are set to the primitive valuee
. The contents of the current vector are discarded; only the species is relevant to this operation.This method returns the value of this expression:
EVector.broadcast(this.species(), (ETYPE)e)
, whereEVector
is the vector class specific to this vector's element typeETYPE
.The
long
valuee
must be accurately representable by theETYPE
of this vector's species, so thate==(long)(ETYPE)e
. If this rule is violated the problem is not detected statically, but anIllegalArgumentException
is thrown at runtime. Thus, this method somewhat weakens the static type checking of immediate constants and other scalars, but it makes up for this by improving the expressiveness of the generic API. Note that ane
value in the range[128..127]
is always acceptable, since everyETYPE
will accept everybyte
value. Specified by:
broadcast
in classVector<Byte>
 API Note:
 When working with vector subtypes like
ByteVector
, the more strongly typed method is typically selected. It can be explicitly selected using a cast:v.broadcast((byte)e)
. The two expressions will produce numerically identical results.  Parameters:
e
 the value to broadcast Returns:
 a vector where all lane elements are set to
the primitive value
e
 See Also:

broadcast
Returns a vector of the given species where all lane elements are set to the primitive valuee
. Thelong
value must be accurately representable by theETYPE
of the vector species, so thate==(long)(ETYPE)e
. Parameters:
species
 species of the desired vectore
 the value to broadcast Returns:
 a vector where all lane elements are set to
the primitive value
e
 Throws:
IllegalArgumentException
 if the givenlong
value cannot be represented by the vector'sETYPE
 See Also:

lanewise
Operates on the lane values of this vector. This is a lanewise unary operation which applies the selected operation to each lane. 
lanewise
Operates on the lane values of this vector, with selection of lane elements controlled by a mask. This is a lanewise unary operation which applies the selected operation to each lane. 
lanewise
Combines the corresponding lane values of this vector with those of a second input vector. This is a lanewise binary operation which applies the selected operation to each lane. 
lanewise
Combines the corresponding lane values of this vector with those of a second input vector, with selection of lane elements controlled by a mask. This is a lanewise binary operation which applies the selected operation to each lane. 
lanewise
Combines the lane values of this vector with the value of a broadcast scalar. This is a lanewise binary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e))
. Parameters:
op
 the operation used to process lane valuese
 the input scalar Returns:
 the result of applying the operation lanewise to the two input vectors
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
Combines the lane values of this vector with the value of a broadcast scalar, with selection of lane elements controlled by a mask. This is a masked lanewise binary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e), m)
. Parameters:
op
 the operation used to process lane valuese
 the input scalarm
 the mask controlling lane selection Returns:
 the result of applying the operation lanewise to the input vector and the scalar
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
Combines the lane values of this vector with the value of a broadcast scalar. This is a lanewise binary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e))
. Specified by:
lanewise
in classVector<Byte>
 API Note:
 When working with vector subtypes like
ByteVector
, the more strongly typed method is typically selected. It can be explicitly selected using a cast:v.lanewise(op,(byte)e)
. The two expressions will produce numerically identical results.  Parameters:
op
 the operation used to combine lane valuese
 the input scalar Returns:
 the result of applying the operation lanewise to the input vector and the scalar
 See Also:

lanewise
Combines the corresponding lane values of this vector with those of a second input vector, with selection of lane elements controlled by a mask. This is a lanewise binary operation which applies the selected operation to each lane. The second operand is a broadcast integral value. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e), m)
. Specified by:
lanewise
in classVector<Byte>
 API Note:
 When working with vector subtypes like
ByteVector
, the more strongly typed method is typically selected. It can be explicitly selected using a cast:v.lanewise(op,(byte)e,m)
. The two expressions will produce numerically identical results.  Parameters:
op
 the operation used to combine lane valuese
 the input scalarm
 the mask controlling lane selection Returns:
 the result of applying the operation lanewise to the input vector and the scalar
 See Also:

lanewise
Combines the corresponding lane values of this vector with the lanes of a second and a third input vector. This is a lanewise ternary operation which applies the selected operation to each lane. 
lanewise
public abstract ByteVector lanewise(VectorOperators.Ternary op, Vector<Byte> v1, Vector<Byte> v2, VectorMask<Byte> m) Combines the corresponding lane values of this vector with the lanes of a second and a third input vector, with selection of lane elements controlled by a mask. This is a lanewise ternary operation which applies the selected operation to each lane. 
lanewise
Combines the lane values of this vector with the values of two broadcast scalars. This is a lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e1), this.broadcast(e2))
. Parameters:
op
 the operation used to combine lane valuese1
 the first input scalare2
 the second input scalar Returns:
 the result of applying the operation lanewise to the input vector and the scalars
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
Combines the lane values of this vector with the values of two broadcast scalars, with selection of lane elements controlled by a mask. This is a masked lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e1), this.broadcast(e2), m)
. Parameters:
op
 the operation used to combine lane valuese1
 the first input scalare2
 the second input scalarm
 the mask controlling lane selection Returns:
 the result of applying the operation lanewise to the input vector and the scalars
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
Combines the lane values of this vector with the values of another vector and a broadcast scalar. This is a lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, v1, this.broadcast(e2))
. Parameters:
op
 the operation used to combine lane valuesv1
 the other input vectore2
 the input scalar Returns:
 the result of applying the operation lanewise to the input vectors and the scalar
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
public final ByteVector lanewise(VectorOperators.Ternary op, Vector<Byte> v1, byte e2, VectorMask<Byte> m) Combines the lane values of this vector with the values of another vector and a broadcast scalar, with selection of lane elements controlled by a mask. This is a masked lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, v1, this.broadcast(e2), m)
. Parameters:
op
 the operation used to combine lane valuesv1
 the other input vectore2
 the input scalarm
 the mask controlling lane selection Returns:
 the result of applying the operation lanewise to the input vectors and the scalar
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
Combines the lane values of this vector with the values of another vector and a broadcast scalar. This is a lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e1), v2)
. Parameters:
op
 the operation used to combine lane valuese1
 the input scalarv2
 the other input vector Returns:
 the result of applying the operation lanewise to the input vectors and the scalar
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

lanewise
public final ByteVector lanewise(VectorOperators.Ternary op, byte e1, Vector<Byte> v2, VectorMask<Byte> m) Combines the lane values of this vector with the values of another vector and a broadcast scalar, with selection of lane elements controlled by a mask. This is a masked lanewise ternary operation which applies the selected operation to each lane. The return value will be equal to this expression:this.lanewise(op, this.broadcast(e1), v2, m)
. Parameters:
op
 the operation used to combine lane valuese1
 the input scalarv2
 the other input vectorm
 the mask controlling lane selection Returns:
 the result of applying the operation lanewise to the input vectors and the scalar
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

add
Adds this vector to a second input vector. This is a lanewise binary operation which applies the primitive addition operation (+
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
ADD
, v)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

add
Adds this vector to the broadcast of an input scalar. This is a lanewise binary operation which applies the primitive addition operation (+
) to each lane. This method is also equivalent to the expressionlanewise
(
ADD
, e)
. Parameters:
e
 the input scalar Returns:
 the result of adding each lane of this vector to the scalar
 See Also:

add
Adds this vector to a second input vector, selecting lanes under the control of a mask. This is a masked lanewise binary operation which applies the primitive addition operation (+
) to each pair of corresponding lane values. For any lane unset in the mask, the primitive operation is suppressed and this vector retains the original value stored in that lane. This method is also equivalent to the expressionlanewise
(
ADD
, v, m)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

add
Adds this vector to the broadcast of an input scalar, selecting lane elements controlled by a mask. This is a masked lanewise binary operation which applies the primitive addition operation (+
) to each lane. This method is also equivalent to the expressionlanewise
(
ADD
, s, m)
. Parameters:
e
 the input scalarm
 the mask controlling lane selection Returns:
 the result of adding each lane of this vector to the scalar
 See Also:

sub
Subtracts a second input vector from this vector. This is a lanewise binary operation which applies the primitive subtraction operation (
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
SUB
, v)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

sub
Subtracts an input scalar from this vector. This is a masked lanewise binary operation which applies the primitive subtraction operation (
) to each lane. This method is also equivalent to the expressionlanewise
(
SUB
, e)
. Parameters:
e
 the input scalar Returns:
 the result of subtracting the scalar from each lane of this vector
 See Also:

sub
Subtracts a second input vector from this vector under the control of a mask. This is a masked lanewise binary operation which applies the primitive subtraction operation (
) to each pair of corresponding lane values. For any lane unset in the mask, the primitive operation is suppressed and this vector retains the original value stored in that lane. This method is also equivalent to the expressionlanewise
(
SUB
, v, m)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

sub
Subtracts an input scalar from this vector under the control of a mask. This is a masked lanewise binary operation which applies the primitive subtraction operation (
) to each lane. This method is also equivalent to the expressionlanewise
(
SUB
, s, m)
. Parameters:
e
 the input scalarm
 the mask controlling lane selection Returns:
 the result of subtracting the scalar from each lane of this vector
 See Also:

mul
Multiplies this vector by a second input vector. This is a lanewise binary operation which applies the primitive multiplication operation (*
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
MUL
, v)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

mul
Multiplies this vector by the broadcast of an input scalar. This is a lanewise binary operation which applies the primitive multiplication operation (*
) to each lane. This method is also equivalent to the expressionlanewise
(
MUL
, e)
. Parameters:
e
 the input scalar Returns:
 the result of multiplying this vector by the given scalar
 See Also:

mul
Multiplies this vector by a second input vector under the control of a mask. This is a lanewise binary operation which applies the primitive multiplication operation (*
) to each pair of corresponding lane values. For any lane unset in the mask, the primitive operation is suppressed and this vector retains the original value stored in that lane. This method is also equivalent to the expressionlanewise
(
MUL
, v, m)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

mul
Multiplies this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask. This is a masked lanewise binary operation which applies the primitive multiplication operation (*
) to each lane. This method is also equivalent to the expressionlanewise
(
MUL
, s, m)
. Parameters:
e
 the input scalarm
 the mask controlling lane selection Returns:
 the result of muling each lane of this vector to the scalar
 See Also:

div
Divides this vector by a second input vector. This is a lanewise binary operation which applies the primitive division operation (/
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
DIV
, v)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

div
Divides this vector by the broadcast of an input scalar. This is a lanewise binary operation which applies the primitive division operation (/
) to each lane. This method is also equivalent to the expressionlanewise
(
DIV
, e)
. API Note:
 If there is a zero divisor,
ArithmeticException
will be thrown.  Parameters:
e
 the input scalar Returns:
 the result of dividing each lane of this vector by the scalar
 See Also:

div
Divides this vector by a second input vector under the control of a mask. This is a lanewise binary operation which applies the primitive division operation (/
) to each pair of corresponding lane values. For any lane unset in the mask, the primitive operation is suppressed and this vector retains the original value stored in that lane. This method is also equivalent to the expressionlanewise
(
DIV
, v, m)
.As a fullservice named operation, this method comes in masked and unmasked overloadings, and (in subclasses) also comes in scalarbroadcast overloadings (both masked and unmasked).

div
Divides this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask. This is a masked lanewise binary operation which applies the primitive division operation (/
) to each lane. This method is also equivalent to the expressionlanewise
(
DIV
, s, m)
. API Note:
 If there is a zero divisor,
ArithmeticException
will be thrown.  Parameters:
e
 the input scalarm
 the mask controlling lane selection Returns:
 the result of dividing each lane of this vector by the scalar
 See Also:

min

min
Computes the smaller of this vector and the broadcast of an input scalar. This is a lanewise binary operation which applies the operationMath.min()
to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
MIN
, e)
. Parameters:
e
 the input scalar Returns:
 the result of multiplying this vector by the given scalar
 See Also:

max
Computes the larger of this vector and a second input vector. This is a lanewise binary operation which applies the operationMath.max()
to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
MAX
, v)
.This is not a fullservice named operation like
add()
. A masked version of this operation is not directly available but may be obtained via the masked version oflanewise
. Subclasses define an additional scalarbroadcast overloading of this method. 
max
Computes the larger of this vector and the broadcast of an input scalar. This is a lanewise binary operation which applies the operationMath.max()
to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
MAX
, e)
. Parameters:
e
 the input scalar Returns:
 the result of multiplying this vector by the given scalar
 See Also:

and
Computes the bitwise logical conjunction (&
) of this vector and a second input vector. This is a lanewise binary operation which applies the the primitive bitwise "and" operation (&
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
AND
, v)
.This is not a fullservice named operation like
add
. A masked version of this operation is not directly available but may be obtained via the masked version oflanewise
. Parameters:
v
 a second input vector Returns:
 the bitwise
&
of this vector and the second input vector  See Also:

and
Computes the bitwise logical conjunction (&
) of this vector and a scalar. This is a lanewise binary operation which applies the the primitive bitwise "and" operation (&
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
AND
, e)
. Parameters:
e
 an input scalar Returns:
 the bitwise
&
of this vector and scalar  See Also:

or
Computes the bitwise logical disjunction (
) of this vector and a second input vector. This is a lanewise binary operation which applies the the primitive bitwise "or" operation (
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
AND
, v)
.This is not a fullservice named operation like
add
. A masked version of this operation is not directly available but may be obtained via the masked version oflanewise
. Parameters:
v
 a second input vector Returns:
 the bitwise

of this vector and the second input vector  See Also:

or
Computes the bitwise logical disjunction (
) of this vector and a scalar. This is a lanewise binary operation which applies the the primitive bitwise "or" operation (
) to each pair of corresponding lane values. This method is also equivalent to the expressionlanewise
(
OR
, e)
. Parameters:
e
 an input scalar Returns:
 the bitwise

of this vector and scalar  See Also:

neg

abs

not
Computes the bitwise logical complement (~
) of this vector. This is a lanewise binary operation which applies the the primitive bitwise "not" operation (~
) to each lane value. This method is also equivalent to the expressionlanewise
(
NOT
)
.This is not a fullservice named operation like
add
. A masked version of this operation is not directly available but may be obtained via the masked version oflanewise
. Returns:
 the bitwise complement
~
of this vector  See Also:

eq
Tests if this vector is equal to another input vector. This is a lanewise binary test operation which applies the primitive equals operation (==
) to each pair of corresponding lane values. The result is the same ascompare(VectorOperators.EQ, v)
. 
eq
Tests if this vector is equal to an input scalar. This is a lanewise binary test operation which applies the primitive equals operation (==
) to each lane. The result is the same ascompare(VectorOperators.Comparison.EQ, e)
. Parameters:
e
 the input scalar Returns:
 the result mask of testing if this vector
is equal to
e
 See Also:

lt
Tests if this vector is less than another input vector. This is a lanewise binary test operation which applies the primitive lessthan operation (<
) to each lane. The result is the same ascompare(VectorOperators.LT, v)
. 
lt
Tests if this vector is less than an input scalar. This is a lanewise binary test operation which applies the primitive less than operation (<
) to each lane. The result is the same ascompare(VectorOperators.LT, e)
. Parameters:
e
 the input scalar Returns:
 the mask result of testing if this vector is less than the input scalar
 See Also:

test
Tests the lanes of this vector according to the given operation. This is a lanewise unary test operation which applies the given test operation to each lane value. 
test
Test selected lanes of this vector, according to the given operation. This is a masked lanewise unary test operation which applies the given test operation to each lane value. The returned result is equal to the expressiontest(op).and(m)
. 
compare
Tests this vector by comparing it with another input vector, according to the given comparison operation. This is a lanewise binary test operation which applies the given comparison operation to each pair of corresponding lane values. 
compare
Tests this vector by comparing it with an input scalar, according to the given comparison operation. This is a lanewise binary test operation which applies the comparison operation to each lane.The result is the same as
compare(op, broadcast(species(), e))
. That is, the scalar may be regarded as broadcast to a vector of the same species, and then compared against the original vector, using the selected comparison operation. Parameters:
op
 the operation used to compare lane valuese
 the input scalar Returns:
 the mask result of testing lanewise if this vector compares to the input, according to the selected comparison operator
 See Also:

compare
Tests this vector by comparing it with an input scalar, according to the given comparison operation, in lanes selected by a mask. This is a masked lanewise binary test operation which applies to each pair of corresponding lane values. The returned result is equal to the expressioncompare(op,s).and(m)
. Parameters:
op
 the operation used to compare lane valuese
 the input scalarm
 the mask controlling lane selection Returns:
 the mask result of testing lanewise if this vector compares to the input, according to the selected comparison operator, and only in the lanes selected by the mask
 See Also:

compare
Tests this vector by comparing it with an input scalar, according to the given comparison operation. This is a lanewise binary test operation which applies the given comparison operation to each lane value, paired with the broadcast value.The result is the same as
this.compare(op, this.broadcast(e))
. That is, the scalar may be regarded as broadcast to a vector of the same species, and then compared against the original vector, using the selected comparison operation. 
compare
Tests this vector by comparing it with an input scalar, according to the given comparison operation, in lanes selected by a mask. This is a masked lanewise binary test operation which applies the given comparison operation to each lane value, paired with the broadcast value. The returned result is equal to the expressioncompare(op,e).and(m)
. Specified by:
compare
in classVector<Byte>
 Parameters:
op
 the operation used to compare lane valuese
 the input scalarm
 the mask controlling lane selection Returns:
 the mask result of testing lanewise if this vector compares to the input, according to the selected comparison operator, and only in the lanes selected by the mask
 See Also:

blend
Replaces selected lanes of this vector with corresponding lanes from a second input vector under the control of a mask. This is a masked lanewise binary operation which selects each lane value from one or the other input. For any lane set in the mask, the new lane value is taken from the second input vector, and replaces whatever value was in the that lane of this vector.
 For any lane unset in the mask, the replacement is suppressed and this vector retains the original value stored in that lane.
Vector<E> a = ...; VectorSpecies<E> species = a.species(); Vector<E> b = ...; b.check(species); VectorMask<E> m = ...; ETYPE[] ar = a.toArray(); for (int i = 0; i < ar.length; i++) { if (m.laneIsSet(i)) { ar[i] = b.lane(i); } } return EVector.fromArray(s, ar, 0);

addIndex
Adds the lanes of this vector to their corresponding lane numbers, scaled by a given constant. This is a lanewise unary operation which, for each laneN
, computes the scaled index valueN*scale
and adds it to the value already in laneN
of the current vector.The scale must not be so large, and the element size must not be so small, that that there would be an overflow when computing any of the
N*scale
orVLENGTH*scale
, when the result is represented using the vector lane typeETYPE
.The following pseudocode illustrates this behavior:
Vector<E> a = ...; VectorSpecies<E> species = a.species(); ETYPE[] ar = a.toArray(); for (int i = 0; i < ar.length; i++) { long d = (long)i * scale; if (d != (ETYPE) d) throw ...; ar[i] += (ETYPE) d; } long d = (long)ar.length * scale; if (d != (ETYPE) d) throw ...; return EVector.fromArray(s, ar, 0);

blend
Replaces selected lanes of this vector with a scalar value under the control of a mask. This is a masked lanewise binary operation which selects each lane value from one or the other input. The returned result is equal to the expressionblend(broadcast(e),m)
. Parameters:
e
 the input scalar, containing the replacement lane valuem
 the mask controlling lane selection of the scalar Returns:
 the result of blending the lane elements of this vector with the scalar value

blend
Replaces selected lanes of this vector with a scalar value under the control of a mask. This is a masked lanewise binary operation which selects each lane value from one or the other input. The returned result is equal to the expressionblend(broadcast(e),m)
. 
slice
Slices a segment of adjacent lanes, starting at a givenorigin
lane in the current vector, and continuing (as needed) into an immediately following vector. The block ofVLENGTH
lanes is extracted into its own vector and returned.This is a crosslane operation that shifts lane elements to the front, from the current vector and the second vector. Both vectors can be viewed as a combined "background" of length
2*VLENGTH
, from which a slice is extracted. The lane numberedN
in the output vector is copied from laneorigin+N
of the input vector, if that lane exists, else from laneorigin+NVLENGTH
of the second vector (which is guaranteed to exist).The
origin
value must be in the inclusive range0..VLENGTH
. As limiting cases,v.slice(0,w)
andv.slice(VLENGTH,w)
returnv
andw
, respectively. Parameters:
origin
 the first input lane to transfer into the slicev1
 a second vector logically concatenated with the first, before the slice is taken (if omitted it defaults to zero) Returns:
 a contiguous slice of
VLENGTH
lanes, taken from this vector starting at the indicated origin, and continuing (as needed) into the second vector  See Also:

slice
Slices a segment of adjacent lanes under the control of a mask, starting at a givenorigin
lane in the current vector, and continuing (as needed) into an immediately following vector. The block ofVLENGTH
lanes is extracted into its own vector and returned. The resulting vector will be zero in all lanes unset in the given mask. Lanes set in the mask will contain data copied from selected lanes ofthis
orv1
.This is a crosslane operation that shifts lane elements to the front, from the current vector and the second vector. Both vectors can be viewed as a combined "background" of length
2*VLENGTH
, from which a slice is extracted. The returned result is equal to the expressionbroadcast(0).blend(slice(origin,v1),m)
. Specified by:
slice
in classVector<Byte>
 Parameters:
origin
 the first input lane to transfer into the slicew
 a second vector logically concatenated with the first, before the slice is taken (if omitted it defaults to zero)m
 the mask controlling lane selection into the resulting vector Returns:
 a contiguous slice of
VLENGTH
lanes, taken from this vector starting at the indicated origin, and continuing (as needed) into the second vector  See Also:

slice
Slices a segment of adjacent lanes, starting at a givenorigin
lane in the current vector. A block ofVLENGTH
lanes, possibly padded with zero lanes, is extracted into its own vector and returned. This is a convenience method which slices from a single vector against an extended background of zero lanes. It is equivalent toslice
(origin,
broadcast
(0))
. It may also be viewed simply as a crosslane shift from later to earlier lanes, with zeroes filling in the vacated lanes at the end of the vector. In this view, the shift count isorigin
. Parameters:
origin
 the first input lane to transfer into the slice Returns:
 the last
VLENGTHorigin
input lanes, placed starting in the first lane of the output, padded at the end with zeroes  See Also:

unslice
Reverses a slice(), inserting the current vector as a slice within another "background" input vector, which is regarded as one or the other input to a hypothetical subsequentslice()
operation.This is a crosslane operation that permutes the lane elements of the current vector toward the back and inserts them into a logical pair of background vectors. Only one of the pair will be returned, however. The background is formed by duplicating the second input vector. (However, the output will never contain two duplicates from the same input lane.) The lane numbered
N
in the input vector is copied into laneorigin+N
of the first background vector, if that lane exists, else into laneorigin+NVLENGTH
of the second background vector (which is guaranteed to exist). The first or second background vector, updated with the inserted slice, is returned. Thepart
number of zero or one selects the first or second updated background vector.The
origin
value must be in the inclusive range0..VLENGTH
. As limiting cases,v.unslice(0,w,0)
andv.unslice(VLENGTH,w,1)
both returnv
, whilev.unslice(0,w,1)
andv.unslice(VLENGTH,w,0)
both returnw
. Specified by:
unslice
in classVector<Byte>
 Parameters:
origin
 the first output lane to receive the slicew
 the background vector that (as two copies) will receive the inserted slicepart
 the part number of the result (either zero or one) Returns:
 either the first or second part of a pair of
background vectors
w
, updated by inserting this vector at the indicated origin  See Also:

unslice
Reverses a slice(), inserting (under the control of a mask) the current vector as a slice within another "background" input vector, which is regarded as one or the other input to a hypothetical subsequentslice()
operation.This is a crosslane operation that permutes the lane elements of the current vector forward and inserts its lanes (when selected by the mask) into a logical pair of background vectors. As with the unmasked version of this method, only one of the pair will be returned, as selected by the
part
number. For each laneN
selected by the mask, the lane value is copied into laneorigin+N
of the first background vector, if that lane exists, else into laneorigin+NVLENGTH
of the second background vector (which is guaranteed to exist). Background lanes retain their original values if the corresponding input lanesN
are unset in the mask. The first or second background vector, updated with set lanes of the inserted slice, is returned. Thepart
number of zero or one selects the first or second updated background vector. Specified by:
unslice
in classVector<Byte>
 Parameters:
origin
 the first output lane to receive the slicew
 the background vector that (as two copies) will receive the inserted slice, if they are set inm
part
 the part number of the result (either zero or one)m
 the mask controlling lane selection from the current vector Returns:
 either the first or second part of a pair of
background vectors
w
, updated by inserting selected lanes of this vector at the indicated origin  See Also:

unslice
Reverses a slice(), inserting the current vector as a slice within a "background" input of zero lane values. Compared to otherunslice()
methods, this method only returns the first of the pair of background vectors. This is a convenience method which returns the result ofunslice
(origin,
broadcast
(0), 0)
. It may also be viewed simply as a crosslane shift from earlier to later lanes, with zeroes filling in the vacated lanes at the beginning of the vector. In this view, the shift count isorigin
. 
rearrange
Rearranges the lane elements of this vector, selecting lanes under the control of a specific shuffle. This is a crosslane operation that rearranges the lane elements of this vector. For each laneN
of the shuffle, and for each lane source indexI=s.laneSource(N)
in the shuffle, the output laneN
obtains the value from the input vector at laneI
. 
rearrange
Rearranges the lane elements of this vector, selecting lanes under the control of a specific shuffle and a mask. This is a crosslane operation that rearranges the lane elements of this vector. For each laneN
of the shuffle, and for each lane source indexI=s.laneSource(N)
in the shuffle, the output laneN
obtains the value from the input vector at laneI
if the mask is set. Otherwise the output laneN
is set to zero.This method returns the value of this pseudocode:
Vector<E> r = this.rearrange(s.wrapIndexes()); VectorMask<E> valid = s.laneIsValid(); if (m.andNot(valid).anyTrue()) throw ...; return broadcast(0).blend(r, m);

rearrange
Rearranges the lane elements of two vectors, selecting lanes under the control of a specific shuffle, using both normal and exceptional indexes in the shuffle to steer data. This is a crosslane operation that rearranges the lane elements of the two input vectors (the current vector and a second vectorv
). For each laneN
of the shuffle, and for each lane source indexI=s.laneSource(N)
in the shuffle, the output laneN
obtains the value from the first vector at laneI
ifI>=0
. Otherwise, the exceptional indexI
is wrapped by addingVLENGTH
to it and used to index the second vector, at indexI+VLENGTH
.This method returns the value of this pseudocode:
Vector<E> r1 = this.rearrange(s.wrapIndexes()); // or else: r1 = this.rearrange(s, s.laneIsValid()); Vector<E> r2 = v.rearrange(s.wrapIndexes()); return r2.blend(r1,s.laneIsValid());

compress
Compresses the lane elements of this vector selecting lanes under the control of a specific mask. This is a crosslane operation that compresses the lane elements of this vector as selected by the specified mask. For each laneN
of the mask, if the mask at laneN
is set, the element at laneN
of input vector is selected and stored into the output vector contiguously starting from the lane0
. All the upper remaining lanes, if any, of the output vector are set to zero. 
expand
Expands the lane elements of this vector under the control of a specific mask. This is a crosslane operation that expands the contiguous lane elements of this vector into lanes of an output vector as selected by the specified mask. For each laneN
of the mask, if the mask at laneN
is set, the next contiguous element of input vector starting from lane0
is selected and stored into the output vector at laneN
. All the remaining lanes, if any, of the output vector are set to zero. 
selectFrom
Using index values stored in the lanes of this vector, assemble values stored in second vectorv
. The second vector thus serves as a table, whose elements are selected by indexes in the current vector. This is a crosslane operation that rearranges the lane elements of the argument vector, under the control of this vector. For each laneN
of this vector, and for each lane valueI=this.lane(N)
in this vector, the output laneN
obtains the value from the argument vector at laneI
. In this way, the result contains only values stored in the argument vectorv
, but presented in an order which depends on the index values inthis
. The result is the same as the expressionv.rearrange(this.toShuffle())
. Specified by:
selectFrom
in classVector<Byte>
 Parameters:
v
 the vector supplying the result values Returns:
 the rearrangement of the lane elements of
v
 See Also:

selectFrom
Using index values stored in the lanes of this vector, assemble values stored in second vector, under the control of a mask. Using index values stored in the lanes of this vector, assemble values stored in second vectorv
. The second vector thus serves as a table, whose elements are selected by indexes in the current vector. Lanes that are unset in the mask receive a zero rather than a value from the table. This is a crosslane operation that rearranges the lane elements of the argument vector, under the control of this vector and the mask. The result is the same as the expressionv.rearrange(this.toShuffle(), m)
. Specified by:
selectFrom
in classVector<Byte>
 Parameters:
s
 the vector supplying the result valuesm
 the mask controlling selection fromv
 Returns:
 the rearrangement of the lane elements of
v
 See Also:

bitwiseBlend
Blends together the bits of two vectors under the control of a third, which supplies mask bits. This is a lanewise ternary operation which performs a bitwise blending operation(a&~c)(b&c)
to each lane. This method is also equivalent to the expressionlanewise
(
BITWISE_BLEND
, bits, mask)
. Parameters:
bits
 input bits to blend into the current vectormask
 a bitwise mask to enable blending of the input bits Returns:
 the bitwise blend of the given bits into the current vector, under control of the bitwise mask
 See Also:

bitwiseBlend
Blends together the bits of a vector and a scalar under the control of another scalar, which supplies mask bits. This is a lanewise ternary operation which performs a bitwise blending operation(a&~c)(b&c)
to each lane. This method is also equivalent to the expressionlanewise
(
BITWISE_BLEND
, bits, mask)
. Parameters:
bits
 input bits to blend into the current vectormask
 a bitwise mask to enable blending of the input bits Returns:
 the bitwise blend of the given bits into the current vector, under control of the bitwise mask
 See Also:

bitwiseBlend
Blends together the bits of a vector and a scalar under the control of another vector, which supplies mask bits. This is a lanewise ternary operation which performs a bitwise blending operation(a&~c)(b&c)
to each lane. This method is also equivalent to the expressionlanewise
(
BITWISE_BLEND
, bits, mask)
. Parameters:
bits
 input bits to blend into the current vectormask
 a bitwise mask to enable blending of the input bits Returns:
 the bitwise blend of the given bits into the current vector, under control of the bitwise mask
 See Also:

bitwiseBlend
Blends together the bits of two vectors under the control of a scalar, which supplies mask bits. This is a lanewise ternary operation which performs a bitwise blending operation(a&~c)(b&c)
to each lane. This method is also equivalent to the expressionlanewise
(
BITWISE_BLEND
, bits, mask)
. Parameters:
bits
 input bits to blend into the current vectormask
 a bitwise mask to enable blending of the input bits Returns:
 the bitwise blend of the given bits into the current vector, under control of the bitwise mask
 See Also:

reduceLanes
Returns a value accumulated from all the lanes of this vector. This is an associative crosslane reduction operation which applies the specified operation to all the lane elements.A few reduction operations do not support arbitrary reordering of their operands, yet are included here because of their usefulness.

In the case of
FIRST_NONZERO
, the reduction returns the value from the lowestnumbered nonzero lane.  All other reduction operations are fully commutative and associative. The implementation can choose any order of processing, yet it will always produce the same result.
 Parameters:
op
 the operation used to combine lane values Returns:
 the accumulated result
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

In the case of

reduceLanes
Returns a value accumulated from selected lanes of this vector, controlled by a mask. This is an associative crosslane reduction operation which applies the specified operation to the selected lane elements.If no elements are selected, an operationspecific identity value is returned.

If the operation is
ADD
,XOR
,OR
, orFIRST_NONZERO
, then the identity value is zero, the defaultbyte
value. 
If the operation is
MUL
, then the identity value is one. 
If the operation is
AND
, then the identity value is minus one (all bits set). 
If the operation is
MAX
, then the identity value isByte.MIN_VALUE
. 
If the operation is
MIN
, then the identity value isByte.MAX_VALUE
.
A few reduction operations do not support arbitrary reordering of their operands, yet are included here because of their usefulness.

In the case of
FIRST_NONZERO
, the reduction returns the value from the lowestnumbered nonzero lane.  All other reduction operations are fully commutative and associative. The implementation can choose any order of processing, yet it will always produce the same result.
 Parameters:
op
 the operation used to combine lane valuesm
 the mask controlling lane selection Returns:
 the reduced result accumulated from the selected lane values
 Throws:
UnsupportedOperationException
 if this vector does not support the requested operation See Also:

If the operation is

lane
public abstract byte lane(int i) Gets the lane element at lane indexi
 Parameters:
i
 the lane index Returns:
 the lane element at lane index
i
 Throws:
IllegalArgumentException
 if the index is is out of range (< 0  >= length()
)

withLane
Replaces the lane element of this vector at lane indexi
with valuee
. This is a crosslane operation and behaves as if it returns the result of blending this vector with an input vector that is the result of broadcastinge
and a mask that has only one lane set at lane indexi
. Parameters:
i
 the lane index of the lane element to be replacede
 the value to be placed Returns:
 the result of replacing the lane element of this vector at lane
index
i
with valuee
.  Throws:
IllegalArgumentException
 if the index is is out of range (< 0  >= length()
)

toArray
public final byte[] toArray()Returns an array of typebyte[]
containing all the lane values. The array length is the same as the vector length. The array elements are stored in lane order.This method behaves as if it stores this vector into an allocated array (using
intoArray
) and returns the array as follows:byte[] a = new byte[this.length()]; this.intoArray(a, 0); return a;

toIntArray
public final int[] toIntArray()Returns anint[]
array containing all the lane values, converted to the typeint
. The array length is the same as the vector length. The array elements are converted as if by casting and stored in lane order. This operation may fail if the vector element type isfloat
ordouble
, when lanes contain fractional or outofrange values. If any vector lane value is not representable as anint
, an exception is thrown. Specified by:
toIntArray
in classVector<Byte>
 Implementation Note:
 When this method is used on used on vectors
of type
ByteVector
, there will be no loss of precision or range, and so noUnsupportedOperationException
will be thrown.  Returns:
 an
int[]
array containing the lane values of this vector  See Also:

toLongArray
public final long[] toLongArray()Returns along[]
array containing all the lane values, converted to the typelong
. The array length is the same as the vector length. The array elements are converted as if by casting and stored in lane order. This operation may fail if the vector element type isfloat
ordouble
, when lanes contain fractional or outofrange values. If any vector lane value is not representable as along
, an exception is thrown. Specified by:
toLongArray
in classVector<Byte>
 Implementation Note:
 When this method is used on used on vectors
of type
ByteVector
, there will be no loss of precision or range, and so noUnsupportedOperationException
will be thrown.  Returns:
 a
long[]
array containing the lane values of this vector  See Also:

toDoubleArray
public final double[] toDoubleArray()Returns adouble[]
array containing all the lane values, converted to the typedouble
. The array length is the same as the vector length. The array elements are converted as if by casting and stored in lane order. This operation can lose precision if the vector element type islong
. Specified by:
toDoubleArray
in classVector<Byte>
 Implementation Note:
 When this method is used on used on vectors
of type
ByteVector
, there will be no loss of precision.  Returns:
 a
double[]
array containing the lane values of this vector, possibly rounded to representabledouble
values  See Also:

fromArray
Loads a vector from an array of typebyte[]
starting at an offset. For each vector lane, whereN
is the vector lane index, the array element at indexoffset + N
is placed into the resulting vector at lane indexN
. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array Returns:
 the vector loaded from an array
 Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector

fromArray
public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int offset, VectorMask<Byte> m) Loads a vector from an array of typebyte[]
starting at an offset and using a mask. Lanes where the mask is unset are filled with the default value ofbyte
(zero). For each vector lane, whereN
is the vector lane index, if the mask lane at indexN
is set then the array element at indexoffset + N
is placed into the resulting vector at lane indexN
, otherwise the default element value is placed into the resulting vector at lane indexN
. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the arraym
 the mask controlling lane selection Returns:
 the vector loaded from an array
 Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector where the mask is set

fromArray
public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int offset, int[] indexMap, int mapOffset) Gathers a new vector composed of elements from an array of typebyte[]
, using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, the lane is loaded from the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsindexMap
 the index mapmapOffset
 the offset into the index map Returns:
 the vector loaded from the indexed elements of the array
 Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector See Also:

fromArray
public static ByteVector fromArray(VectorSpecies<Byte> species, byte[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Gathers a new vector composed of elements from an array of typebyte[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, if the lane is set in the mask, the lane is loaded from the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Unset lanes in the resulting vector are set to zero. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsindexMap
 the index mapmapOffset
 the offset into the index mapm
 the mask controlling lane selection Returns:
 the vector loaded from the indexed elements of the array
 Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector where the mask is set See Also:

fromBooleanArray
Loads a vector from an array of typeboolean[]
starting at an offset. For each vector lane, whereN
is the vector lane index, the array element at indexoffset + N
is first converted to abyte
value and then placed into the resulting vector at lane indexN
.A
boolean
value is converted to abyte
value by applying the expression(byte) (b ? 1 : 0)
, whereb
is theboolean
value. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array Returns:
 the vector loaded from an array
 Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector

fromBooleanArray
public static ByteVector fromBooleanArray(VectorSpecies<Byte> species, boolean[] a, int offset, VectorMask<Byte> m) Loads a vector from an array of typeboolean[]
starting at an offset and using a mask. Lanes where the mask is unset are filled with the default value ofbyte
(zero). For each vector lane, whereN
is the vector lane index, if the mask lane at indexN
is set then the array element at indexoffset + N
is first converted to abyte
value and then placed into the resulting vector at lane indexN
, otherwise the default element value is placed into the resulting vector at lane indexN
.A
boolean
value is converted to abyte
value by applying the expression(byte) (b ? 1 : 0)
, whereb
is theboolean
value. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the arraym
 the mask controlling lane selection Returns:
 the vector loaded from an array
 Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector where the mask is set

fromBooleanArray
public static ByteVector fromBooleanArray(VectorSpecies<Byte> species, boolean[] a, int offset, int[] indexMap, int mapOffset) Gathers a new vector composed of elements from an array of typeboolean[]
, using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, the lane is loaded from the expression(byte) (a[f(N)] ? 1 : 0)
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsindexMap
 the index mapmapOffset
 the offset into the index map Returns:
 the vector loaded from the indexed elements of the array
 Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector See Also:

fromBooleanArray
public static ByteVector fromBooleanArray(VectorSpecies<Byte> species, boolean[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Gathers a new vector composed of elements from an array of typeboolean[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, if the lane is set in the mask, the lane is loaded from the expression(byte) (a[f(N)] ? 1 : 0)
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Unset lanes in the resulting vector are set to zero. Parameters:
species
 species of desired vectora
 the arrayoffset
 the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsindexMap
 the index mapmapOffset
 the offset into the index mapm
 the mask controlling lane selection Returns:
 the vector loaded from the indexed elements of the array
 Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector where the mask is set See Also:

fromMemorySegment
public static ByteVector fromMemorySegment(VectorSpecies<Byte> species, MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo) Loads a vector from a memory segment^{PREVIEW} starting at an offset into the memory segment. Bytes are composed into primitive lane elements according to the specified byte order. The vector is arranged into lanes according to memory ordering.This method behaves as if it returns the result of calling
fromMemorySegment()
^{PREVIEW} as follows:var m = species.maskAll(true); return fromMemorySegment(species, ms, offset, bo, m);
 Parameters:
species
 species of desired vectorms
 the memory segmentoffset
 the offset into the memory segmentbo
 the intended byte order Returns:
 a vector loaded from the memory segment
 Throws:
IndexOutOfBoundsException
 ifoffset+N*1 < 0
oroffset+N*1 >= ms.byteSize()
for any laneN
in the vectorIllegalArgumentException
 if the memory segment is a heap segment that is not backed by abyte[]
array.IllegalStateException
 if the memory segment's session is not alive, or if access occurs from a thread other than the thread owning the session. Since:
 19

fromMemorySegment
public static ByteVector fromMemorySegment(VectorSpecies<Byte> species, MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo, VectorMask<Byte> m) Loads a vector from a memory segment^{PREVIEW} starting at an offset into the memory segment and using a mask. Lanes where the mask is unset are filled with the default value ofbyte
(zero). Bytes are composed into primitive lane elements according to the specified byte order. The vector is arranged into lanes according to memory ordering.The following pseudocode illustrates the behavior:
var slice = ms.asSlice(offset); byte[] ar = new byte[species.length()]; for (int n = 0; n < ar.length; n++) { if (m.laneIsSet(n)) { ar[n] = slice.getAtIndex(ValuaLayout.JAVA_BYTE.withByteAlignment(1), n); } } ByteVector r = ByteVector.fromArray(species, ar, 0);
 Implementation Note:
 The byte order argument is ignored.
 Parameters:
species
 species of desired vectorms
 the memory segmentoffset
 the offset into the memory segmentbo
 the intended byte orderm
 the mask controlling lane selection Returns:
 a vector loaded from the memory segment
 Throws:
IndexOutOfBoundsException
 ifoffset+N*1 < 0
oroffset+N*1 >= ms.byteSize()
for any laneN
in the vector where the mask is setIllegalArgumentException
 if the memory segment is a heap segment that is not backed by abyte[]
array.IllegalStateException
 if the memory segment's session is not alive, or if access occurs from a thread other than the thread owning the session. Since:
 19

intoArray
public final void intoArray(byte[] a, int offset) Stores this vector into an array of typebyte[]
starting at an offset.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is stored into the array elementa[offset+N]
. Parameters:
a
 the array, of typebyte[]
offset
 the offset into the array Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector

intoArray
Stores this vector into an array of typebyte[]
starting at offset and using a mask.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is stored into the array elementa[offset+N]
. If the mask lane atN
is unset then the corresponding array elementa[offset+N]
is left unchanged.Array range checking is done for lanes where the mask is set. Lanes where the mask is unset are not stored and do not need to correspond to legitimate elements of
a
. That is, unset lanes may correspond to array indexes less than zero or beyond the end of the array. Parameters:
a
 the array, of typebyte[]
offset
 the offset into the arraym
 the mask controlling lane storage Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector where the mask is set

intoArray
public final void intoArray(byte[] a, int offset, int[] indexMap, int mapOffset) Scatters this vector into an array of typebyte[]
using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is stored into the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Parameters:
a
 the arrayoffset
 an offset to combine with the index map offsetsindexMap
 the index mapmapOffset
 the offset into the index map Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector See Also:

intoArray
public final void intoArray(byte[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Scatters this vector into an array of typebyte[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, if the mask lane at indexN
is set then the lane element at indexN
is stored into the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
. Parameters:
a
 the arrayoffset
 an offset to combine with the index map offsetsindexMap
 the index mapmapOffset
 the offset into the index mapm
 the mask Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector where the mask is set See Also:

intoBooleanArray
public final void intoBooleanArray(boolean[] a, int offset) Stores this vector into an array of typeboolean[]
starting at an offset.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is first converted to aboolean
value and then stored into the array elementa[offset+N]
.A
byte
value is converted to aboolean
value by applying the expression(b & 1) != 0
whereb
is the byte value. Parameters:
a
 the arrayoffset
 the offset into the array Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector

intoBooleanArray
Stores this vector into an array of typeboolean[]
starting at offset and using a mask.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is first converted to aboolean
value and then stored into the array elementa[offset+N]
. If the mask lane atN
is unset then the corresponding array elementa[offset+N]
is left unchanged.A
byte
value is converted to aboolean
value by applying the expression(b & 1) != 0
whereb
is the byte value.Array range checking is done for lanes where the mask is set. Lanes where the mask is unset are not stored and do not need to correspond to legitimate elements of
a
. That is, unset lanes may correspond to array indexes less than zero or beyond the end of the array. Parameters:
a
 the arrayoffset
 the offset into the arraym
 the mask controlling lane storage Throws:
IndexOutOfBoundsException
 ifoffset+N < 0
oroffset+N >= a.length
for any laneN
in the vector where the mask is set

intoBooleanArray
public final void intoBooleanArray(boolean[] a, int offset, int[] indexMap, int mapOffset) Scatters this vector into an array of typeboolean[]
using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is first converted to aboolean
value and then stored into the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
.A
byte
value is converted to aboolean
value by applying the expression(b & 1) != 0
whereb
is the byte value. Parameters:
a
 the arrayoffset
 an offset to combine with the index map offsetsindexMap
 the index mapmapOffset
 the offset into the index map Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector See Also:

intoBooleanArray
public final void intoBooleanArray(boolean[] a, int offset, int[] indexMap, int mapOffset, VectorMask<Byte> m) Scatters this vector into an array of typeboolean[]
, under the control of a mask, and using indexes obtained by adding a fixedoffset
to a series of secondary offsets from an index map. The index map is a contiguous sequence ofVLENGTH
elements in a second array ofint
s, starting at a givenmapOffset
.For each vector lane, where
N
is the vector lane index, if the mask lane at indexN
is set then the lane element at indexN
is first converted to aboolean
value and then stored into the array elementa[f(N)]
, wheref(N)
is the index mapping expressionoffset + indexMap[mapOffset + N]]
.A
byte
value is converted to aboolean
value by applying the expression(b & 1) != 0
whereb
is the byte value. Parameters:
a
 the arrayoffset
 an offset to combine with the index map offsetsindexMap
 the index mapmapOffset
 the offset into the index mapm
 the mask Throws:
IndexOutOfBoundsException
 ifmapOffset+N < 0
or ifmapOffset+N >= indexMap.length
, or iff(N)=offset+indexMap[mapOffset+N]
is an invalid index intoa
, for any laneN
in the vector where the mask is set See Also:

intoMemorySegment
Stores this vector into a memory segment^{PREVIEW} starting at an offset using explicit byte order.Bytes are extracted from primitive lane elements according to the specified byte ordering. The lanes are stored according to their memory ordering.
This method behaves as if it calls
intoMemorySegment()
^{PREVIEW} as follows:var m = maskAll(true); intoMemorySegment(ms, offset, bo, m);
 Specified by:
intoMemorySegment
in classVector<Byte>
 Parameters:
ms
 the memory segmentoffset
 the offset into the memory segmentbo
 the intended byte order Since:
 19

intoMemorySegment
public final void intoMemorySegment(MemorySegment^{PREVIEW} ms, long offset, ByteOrder bo, VectorMask<Byte> m) Stores this vector into a memory segment^{PREVIEW} starting at an offset using explicit byte order and a mask.Bytes are extracted from primitive lane elements according to the specified byte ordering. The lanes are stored according to their memory ordering.
The following pseudocode illustrates the behavior, where
JAVA_E
is the layout of the primitive element type,ETYPE
is the primitive element type, andEVector
is the primitive vector type for this vector:ETYPE[] a = this.toArray(); var slice = ms.asSlice(offset) for (int n = 0; n < a.length; n++) { if (m.laneIsSet(n)) { slice.setAtIndex(ValueLayout.JAVA_E.withBitAlignment(8), n); } }
 Specified by:
intoMemorySegment
in classVector<Byte>
 Parameters:
ms
 the memory segmentoffset
 the offset into the memory segmentbo
 the intended byte orderm
 the mask controlling lane selection Since:
 19

reinterpretAsBytes
Views this vector as a vector of the same shape and contents but a lane type ofbyte
, where the bytes are extracted from the lanes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(byte.class))
. It may be considered an inverse to the various methods which consolidate bytes into larger lanes within the same vector, such asVector.reinterpretAsInts()
. Specified by:
reinterpretAsBytes
in classVector<Byte>
 Returns:
 a
ByteVector
with the same shape and information content  See Also:

viewAsIntegralLanes
Views this vector as a vector of the same shape, length, and contents, but a lane type that is not a floatingpoint type. This is a lanewise reinterpretation cast on the lane values. As such, this method does not changeVSHAPE
orVLENGTH
, and there is no change to the bitwise contents of the vector. If the vector'sETYPE
is already an integral type, the same vector is returned unchanged. This method returns the value of this expression:convert(conv,0)
, whereconv
isVectorOperators.Conversion.ofReinterpret(E.class,F.class)
, andF
is the nonfloatingpoint type of the same size asE
. Specified by:
viewAsIntegralLanes
in classVector<Byte>
 Returns:
 the original vector, reinterpreted as nonfloating point
 See Also:

viewAsFloatingLanes
Views this vector as a vector of the same shape, length, and contents, but a lane type that is a floatingpoint type. This is a lanewise reinterpretation cast on the lane values. As such, there this method does not changeVSHAPE
orVLENGTH
, and there is no change to the bitwise contents of the vector. If the vector'sETYPE
is already a floatpoint type, the same vector is returned unchanged. If the vector's element size does not match any floating point type size, anIllegalArgumentException
is thrown. This method returns the value of this expression:convert(conv,0)
, whereconv
isVectorOperators.Conversion.ofReinterpret(E.class,F.class)
, andF
is the floatingpoint type of the same size asE
, if any. Specified by:
viewAsFloatingLanes
in classVector<Byte>
 Implementation Note:
 This method always throws
UnsupportedOperationException
, because there is no floating point type of the same size asbyte
. The return type of this method is arbitrarily designated asVector<?>
. Future versions of this API may change the return type if additional floating point types become available.  Returns:
 the original vector, reinterpreted as floating point
 See Also:

toString
Returns a string representation of this vector, of the form"[0,1,2...]"
, reporting the lane values of this vector, in lane order. The string is produced as if by a call toArrays.toString()
, as appropriate to thebyte
array returned bythis.toArray()
. 
equals
Indicates whether this vector is identical to some other object. Two vectors are identical only if they have the same species and same lane values, in the same order.The comparison of lane values is produced as if by a call to
Arrays.equals()
, as appropriate to the arrays returned bytoArray()
on both vectors. 
hashCode
public final int hashCode()Returns a hash code value for the vector. based on the lane values and the vector species. 
species
Description copied from class:Vector
Returns the species of this vector. 
check
Description copied from class:Vector
Checks that this vector has the given species, and returns this vector unchanged. The effect is similar to this pseudocode:species == species() ? this : throw new ClassCastException()
. 
check
Checks that this vector has the given element type, and returns this vector unchanged. The effect is similar to this pseudocode:elementType == species().elementType() ? this : throw new ClassCastException()
. 
maskAll
Returns a mask of same species as this vector, where each lane is set or unset according to given single boolean, which is broadcast to all lanes.This method returns the value of this expression:
species().maskAll(bit)
. 
toShuffle
Description copied from class:Vector
Converts this vector into a shuffle, converting the lane values toint
and regarding them as source indexes.This method behaves as if it returns the result of creating a shuffle given an array of the vector elements, as follows:
long[] a = this.toLongArray(); int[] sa = new int[a.length]; for (int i = 0; i < a.length; i++) { sa[i] = (int) a[i]; } return VectorShuffle.fromValues(this.species(), sa);

reinterpretAsShorts
Reinterprets this vector as a vector of the same shape and contents but a lane type ofshort
, where the lanes are assembled from successive bytes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(short.class))
. It may be considered an inverse toVector.reinterpretAsBytes()
. Specified by:
reinterpretAsShorts
in classVector<E>
 Returns:
 a
ShortVector
with the same shape and information content

reinterpretAsInts
Reinterprets this vector as a vector of the same shape and contents but a lane type ofint
, where the lanes are assembled from successive bytes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(int.class))
. It may be considered an inverse toVector.reinterpretAsBytes()
. Specified by:
reinterpretAsInts
in classVector<E>
 Returns:
 a
IntVector
with the same shape and information content

reinterpretAsLongs
Reinterprets this vector as a vector of the same shape and contents but a lane type oflong
, where the lanes are assembled from successive bytes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(long.class))
. It may be considered an inverse toVector.reinterpretAsBytes()
. Specified by:
reinterpretAsLongs
in classVector<E>
 Returns:
 a
LongVector
with the same shape and information content

reinterpretAsFloats
Reinterprets this vector as a vector of the same shape and contents but a lane type offloat
, where the lanes are assembled from successive bytes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(float.class))
. It may be considered an inverse toVector.reinterpretAsBytes()
. Specified by:
reinterpretAsFloats
in classVector<E>
 Returns:
 a
FloatVector
with the same shape and information content

reinterpretAsDoubles
Reinterprets this vector as a vector of the same shape and contents but a lane type ofdouble
, where the lanes are assembled from successive bytes according to littleendian order. It is a convenience method for the expressionreinterpretShape(species().withLanes(double.class))
. It may be considered an inverse toVector.reinterpretAsBytes()
. Specified by:
reinterpretAsDoubles
in classVector<E>
 Returns:
 a
DoubleVector
with the same shape and information content

convert
Convert this vector to a vector of the same shape and a new element type, converting lane values from the currentETYPE
to a new lane type (calledFTYPE
here) according to the indicated conversion. This is a lanewise shapeinvariant operation which copiesETYPE
values from the input vector to correspondingFTYPE
values in the result. Depending on the selected conversion, this operation may either expand or contract its logical result, in which case a nonzeropart
number can further control the selection and steering of the logical result into the physical output vector.Each specific conversion is described by a conversion constant in the class
VectorOperators
. Each conversion operator has a specified domain type and range type. The domain type must exactly match the lane type of the input vector, while the range type determines the lane type of the output vectors.A conversion operator may be classified as (respectively) inplace, expanding, or contracting, depending on whether the bitsize of its domain type is (respectively) equal, less than, or greater than the bitsize of its range type.
Independently, conversion operations can also be classified as reinterpreting or valuetransforming, depending on whether the conversion copies representation bits unchanged, or changes the representation bits in order to retain (part or all of) the logical value of the input value.
If a reinterpreting conversion contracts, it will truncate the upper bits of the input. If it expands, it will pad upper bits of the output with zero bits, when there are no corresponding input bits.
An expanding conversion such as
S2I
(short
value toint
) takes a scalar value and represents it in a larger format (always with some information redundancy). A contracting conversion such asD2F
(double
value tofloat
) takes a scalar value and represents it in a smaller format (always with some information loss). Some inplace conversions may also include information loss, such asL2D
(long
value todouble
) orF2I
(float
value toint
). Reinterpreting inplace conversions are not lossy, unless the bitwise value is somehow not legal in the output type. Converting the bitpattern of aNaN
may discard bits from theNaN
's significand.This classification is important, because, unless otherwise documented, conversion operations never change vector shape, regardless of how they may change lane sizes. Therefore an expanding conversion cannot store all of its results in its output vector, because the output vector has fewer lanes of larger size, in order to have the same overall bitsize as its input. Likewise, a contracting conversion must store its relatively small results into a subset of the lanes of the output vector, defaulting the unused lanes to zero.
As an example, a conversion from
byte
tolong
(M=8
) will discard 87.5% of the input values in order to convert the remaining 12.5% into the roomylong
lanes of the output vector. The inverse conversion will convert back all of the large results, but will waste 87.5% of the lanes in the output vector. Inplace conversions (M=1
) deliver all of their results in one output vector, without wasting lanes.To manage the details of these expansions and contractions, a nonzero
part
parameter selects partial results from expansions, or steers the results of contractions into corresponding locations, as follows: expanding by
M
:part
must be in the range[0..M1]
, and selects the block ofVLENGTH/M
input lanes starting at the origin lane atpart*VLENGTH/M
.The
VLENGTH/M
output lanes represent a partial slice of the whole logical result of the conversion, filling the entire physical output vector.  contracting by
M
:part
must be in the range[M+1..0]
, and steers allVLENGTH
input lanes into the output located at the origin lanepart*VLENGTH
. There is a total ofVLENGTH*M
output lanes, and those not holding converted input values are filled with zeroes.A group of such output vectors, with logical result parts steered to disjoint blocks, can be reassembled using the bitwise or or (for floating point) the
FIRST_NONZERO
operator.  inplace (
M=1
):part
must be zero. Both vectors have the sameVLENGTH
. The result is always positioned at the origin lane of zero.
This method is a restricted version of the more general but less frequently used shapechanging method
convertShape()
. The result of this method is the same as the expressionthis.convertShape(conv, rsp, this.broadcast(part))
, where the output species isrsp=this.species().withLanes(FTYPE.class)
. Specified by:
convert
in classVector<E>
 Type Parameters:
F
 the boxed element type of the species Parameters:
conv
 the desired scalar conversion to apply lanewisepart
 the part number of the result, or zero if neither expanding nor contracting Returns:
 a vector converted by shape and element type from this vector
 See Also:
 expanding by

castShape
Convenience method for converting a vector from one lane type to another, reshaping as needed when lane sizes change. This method returns the value of this expression:convertShape(conv,rsp,part)
, whereconv
isVectorOperators.Conversion.ofCast(E.class,F.class)
.If the old and new species have different shape, this is a shapechanging operation, and may have special implementation costs.
 Specified by:
castShape
in classVector<E>
 Type Parameters:
F
 the boxed element type of the output species Parameters:
toSpecies
 the desired output speciespart
 the part number of the result, or zero if neither expanding nor contracting Returns:
 a vector converted by element type from this vector
 See Also:

convertShape
public abstract <F> Vector<F> convertShape(VectorOperators.Conversion<Byte, F> conv, VectorSpecies<F> rsp, int part) Converts this vector to a vector of the given species, shape and element type, converting lane values from the currentETYPE
to a new lane type (calledFTYPE
here) according to the indicated conversion. This is a lanewise operation which copiesETYPE
values from the input vector to correspondingFTYPE
values in the result.If the old and new species have the same shape, the behavior is exactly the same as the simpler, shapeinvariant method
convert()
. In such cases, the simpler methodconvert()
should be used, to make code easier to reason about. Otherwise, this is a shapechanging operation, and may have special implementation costs.As a combined effect of shape changes and lane size changes, the input and output species may have different lane counts, causing expansion or contraction. In this case a nonzero
part
parameter selects partial results from an expanded logical result, or steers the results of a contracted logical result into a physical output vector of the required output species.The following pseudocode illustrates the behavior of this method for inplace, expanding, and contracting conversions. (This pseudocode also applies to the shapeinvariant method, but with shape restrictions on the output species.) Note that only one of the three code paths is relevant to any particular combination of conversion operator and shapes.
FTYPE scalar_conversion_op(ETYPE s); EVector a = ...; VectorSpecies<F> rsp = ...; int part = ...; VectorSpecies<E> dsp = a.species(); int domlen = dsp.length(); int ranlen = rsp.length(); FTYPE[] logical = new FTYPE[domlen]; for (int i = 0; i < domlen; i++) { logical[i] = scalar_conversion_op(a.lane(i)); } FTYPE[] physical; if (domlen == ranlen) { // inplace assert part == 0; //else AIOOBE physical = logical; } else if (domlen > ranlen) { // expanding int M = domlen / ranlen; assert 0 <= part && part < M; //else AIOOBE int origin = part * ranlen; physical = Arrays.copyOfRange(logical, origin, origin + ranlen); } else { // (domlen < ranlen) // contracting int M = ranlen / domlen; assert 0 >= part && part > M; //else AIOOBE int origin = part * domlen; System.arraycopy(logical, 0, physical, origin, domlen); } return FVector.fromArray(ran, physical, 0);
 Specified by:
convertShape
in classVector<E>
 Type Parameters:
F
 the boxed element type of the output species Parameters:
conv
 the desired scalar conversion to apply lanewisersp
 the desired output speciespart
 the part number of the result, or zero if neither expanding nor contracting Returns:
 a vector converted by element type from this vector
 See Also:

getPayload

ByteVector
when preview features are enabled.