public abstract class VectorOperators extends Object
ADD
in w = v0.
lanewise
(ADD, v1)
. The documentation for each individual operator token is very brief, giving a symbolic Java expression for the operation that the token requests. Those symbolic expressions use the following conventional elements:
a
, b
, c
— names of lane values +
, ?:
, etc. — expression operators max
, sin
, etc. — methods in standard classes like Math
, Double
, etc. Unqualified method names should be read as if in the context of a static import, and with resolution of overloading. bits(x)
— a function call which produces the underlying bits of the value x
. If x
is a floating point value, this is either doubleToLongBits(x)
or floatToIntBits(x)
. Otherwise, the value is just x
. ESIZE
— the size in bytes of the operand type EMASK
— the bit mask of the operand type, where EMASK=(1<<(ESIZE*8))-1
intVal
, byteVal
, etc. — the operand of a conversion, with the indicated type float
and the Java operation or method only accepts and returns double
values, then the scalar operation on each lane is adapted to cast operands and the result, specifically widening float
operands to double
operands and narrowing the double
result to a float
. ADD
and MUL
used with cross-lane reduction operations, such as FloatVector.reduceLanes(Associative)
. The result of such an operation is a function both of the input values (vector and mask) as well as the order of the scalar operations applied to combine lane values. In such cases the order is intentionally not defined. This allows the JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to add or multiply all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation is applied, which adds vector elements sequentially from beginning to end. For this reason, the result of such an operation may vary for the same input values. Note that a particular operator token may apply to several different lane types. Thus, these tokens behave like overloaded operators or methods, not like type-specific method handles or lambdas. Also unlike method handles or lambdas, these operators do not possess operational semantics; they have no apply
or invoke
method. They are used only to request lane operations from vector objects, and cannot (by themselves) perform operations on individual lane values.
Modifier and Type | Class | Description |
---|---|---|
static interface |
VectorOperators.Associative |
Type for all reassociating lane-wise binary operators, usable in expressions like e = v0. reduceLanes (ADD) . |
static interface |
VectorOperators.Binary |
|
static interface |
VectorOperators.Comparison |
|
static interface |
VectorOperators.Conversion<E, |
|
static interface |
VectorOperators.Operator |
Root type for all operator tokens, providing queries for common properties such as arity, argument and return types, symbolic name, and operator name. |
static interface |
VectorOperators.Ternary |
|
static interface |
VectorOperators.Test |
|
static interface |
VectorOperators.Unary |
Modifier and Type | Field | Description |
---|---|---|
static final VectorOperators.Unary |
ABS |
Produce abs(a) . |
static final VectorOperators.Unary |
ACOS |
Produce acos(a) . |
static final VectorOperators.Associative |
ADD |
Produce a+b . |
static final VectorOperators.Associative |
AND |
Produce a&b . |
static final VectorOperators.Binary |
AND_NOT |
Produce a&~b . |
static final VectorOperators.Binary |
ASHR |
Produce a>>(n&(ESIZE*8-1)) . |
static final VectorOperators.Unary |
ASIN |
Produce asin(a) . |
static final VectorOperators.Unary |
ATAN |
Produce atan(a) . |
static final VectorOperators.Binary |
ATAN2 |
Produce atan2(a,b) . |
static final VectorOperators.Conversion |
B2D |
Convert byteVal to (double)byteVal . |
static final VectorOperators.Conversion |
B2F |
Convert byteVal to (float)byteVal . |
static final VectorOperators.Conversion |
B2I |
Convert byteVal to (int)byteVal . |
static final VectorOperators.Conversion |
B2L |
Convert byteVal to (long)byteVal . |
static final VectorOperators.Conversion |
B2S |
Convert byteVal to (short)byteVal . |
static final VectorOperators.Unary |
BIT_COUNT |
Produce bitCount(a)
|
static final VectorOperators.Ternary |
BITWISE_BLEND |
Produce a^((a^b)&c) . |
static final VectorOperators.Unary |
CBRT |
Produce cbrt(a) . |
static final VectorOperators.Binary |
COMPRESS_BITS |
Produce compress(a,n) . |
static final VectorOperators.Unary |
COS |
Produce cos(a) . |
static final VectorOperators.Unary |
COSH |
Produce cosh(a) . |
static final VectorOperators.Conversion |
D2B |
Convert doubleVal to (byte)doubleVal . |
static final VectorOperators.Conversion |
D2F |
Convert doubleVal to (float)doubleVal . |
static final VectorOperators.Conversion |
D2I |
Convert doubleVal to (int)doubleVal . |
static final VectorOperators.Conversion |
D2L |
Convert doubleVal to (long)doubleVal . |
static final VectorOperators.Conversion |
D2S |
Convert doubleVal to (short)doubleVal . |
static final VectorOperators.Binary |
DIV |
Produce a/b . |
static final VectorOperators.Comparison |
EQ |
Compare a==b . |
static final VectorOperators.Unary |
EXP |
Produce exp(a) . |
static final VectorOperators.Binary |
EXPAND_BITS |
Produce expand(a,n) . |
static final VectorOperators.Unary |
EXPM1 |
Produce expm1(a) . |
static final VectorOperators.Conversion |
F2B |
Convert floatVal to (byte)floatVal . |
static final VectorOperators.Conversion |
F2D |
Convert floatVal to (double)floatVal . |
static final VectorOperators.Conversion |
F2I |
Convert floatVal to (int)floatVal . |
static final VectorOperators.Conversion |
F2L |
Convert floatVal to (long)floatVal . |
static final VectorOperators.Conversion |
F2S |
Convert floatVal to (short)floatVal . |
static final VectorOperators.Associative |
FIRST_NONZERO |
Produce bits(a)!=0?a:b . |
static final VectorOperators.Ternary |
FMA |
Produce fma(a,b,c) . |
static final VectorOperators.Comparison |
GE |
Compare a>=b . |
static final VectorOperators.Comparison |
GT |
Compare a>b . |
static final VectorOperators.Binary |
HYPOT |
Produce hypot(a,b) . |
static final VectorOperators.Conversion |
I2B |
Convert intVal to (byte)intVal . |
static final VectorOperators.Conversion |
I2D |
Convert intVal to (double)intVal . |
static final VectorOperators.Conversion |
I2F |
Convert intVal to (float)intVal . |
static final VectorOperators.Conversion |
I2L |
Convert intVal to (long)intVal . |
static final VectorOperators.Conversion |
I2S |
Convert intVal to (short)intVal . |
static final VectorOperators.Test |
IS_DEFAULT |
Test bits(a)==0 . |
static final VectorOperators.Test |
IS_FINITE |
Test isFinite(a) . |
static final VectorOperators.Test |
IS_INFINITE |
Test isInfinite(a) . |
static final VectorOperators.Test |
IS_NAN |
Test isNaN(a) . |
static final VectorOperators.Test |
IS_NEGATIVE |
Test bits(a)<0 . |
static final VectorOperators.Conversion |
L2B |
Convert longVal to (byte)longVal . |
static final VectorOperators.Conversion |
L2D |
Convert longVal to (double)longVal . |
static final VectorOperators.Conversion |
L2F |
Convert longVal to (float)longVal . |
static final VectorOperators.Conversion |
L2I |
Convert longVal to (int)longVal . |
static final VectorOperators.Conversion |
L2S |
Convert longVal to (short)longVal . |
static final VectorOperators.Comparison |
LE |
Compare a<=b . |
static final VectorOperators.Unary |
LEADING_ZEROS_COUNT |
Produce numberOfLeadingZeros(a)
|
static final VectorOperators.Unary |
LOG |
Produce log(a) . |
static final VectorOperators.Unary |
LOG10 |
Produce log10(a) . |
static final VectorOperators.Unary |
LOG1P |
Produce log1p(a) . |
static final VectorOperators.Binary |
LSHL |
Produce a<<(n&(ESIZE*8-1)) . |
static final VectorOperators.Binary |
LSHR |
Produce (a&EMASK)>>>(n&(ESIZE*8-1)) . |
static final VectorOperators.Comparison |
LT |
Compare a<b . |
static final VectorOperators.Associative |
MAX |
Produce max(a,b) . |
static final VectorOperators.Associative |
MIN |
Produce min(a,b) . |
static final VectorOperators.Associative |
MUL |
Produce a*b . |
static final VectorOperators.Comparison |
NE |
Compare a!=b . |
static final VectorOperators.Unary |
NEG |
Produce -a . |
static final VectorOperators.Unary |
NOT |
Produce ~a . |
static final VectorOperators.Associative |
OR |
Produce a|b . |
static final VectorOperators.Binary |
POW |
Produce pow(a,b) . |
static final VectorOperators.Conversion |
REINTERPRET_D2L |
Reinterpret bits of doubleVal as long . |
static final VectorOperators.Conversion |
REINTERPRET_F2I |
Reinterpret bits of floatVal as int . |
static final VectorOperators.Conversion |
REINTERPRET_I2F |
Reinterpret bits of intVal as float . |
static final VectorOperators.Conversion |
REINTERPRET_L2D |
Reinterpret bits of longVal as double . |
static final VectorOperators.Unary |
REVERSE |
Produce reverse(a)
|
static final VectorOperators.Unary |
REVERSE_BYTES |
Produce reverseBytes(a)
|
static final VectorOperators.Binary |
ROL |
Produce rotateLeft(a,n) . |
static final VectorOperators.Binary |
ROR |
Produce rotateRight(a,n) . |
static final VectorOperators.Conversion |
S2B |
Convert shortVal to (byte)shortVal . |
static final VectorOperators.Conversion |
S2D |
Convert shortVal to (double)shortVal . |
static final VectorOperators.Conversion |
S2F |
Convert shortVal to (float)shortVal . |
static final VectorOperators.Conversion |
S2I |
Convert shortVal to (int)shortVal . |
static final VectorOperators.Conversion |
S2L |
Convert shortVal to (long)shortVal . |
static final VectorOperators.Unary |
SIN |
Produce sin(a) . |
static final VectorOperators.Unary |
SINH |
Produce sinh(a) . |
static final VectorOperators.Unary |
SQRT |
Produce sqrt(a) . |
static final VectorOperators.Binary |
SUB |
Produce a-b . |
static final VectorOperators.Unary |
TAN |
Produce tan(a) . |
static final VectorOperators.Unary |
TANH |
Produce tanh(a) . |
static final VectorOperators.Unary |
TRAILING_ZEROS_COUNT |
Produce numberOfTrailingZeros(a)
|
static final VectorOperators.Comparison |
UNSIGNED_GE |
Unsigned compare a>=b . |
static final VectorOperators.Comparison |
UNSIGNED_GT |
Unsigned compare a>b . |
static final VectorOperators.Comparison |
UNSIGNED_LE |
Unsigned compare a<=b . |
static final VectorOperators.Comparison |
UNSIGNED_LT |
Unsigned compare a<b . |
static final VectorOperators.Associative |
XOR |
Produce a^b . |
static final VectorOperators.Conversion |
ZERO_EXTEND_B2I |
Zero-extend byteVal to int . |
static final VectorOperators.Conversion |
ZERO_EXTEND_B2L |
Zero-extend byteVal to long . |
static final VectorOperators.Conversion |
ZERO_EXTEND_B2S |
Zero-extend byteVal to short . |
static final VectorOperators.Conversion |
ZERO_EXTEND_I2L |
Zero-extend intVal to long . |
static final VectorOperators.Conversion |
ZERO_EXTEND_S2I |
Zero-extend shortVal to int . |
static final VectorOperators.Conversion |
ZERO_EXTEND_S2L |
Zero-extend shortVal to long . |
static final VectorOperators.Unary |
ZOMO |
Produce a==0?0:-1 (zero or minus one). |
public static final VectorOperators.Unary NOT
~a
. Integral only.public static final VectorOperators.Unary ZOMO
a==0?0:-1
(zero or minus one). Integral only.public static final VectorOperators.Unary ABS
abs(a)
.public static final VectorOperators.Unary NEG
-a
.public static final VectorOperators.Unary BIT_COUNT
bitCount(a)
public static final VectorOperators.Unary TRAILING_ZEROS_COUNT
numberOfTrailingZeros(a)
public static final VectorOperators.Unary LEADING_ZEROS_COUNT
numberOfLeadingZeros(a)
public static final VectorOperators.Unary REVERSE
reverse(a)
public static final VectorOperators.Unary REVERSE_BYTES
reverseBytes(a)
public static final VectorOperators.Unary SIN
sin(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary COS
cos(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary TAN
tan(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary ASIN
asin(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary ACOS
acos(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary ATAN
atan(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary EXP
exp(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary LOG
log(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary LOG10
log10(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary SQRT
sqrt(a)
. Floating only. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary CBRT
cbrt(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary SINH
sinh(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary COSH
cosh(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary TANH
tanh(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary EXPM1
expm1(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Unary LOG1P
log1p(a)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Associative ADD
a+b
.public static final VectorOperators.Binary SUB
a-b
.public static final VectorOperators.Associative MUL
a*b
.public static final VectorOperators.Binary DIV
a/b
. Floating only.public static final VectorOperators.Associative MIN
min(a,b)
.public static final VectorOperators.Associative MAX
max(a,b)
.public static final VectorOperators.Associative FIRST_NONZERO
bits(a)!=0?a:b
.public static final VectorOperators.Associative AND
a&b
. Integral only.public static final VectorOperators.Binary AND_NOT
a&~b
. Integral only.public static final VectorOperators.Associative OR
a|b
. Integral only.public static final VectorOperators.Associative XOR
a^b
. Integral only.public static final VectorOperators.Binary LSHL
a<<(n&(ESIZE*8-1))
. Integral only.public static final VectorOperators.Binary ASHR
a>>(n&(ESIZE*8-1))
. Integral only.public static final VectorOperators.Binary LSHR
(a&EMASK)>>>(n&(ESIZE*8-1))
. Integral only.public static final VectorOperators.Binary ROL
rotateLeft(a,n)
. Integral only.public static final VectorOperators.Binary ROR
rotateRight(a,n)
. Integral only.public static final VectorOperators.Binary COMPRESS_BITS
compress(a,n)
. Integral, int
and long
, only.public static final VectorOperators.Binary EXPAND_BITS
expand(a,n)
. Integral, int
and long
, only.public static final VectorOperators.Binary ATAN2
atan2(a,b)
. See Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Binary POW
pow(a,b)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Binary HYPOT
hypot(a,b)
. Floating only. Not guaranteed to be semi-monotonic. See section "Operations on floating point vectors" abovepublic static final VectorOperators.Ternary BITWISE_BLEND
a^((a^b)&c)
. (Bitwise (c(i)?b(i):a(i))
.) Integral only.public static final VectorOperators.Ternary FMA
fma(a,b,c)
. Floating only.public static final VectorOperators.Test IS_DEFAULT
bits(a)==0
. (Not true of -0.0
.)public static final VectorOperators.Test IS_NEGATIVE
bits(a)<0
. (True of -0.0
.)public static final VectorOperators.Test IS_FINITE
isFinite(a)
. Floating only.public static final VectorOperators.Test IS_NAN
isNaN(a)
. Floating only.public static final VectorOperators.Test IS_INFINITE
isInfinite(a)
. Floating only.public static final VectorOperators.Comparison EQ
a==b
.public static final VectorOperators.Comparison NE
a!=b
.public static final VectorOperators.Comparison LT
a<b
.public static final VectorOperators.Comparison LE
a<=b
.public static final VectorOperators.Comparison GT
a>b
.public static final VectorOperators.Comparison GE
a>=b
.public static final VectorOperators.Comparison UNSIGNED_LT
a<b
. Integral only.public static final VectorOperators.Comparison UNSIGNED_LE
a<=b
. Integral only.public static final VectorOperators.Comparison UNSIGNED_GT
a>b
. Integral only.public static final VectorOperators.Comparison UNSIGNED_GE
a>=b
. Integral only.public static final VectorOperators.Conversion<Byte,Double> B2D
byteVal
to (double)byteVal
.public static final VectorOperators.Conversion<Byte,Float> B2F
byteVal
to (float)byteVal
.public static final VectorOperators.Conversion<Byte,Integer> B2I
byteVal
to (int)byteVal
.public static final VectorOperators.Conversion<Byte,Long> B2L
byteVal
to (long)byteVal
.public static final VectorOperators.Conversion<Byte,Short> B2S
byteVal
to (short)byteVal
.public static final VectorOperators.Conversion<Double,Byte> D2B
doubleVal
to (byte)doubleVal
.public static final VectorOperators.Conversion<Double,Float> D2F
doubleVal
to (float)doubleVal
.public static final VectorOperators.Conversion<Double,Integer> D2I
doubleVal
to (int)doubleVal
.public static final VectorOperators.Conversion<Double,Long> D2L
doubleVal
to (long)doubleVal
.public static final VectorOperators.Conversion<Double,Short> D2S
doubleVal
to (short)doubleVal
.public static final VectorOperators.Conversion<Float,Byte> F2B
floatVal
to (byte)floatVal
.public static final VectorOperators.Conversion<Float,Double> F2D
floatVal
to (double)floatVal
.public static final VectorOperators.Conversion<Float,Integer> F2I
floatVal
to (int)floatVal
.public static final VectorOperators.Conversion<Float,Long> F2L
floatVal
to (long)floatVal
.public static final VectorOperators.Conversion<Float,Short> F2S
floatVal
to (short)floatVal
.public static final VectorOperators.Conversion<Integer,Byte> I2B
intVal
to (byte)intVal
.public static final VectorOperators.Conversion<Integer,Double> I2D
intVal
to (double)intVal
.public static final VectorOperators.Conversion<Integer,Float> I2F
intVal
to (float)intVal
.public static final VectorOperators.Conversion<Integer,Long> I2L
intVal
to (long)intVal
.public static final VectorOperators.Conversion<Integer,Short> I2S
intVal
to (short)intVal
.public static final VectorOperators.Conversion<Long,Byte> L2B
longVal
to (byte)longVal
.public static final VectorOperators.Conversion<Long,Double> L2D
longVal
to (double)longVal
.public static final VectorOperators.Conversion<Long,Float> L2F
longVal
to (float)longVal
.public static final VectorOperators.Conversion<Long,Integer> L2I
longVal
to (int)longVal
.public static final VectorOperators.Conversion<Long,Short> L2S
longVal
to (short)longVal
.public static final VectorOperators.Conversion<Short,Byte> S2B
shortVal
to (byte)shortVal
.public static final VectorOperators.Conversion<Short,Double> S2D
shortVal
to (double)shortVal
.public static final VectorOperators.Conversion<Short,Float> S2F
shortVal
to (float)shortVal
.public static final VectorOperators.Conversion<Short,Integer> S2I
shortVal
to (int)shortVal
.public static final VectorOperators.Conversion<Short,Long> S2L
shortVal
to (long)shortVal
.public static final VectorOperators.Conversion<Double,Long> REINTERPRET_D2L
public static final VectorOperators.Conversion<Float,Integer> REINTERPRET_F2I
public static final VectorOperators.Conversion<Integer,Float> REINTERPRET_I2F
public static final VectorOperators.Conversion<Long,Double> REINTERPRET_L2D
public static final VectorOperators.Conversion<Byte,Integer> ZERO_EXTEND_B2I
byteVal
to int
.public static final VectorOperators.Conversion<Byte,Long> ZERO_EXTEND_B2L
byteVal
to long
.public static final VectorOperators.Conversion<Byte,Short> ZERO_EXTEND_B2S
byteVal
to short
.public static final VectorOperators.Conversion<Integer,Long> ZERO_EXTEND_I2L
intVal
to long
.public static final VectorOperators.Conversion<Short,Integer> ZERO_EXTEND_S2I
shortVal
to int
.public static final VectorOperators.Conversion<Short,Long> ZERO_EXTEND_S2L
shortVal
to long
.
© 1993, 2023, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/21/docs/api/jdk.incubator.vector/jdk/incubator/vector/VectorOperators.html