- java.lang.Object
-
- jdk.incubator.vector.Vector<Double>
-
- jdk.incubator.vector.DoubleVector
-
-
Field Summary
Fields Modifier and Type Field Description static VectorSpecies<Double>
SPECIES_128
Species representingDoubleVector
s ofVectorShape.S_128_BIT
.static VectorSpecies<Double>
SPECIES_256
Species representingDoubleVector
s ofVectorShape.S_256_BIT
.static VectorSpecies<Double>
SPECIES_512
Species representingDoubleVector
s ofVectorShape.S_512_BIT
.static VectorSpecies<Double>
SPECIES_64
Species representingDoubleVector
s ofVectorShape.S_64_BIT
.static VectorSpecies<Double>
SPECIES_MAX
Species representingDoubleVector
s ofVectorShape.S_Max_BIT
.static VectorSpecies<Double>
SPECIES_PREFERRED
Preferred species forDoubleVector
s.
-
Method Summary
Modifier and Type Method Description abstract DoubleVector
abs()
Returns the modulus of this vector.abstract DoubleVector
abs(VectorMask<Double> m)
Returns the modulus of this vector, selecting lane elements controlled by a mask.DoubleVector
acos()
Calculates the arc cosine of this vector.DoubleVector
acos(VectorMask<Double> m)
Calculates the arc cosine of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
add(double s)
Adds this vector to the broadcast of an input scalar.abstract DoubleVector
add(double s, VectorMask<Double> m)
Adds this vector to broadcast of an input scalar, selecting lane elements controlled by a mask.abstract DoubleVector
add(Vector<Double> v)
Adds this vector to an input vector.abstract DoubleVector
add(Vector<Double> v, VectorMask<Double> m)
Adds this vector to an input vector, selecting lane elements controlled by a mask.abstract double
addLanes()
Adds all lane elements of this vector.abstract double
addLanes(VectorMask<Double> m)
Adds all lane elements of this vector, selecting lane elements controlled by a mask.DoubleVector
asin()
Calculates the arc sine of this vector.DoubleVector
asin(VectorMask<Double> m)
Calculates the arc sine of this vector, selecting lane elements controlled by a mask.DoubleVector
atan()
Calculates the arc tangent of this vector.DoubleVector
atan(VectorMask<Double> m)
Calculates the arc tangent of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
atan2(double s)
Calculates the arc tangent of this vector divided by the broadcast of an an input scalar.abstract DoubleVector
atan2(double s, VectorMask<Double> m)
Calculates the arc tangent of this vector divided by the broadcast of an an input scalar, selecting lane elements controlled by a mask.DoubleVector
atan2(Vector<Double> v)
Calculates the arc tangent of this vector divided by an input vector.DoubleVector
atan2(Vector<Double> v, VectorMask<Double> m)
Calculates the arc tangent of this vector divided by an input vector, selecting lane elements controlled by a mask.abstract DoubleVector
blend(double s, VectorMask<Double> m)
Blends the lane elements of this vector with those of the broadcast of an input scalar, selecting lanes controlled by a mask.abstract DoubleVector
blend(Vector<Double> v, VectorMask<Double> m)
Blends the lane elements of this vector with those of an input vector, selecting lanes controlled by a mask.static DoubleVector
broadcast(VectorSpecies<Double> species, double e)
Returns a vector where all lane elements are set to the primitive valuee
.DoubleVector
cbrt()
Calculates the cube root of this vector.DoubleVector
cbrt(VectorMask<Double> m)
Calculates the cube root of this vector, selecting lane elements controlled by a mask.DoubleVector
cos()
Calculates the trigonometric cosine of this vector.DoubleVector
cos(VectorMask<Double> m)
Calculates the trigonometric cosine of this vector, selecting lane elements controlled by a mask.DoubleVector
cosh()
Calculates the hyperbolic cosine of this vector.DoubleVector
cosh(VectorMask<Double> m)
Calculates the hyperbolic cosine of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
div(double s)
Divides this vector by the broadcast of an input scalar.abstract DoubleVector
div(double s, VectorMask<Double> m)
Divides this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask.abstract DoubleVector
div(Vector<Double> v)
Divides this vector by an input vector.abstract DoubleVector
div(Vector<Double> v, VectorMask<Double> m)
Divides this vector by an input vector, selecting lane elements controlled by a mask.abstract VectorMask<Double>
equal(double s)
Tests if this vector is equal to the broadcast of an input scalar.abstract VectorMask<Double>
equal(Vector<Double> v)
Tests if this vector is equal to an input vector.DoubleVector
exp()
Calculates the broadcast of Euler's numbere
raised to the power of this vector.DoubleVector
exp(VectorMask<Double> m)
Calculates the broadcast of Euler's numbere
raised to the power of this vector, selecting lane elements controlled by a mask.DoubleVector
expm1()
Calculates the broadcast of Euler's numbere
raised to the power of this vector minus the broadcast of-1
.DoubleVector
expm1(VectorMask<Double> m)
Calculates the broadcast of Euler's numbere
raised to the power of this vector minus the broadcast of-1
, selecting lane elements controlled by a mask More specifically as if the following (ignoring any differences in numerical accuracy):abstract DoubleVector
fma(double s1, double s2)
Calculates the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar.abstract DoubleVector
fma(double s1, double s2, VectorMask<Double> m)
Calculates the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar, selecting lane elements controlled by a mask More specifically as if the following:abstract DoubleVector
fma(Vector<Double> v1, Vector<Double> v2)
Calculates the product of this vector and a first input vector summed with a second input vector.DoubleVector
fma(Vector<Double> v1, Vector<Double> v2, VectorMask<Double> m)
Calculates the product of this vector and a first input vector summed with a second input vector, selecting lane elements controlled by a mask.static DoubleVector
fromArray(VectorSpecies<Double> species, double[] a, int offset)
Loads a vector from an array starting at offset.static DoubleVector
fromArray(VectorSpecies<Double> species, double[] a, int a_offset, int[] indexMap, int i_offset)
Loads a vector from an array using indexes obtained from an index map.static DoubleVector
fromArray(VectorSpecies<Double> species, double[] a, int offset, VectorMask<Double> m)
Loads a vector from an array starting at offset and using a mask.static DoubleVector
fromArray(VectorSpecies<Double> species, double[] a, int a_offset, VectorMask<Double> m, int[] indexMap, int i_offset)
Loads a vector from an array using indexes obtained from an index map and using a mask.static DoubleVector
fromByteArray(VectorSpecies<Double> species, byte[] a, int offset)
Loads a vector from a byte array starting at an offset.static DoubleVector
fromByteArray(VectorSpecies<Double> species, byte[] a, int offset, VectorMask<Double> m)
Loads a vector from a byte array starting at an offset and using a mask.static DoubleVector
fromByteBuffer(VectorSpecies<Double> species, ByteBuffer bb, int offset)
Loads a vector from abyte buffer
starting at an offset into the byte buffer.static DoubleVector
fromByteBuffer(VectorSpecies<Double> species, ByteBuffer bb, int offset, VectorMask<Double> m)
Loads a vector from abyte buffer
starting at an offset into the byte buffer and using a mask.abstract VectorMask<Double>
greaterThan(double s)
Tests if this vector is greater than the broadcast of an input scalar.abstract VectorMask<Double>
greaterThan(Vector<Double> v)
Tests if this vector is greater than an input vector.abstract VectorMask<Double>
greaterThanEq(double s)
Tests if this vector is greater than or equal to the broadcast of an input scalar.abstract VectorMask<Double>
greaterThanEq(Vector<Double> v)
Tests if this vector is greater than or equal to an input vector.abstract DoubleVector
hypot(double s)
Calculates square root of the sum of the squares of this vector and the broadcast of an input scalar.abstract DoubleVector
hypot(double s, VectorMask<Double> m)
Calculates square root of the sum of the squares of this vector and the broadcast of an input scalar, selecting lane elements controlled by a mask.DoubleVector
hypot(Vector<Double> v)
Calculates square root of the sum of the squares of this vector and an input vector.DoubleVector
hypot(Vector<Double> v, VectorMask<Double> m)
Calculates square root of the sum of the squares of this vector and an input vector, selecting lane elements controlled by a mask.abstract void
intoArray(double[] a, int offset)
Stores this vector into an array starting at offset.abstract void
intoArray(double[] a, int a_offset, int[] indexMap, int i_offset)
Stores this vector into an array using indexes obtained from an index map.abstract void
intoArray(double[] a, int offset, VectorMask<Double> m)
Stores this vector into an array starting at offset and using a mask.abstract void
intoArray(double[] a, int a_offset, VectorMask<Double> m, int[] indexMap, int i_offset)
Stores this vector into an array using indexes obtained from an index map and using a mask.abstract void
intoByteArray(byte[] a, int ix)
Stores this vector into a byte array starting at an offset.abstract void
intoByteArray(byte[] a, int ix, VectorMask<Double> m)
Stores this vector into a byte array starting at an offset and using a mask.abstract void
intoByteBuffer(ByteBuffer bb, int ix)
Stores this vector into abyte buffer
starting at an offset into the byte buffer.abstract void
intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Double> m)
Stores this vector into abyte buffer
starting at an offset into the byte buffer and using a mask.abstract double
lane(int i)
Gets the lane element at lane indexi
abstract VectorMask<Double>
lessThan(double s)
Tests if this vector is less than the broadcast of an input scalar.abstract VectorMask<Double>
lessThan(Vector<Double> v)
Tests if this vector is less than an input vector.abstract VectorMask<Double>
lessThanEq(double s)
Tests if this vector is less or equal to the broadcast of an input scalar.abstract VectorMask<Double>
lessThanEq(Vector<Double> v)
Tests if this vector is less or equal to an input vector.DoubleVector
log()
Calculates the natural logarithm of this vector.DoubleVector
log(VectorMask<Double> m)
Calculates the natural logarithm of this vector, selecting lane elements controlled by a mask.DoubleVector
log10()
Calculates the base 10 logarithm of this vector.DoubleVector
log10(VectorMask<Double> m)
Calculates the base 10 logarithm of this vector, selecting lane elements controlled by a mask.DoubleVector
log1p()
Calculates the natural logarithm of the sum of this vector and the broadcast of1
.DoubleVector
log1p(VectorMask<Double> m)
Calculates the natural logarithm of the sum of this vector and the broadcast of1
, selecting lane elements controlled by a mask.abstract DoubleVector
max(double s)
Returns the maximum of this vector and the broadcast of an input scalar.abstract DoubleVector
max(Vector<Double> v)
Returns the maximum of this vector and an input vector.abstract DoubleVector
max(Vector<Double> v, VectorMask<Double> m)
Returns the maximum of this vector and an input vector, selecting lane elements controlled by a mask.abstract double
maxLanes()
Returns the maximum lane element of this vector.abstract double
maxLanes(VectorMask<Double> m)
Returns the maximum lane element of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
min(double s)
Returns the minimum of this vector and the broadcast of an input scalar.abstract DoubleVector
min(Vector<Double> v)
Returns the minimum of this vector and an input vector.abstract DoubleVector
min(Vector<Double> v, VectorMask<Double> m)
Returns the minimum of this vector and an input vector, selecting lane elements controlled by a mask.abstract double
minLanes()
Returns the minimum lane element of this vector.abstract double
minLanes(VectorMask<Double> m)
Returns the minimum lane element of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
mul(double s)
Multiplies this vector with the broadcast of an input scalar.abstract DoubleVector
mul(double s, VectorMask<Double> m)
Multiplies this vector with the broadcast of an input scalar, selecting lane elements controlled by a mask.abstract DoubleVector
mul(Vector<Double> v)
Multiplies this vector with an input vector.abstract DoubleVector
mul(Vector<Double> v, VectorMask<Double> m)
Multiplies this vector with an input vector, selecting lane elements controlled by a mask.abstract double
mulLanes()
Multiplies all lane elements of this vector.abstract double
mulLanes(VectorMask<Double> m)
Multiplies all lane elements of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
neg()
Negates this vector.abstract DoubleVector
neg(VectorMask<Double> m)
Negates this vector, selecting lane elements controlled by a mask.abstract VectorMask<Double>
notEqual(double s)
Tests if this vector is not equal to the broadcast of an input scalar.abstract VectorMask<Double>
notEqual(Vector<Double> v)
Tests if this vector is not equal to an input vector.abstract DoubleVector
pow(double s)
Calculates this vector raised to the power of the broadcast of an input scalar.abstract DoubleVector
pow(double s, VectorMask<Double> m)
Calculates this vector raised to the power of the broadcast of an input scalar, selecting lane elements controlled by a mask.DoubleVector
pow(Vector<Double> v)
Calculates this vector raised to the power of an input vector.DoubleVector
pow(Vector<Double> v, VectorMask<Double> m)
Calculates this vector raised to the power of an input vector, selecting lane elements controlled by a mask.static DoubleVector
random(VectorSpecies<Double> species)
Returns a vector where each lane element is set to a randomly generated primitive value.abstract DoubleVector
rearrange(Vector<Double> v, VectorShuffle<Double> s, VectorMask<Double> m)
Rearranges the lane elements of this vector and those of an input vector, selecting lane indexes controlled by shuffles and a mask.abstract DoubleVector
rearrange(VectorShuffle<Double> m)
Rearranges the lane elements of this vector selecting lane indexes controlled by a shuffle.abstract DoubleVector
reshape(VectorSpecies<Double> s)
Transforms this vector to a vector of same element type but different shape identified by species.abstract DoubleVector
rotateLanesLeft(int i)
Rotates left the lane elements of this vector by the given number of lanes,i
, modulus the vector length.abstract DoubleVector
rotateLanesRight(int i)
Rotates right the lane elements of this vector by the given number of lanes,i
, modulus the vector length.static DoubleVector
scalars(VectorSpecies<Double> species, double... es)
Returns a vector where each lane element is set to given primitive values.abstract DoubleVector
shiftLanesLeft(int i)
Shift left the lane elements of this vector by the given number of lanes,i
, modulus the vector length.abstract DoubleVector
shiftLanesRight(int i)
Shift right the lane elements of this vector by the given number of lanes,i
, modulus the vector length.DoubleVector
sin()
Calculates the trigonometric sine of this vector.DoubleVector
sin(VectorMask<Double> m)
Calculates the trigonometric sine of this vector, selecting lane elements controlled by a mask.static DoubleVector
single(VectorSpecies<Double> species, double e)
Returns a vector where the first lane element is set to the primtive valuee
, all other lane elements are set to the default value.DoubleVector
sinh()
Calculates the hyperbolic sine of this vector.DoubleVector
sinh(VectorMask<Double> m)
Calculates the hyperbolic sine of this vector, selecting lane elements controlled by a mask.abstract VectorSpecies<Double>
species()
Returns the species of this vector.abstract DoubleVector
sqrt()
Calculates the square root of this vector.DoubleVector
sqrt(VectorMask<Double> m)
Calculates the square root of this vector, selecting lane elements controlled by a mask.abstract DoubleVector
sub(double s)
Subtracts the broadcast of an input scalar from this vector.abstract DoubleVector
sub(double s, VectorMask<Double> m)
Subtracts the broadcast of an input scalar from this vector, selecting lane elements controlled by a mask.abstract DoubleVector
sub(Vector<Double> v)
Subtracts an input vector from this vector.abstract DoubleVector
sub(Vector<Double> v, VectorMask<Double> m)
Subtracts an input vector from this vector, selecting lane elements controlled by a mask.DoubleVector
tan()
Calculates the trigonometric tangent of this vector.DoubleVector
tan(VectorMask<Double> m)
Calculates the trigonometric tangent of this vector, selecting lane elements controlled by a mask.DoubleVector
tanh()
Calculates the hyperbolic tangent of this vector.DoubleVector
tanh(VectorMask<Double> m)
Calculates the hyperbolic tangent of this vector, selecting lane elements controlled by a mask.double[]
toArray()
Returns an array containing the lane elements of this vector.abstract DoubleVector
with(int i, double e)
Replaces the lane element of this vector at lane indexi
with valuee
.static DoubleVector
zero(VectorSpecies<Double> species)
Returns a vector where all lane elements are set to the default primitive value.-
Methods inherited from class jdk.incubator.vector.Vector
bitSize, bitSizeForVectorLength, cast, elementSize, elementType, length, maskAllFalse, maskAllTrue, maskFromArray, maskFromValues, reinterpret, shape, shuffle, shuffleFromArray, shuffleFromValues, shuffleIota, shuffleIota, shuffleOffset, toShuffle
-
-
-
-
Field Detail
-
SPECIES_64
public static final VectorSpecies<Double> SPECIES_64
Species representingDoubleVector
s ofVectorShape.S_64_BIT
.
-
SPECIES_128
public static final VectorSpecies<Double> SPECIES_128
Species representingDoubleVector
s ofVectorShape.S_128_BIT
.
-
SPECIES_256
public static final VectorSpecies<Double> SPECIES_256
Species representingDoubleVector
s ofVectorShape.S_256_BIT
.
-
SPECIES_512
public static final VectorSpecies<Double> SPECIES_512
Species representingDoubleVector
s ofVectorShape.S_512_BIT
.
-
SPECIES_MAX
public static final VectorSpecies<Double> SPECIES_MAX
Species representingDoubleVector
s ofVectorShape.S_Max_BIT
.
-
SPECIES_PREFERRED
public static final VectorSpecies<Double> SPECIES_PREFERRED
Preferred species forDoubleVector
s. A preferred species is a species of maximal bit size for the platform.
-
-
Method Detail
-
zero
public static DoubleVector zero(VectorSpecies<Double> species)
Returns a vector where all lane elements are set to the default primitive value.- Parameters:
species
- species of desired vector- Returns:
- a zero vector of given species
-
fromByteArray
public static DoubleVector fromByteArray(VectorSpecies<Double> species, byte[] a, int offset)
Loads a vector from a byte array starting at an offset.Bytes are composed into primitive lane elements according to the native byte order of the underlying platform
This method behaves as if it returns the result of calling the byte buffer, offset, and mask accepting
method
as follows:return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
- Parameters:
species
- species of desired vectora
- the byte arrayoffset
- the offset into the array- Returns:
- a vector loaded from a byte array
- Throws:
IndexOutOfBoundsException
- ifi < 0
oroffset > a.length - (species.length() * species.elementSize() / Byte.SIZE)
-
fromByteArray
public static DoubleVector fromByteArray(VectorSpecies<Double> species, byte[] a, int offset, VectorMask<Double> m)
Loads a vector from a byte array starting at an offset and using a mask.Bytes are composed into primitive lane elements according to the native byte order of the underlying platform.
This method behaves as if it returns the result of calling the byte buffer, offset, and mask accepting
method
as follows:return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
- Parameters:
species
- species of desired vectora
- the byte arrayoffset
- the offset into the arraym
- the mask- Returns:
- a vector loaded from a byte array
- Throws:
IndexOutOfBoundsException
- ifoffset < 0
or for any vector lane indexN
where the mask at laneN
is setoffset >= a.length - (N * species.elementSize() / Byte.SIZE)
-
fromArray
public static DoubleVector fromArray(VectorSpecies<Double> species, double[] a, int offset)
Loads a vector from an array starting at offset.For each vector lane, where
N
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 < 0
, oroffset > a.length - species.length()
-
fromArray
public static DoubleVector fromArray(VectorSpecies<Double> species, double[] a, int offset, VectorMask<Double> m)
Loads a vector from an array starting at offset and using a mask.For each vector lane, where
N
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- Returns:
- the vector loaded from an array
- Throws:
IndexOutOfBoundsException
- ifoffset < 0
, or for any vector lane indexN
where the mask at laneN
is setoffset > a.length - N
-
fromArray
public static DoubleVector fromArray(VectorSpecies<Double> species, double[] a, int a_offset, int[] indexMap, int i_offset)
Loads a vector from an array using indexes obtained from an index map.For each vector lane, where
N
is the vector lane index, the array element at indexa_offset + indexMap[i_offset + N]
is placed into the resulting vector at lane indexN
.- Parameters:
species
- species of desired vectora
- the arraya_offset
- 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 mapi_offset
- the offset into the index map- Returns:
- the vector loaded from an array
- Throws:
IndexOutOfBoundsException
- ifi_offset < 0
, ori_offset > indexMap.length - species.length()
, or for any vector lane indexN
the result ofa_offset + indexMap[i_offset + N]
is< 0
or>= a.length
-
fromArray
public static DoubleVector fromArray(VectorSpecies<Double> species, double[] a, int a_offset, VectorMask<Double> m, int[] indexMap, int i_offset)
Loads a vector from an array using indexes obtained from an index map and using a mask.For each vector lane, where
N
is the vector lane index, if the mask lane at indexN
is set then the array element at indexa_offset + indexMap[i_offset + N]
is placed into the resulting vector at lane indexN
.- Parameters:
species
- species of desired vectora
- the arraya_offset
- the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsm
- the maskindexMap
- the index mapi_offset
- the offset into the index map- Returns:
- the vector loaded from an array
- Throws:
IndexOutOfBoundsException
- ifi_offset < 0
, ori_offset > indexMap.length - species.length()
, or for any vector lane indexN
where the mask at laneN
is set the result ofa_offset + indexMap[i_offset + N]
is< 0
or>= a.length
-
fromByteBuffer
public static DoubleVector fromByteBuffer(VectorSpecies<Double> species, ByteBuffer bb, int offset)
Loads a vector from abyte buffer
starting at an offset into the byte buffer.Bytes are composed into primitive lane elements according to the native byte order of the underlying platform.
This method behaves as if it returns the result of calling the byte buffer, offset, and mask accepting
fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)
method} as follows:return fromByteBuffer(b, offset, VectorMask.allTrue())
- Parameters:
species
- species of desired vectorbb
- the byte bufferoffset
- the offset into the byte buffer- Returns:
- a vector loaded from a byte buffer
- Throws:
IndexOutOfBoundsException
- if the offset is< 0
, or> b.limit()
, or if there are fewer thanspecies.length() * species.elementSize() / Byte.SIZE
bytes remaining in the byte buffer from the given offset
-
fromByteBuffer
public static DoubleVector fromByteBuffer(VectorSpecies<Double> species, ByteBuffer bb, int offset, VectorMask<Double> m)
Loads a vector from abyte buffer
starting at an offset into the byte buffer and using a mask.This method behaves as if the byte buffer is viewed as a primitive
buffer
for the primitive element type, according to the native byte order of the underlying platform, and the returned vector is loaded with a mask from a primitive array obtained from the primitive buffer. The following pseudocode expresses the behaviour, whereEBuffer
is the primitive buffer type,e
is the primitive element type, andESpecies
is the primitive species fore
:EBuffer eb = b.duplicate(). order(ByteOrder.nativeOrder()).position(offset). asEBuffer(); e[] es = new e[species.length()]; for (int n = 0; n < t.length; n++) { if (m.isSet(n)) es[n] = eb.get(n); } EVector r = EVector.fromArray(es, 0, m);
- Parameters:
species
- species of desired vectorbb
- the byte bufferoffset
- the offset into the byte bufferm
- the mask- Returns:
- a vector loaded from a byte buffer
- Throws:
IndexOutOfBoundsException
- if the offset is< 0
, or> b.limit()
, for any vector lane indexN
where the mask at laneN
is setoffset >= b.limit() - (N * species.elementSize() / Byte.SIZE)
-
broadcast
public static DoubleVector broadcast(VectorSpecies<Double> species, double e)
Returns a vector where all lane elements are set to the primitive valuee
.- Parameters:
species
- species of the desired vectore
- the value to be broadcasted- Returns:
- a vector of vector where all lane elements are set to
the primitive value
e
-
scalars
public static DoubleVector scalars(VectorSpecies<Double> species, double... es)
Returns a vector where each lane element is set to given primitive values.For each vector lane, where
N
is the vector lane index, the the primitive value at indexN
is placed into the resulting vector at lane indexN
.- Parameters:
species
- species of the desired vectores
- the given primitive values- Returns:
- a vector where each lane element is set to given primitive values
- Throws:
IndexOutOfBoundsException
- ifes.length < species.length()
-
single
public static final DoubleVector single(VectorSpecies<Double> species, double e)
Returns a vector where the first lane element is set to the primtive valuee
, all other lane elements are set to the default value.- Parameters:
species
- species of the desired vectore
- the value- Returns:
- a vector where the first lane element is set to the primitive
value
e
-
random
public static DoubleVector random(VectorSpecies<Double> species)
Returns a vector where each lane element is set to a randomly generated primitive value. The semantics are equivalent to callingThreadLocalRandom.nextDouble()
- Parameters:
species
- species of the desired vector- Returns:
- a vector where each lane elements is set to a randomly generated primitive value
-
add
public abstract DoubleVector add(Vector<Double> v)
Adds this vector to an input vector.This is a lane-wise binary operation which applies the primitive addition operation (
+
) to each lane.
-
add
public abstract DoubleVector add(double s)
Adds this vector to the broadcast of an input scalar.This is a lane-wise binary operation which applies the primitive addition operation (
+
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the result of adding this vector to the broadcast of an input scalar
-
add
public abstract DoubleVector add(Vector<Double> v, VectorMask<Double> m)
Adds this vector to an input vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive addition operation (
+
) to each lane.
-
add
public abstract DoubleVector add(double s, VectorMask<Double> m)
Adds this vector to broadcast of an input scalar, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive addition operation (
+
) to each lane.- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the result of adding this vector to the broadcast of an input scalar
-
sub
public abstract DoubleVector sub(Vector<Double> v)
Subtracts an input vector from this vector.This is a lane-wise binary operation which applies the primitive subtraction operation (
-
) to each lane.
-
sub
public abstract DoubleVector sub(double s)
Subtracts the broadcast of an input scalar from this vector.This is a lane-wise binary operation which applies the primitive subtraction operation (
-
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the result of subtracting the broadcast of an input scalar from this vector
-
sub
public abstract DoubleVector sub(Vector<Double> v, VectorMask<Double> m)
Subtracts an input vector from this vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive subtraction operation (
-
) to each lane.
-
sub
public abstract DoubleVector sub(double s, VectorMask<Double> m)
Subtracts the broadcast of an input scalar from this vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive subtraction operation (
-
) to each lane.- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the result of subtracting the broadcast of an input scalar from this vector
-
mul
public abstract DoubleVector mul(Vector<Double> v)
Multiplies this vector with an input vector.This is a lane-wise binary operation which applies the primitive multiplication operation (
*
) to each lane.
-
mul
public abstract DoubleVector mul(double s)
Multiplies this vector with the broadcast of an input scalar.This is a lane-wise binary operation which applies the primitive multiplication operation (
*
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the result of multiplying this vector with the broadcast of an input scalar
-
mul
public abstract DoubleVector mul(Vector<Double> v, VectorMask<Double> m)
Multiplies this vector with an input vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive multiplication operation (
*
) to each lane.
-
mul
public abstract DoubleVector mul(double s, VectorMask<Double> m)
Multiplies this vector with the broadcast of an input scalar, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive multiplication operation (
*
) to each lane.- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the result of multiplying this vector with the broadcast of an input scalar
-
neg
public abstract DoubleVector neg()
Negates this vector.This is a lane-wise unary operation which applies the primitive negation operation (
-
) to each lane.
-
neg
public abstract DoubleVector neg(VectorMask<Double> m)
Negates this vector, selecting lane elements controlled by a mask.This is a lane-wise unary operation which applies the primitive negation operation (
-
) to each lane.
-
abs
public abstract DoubleVector abs()
Returns the modulus of this vector.This is a lane-wise unary operation which applies the operation
(a) -> (a < 0) ? -a : a
to each lane.
-
abs
public abstract DoubleVector abs(VectorMask<Double> m)
Returns the modulus of this vector, selecting lane elements controlled by a mask.This is a lane-wise unary operation which applies the operation
(a) -> (a < 0) ? -a : a
to each lane.
-
min
public abstract DoubleVector min(Vector<Double> v)
Returns the minimum of this vector and an input vector.This is a lane-wise binary operation which applies the operation
(a, b) -> a < b ? a : b
to each lane.
-
min
public abstract DoubleVector min(Vector<Double> v, VectorMask<Double> m)
Returns the minimum of this vector and an input vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the operation
(a, b) -> a < b ? a : b
to each lane.
-
min
public abstract DoubleVector min(double s)
Returns the minimum of this vector and the broadcast of an input scalar.This is a lane-wise binary operation which applies the operation
(a, b) -> Math.min(a, b)
to each lane.- Parameters:
s
- the input scalar- Returns:
- the minimum of this vector and the broadcast of an input scalar
-
max
public abstract DoubleVector max(Vector<Double> v)
Returns the maximum of this vector and an input vector.This is a lane-wise binary operation which applies the operation
(a, b) -> a > b ? a : b
to each lane.
-
max
public abstract DoubleVector max(Vector<Double> v, VectorMask<Double> m)
Returns the maximum of this vector and an input vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the operation
(a, b) -> a > b ? a : b
to each lane.
-
max
public abstract DoubleVector max(double s)
Returns the maximum of this vector and the broadcast of an input scalar.This is a lane-wise binary operation which applies the operation
(a, b) -> Math.max(a, b)
to each lane.- Parameters:
s
- the input scalar- Returns:
- the maximum of this vector and the broadcast of an input scalar
-
equal
public abstract VectorMask<Double> equal(Vector<Double> v)
Tests if this vector is equal to an input vector.This is a lane-wise binary test operation which applies the primitive equals operation (
==
) to each lane.
-
equal
public abstract VectorMask<Double> equal(double s)
Tests if this vector is equal to the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive equals operation (
==
) each lane.- Parameters:
s
- the input scalar- Returns:
- the result mask of testing if this vector is equal to the broadcast of an input scalar
-
notEqual
public abstract VectorMask<Double> notEqual(Vector<Double> v)
Tests if this vector is not equal to an input vector.This is a lane-wise binary test operation which applies the primitive not equals operation (
!=
) to each lane.
-
notEqual
public abstract VectorMask<Double> notEqual(double s)
Tests if this vector is not equal to the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive not equals operation (
!=
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the result mask of testing if this vector is not equal to the broadcast of an input scalar
-
lessThan
public abstract VectorMask<Double> lessThan(Vector<Double> v)
Tests if this vector is less than an input vector.This is a lane-wise binary test operation which applies the primitive less than operation (
<
) to each lane.
-
lessThan
public abstract VectorMask<Double> lessThan(double s)
Tests if this vector is less than the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive less than operation (
<
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the mask result of testing if this vector is less than the broadcast of an input scalar
-
lessThanEq
public abstract VectorMask<Double> lessThanEq(Vector<Double> v)
Tests if this vector is less or equal to an input vector.This is a lane-wise binary test operation which applies the primitive less than or equal to operation (
<=
) to each lane.- Specified by:
lessThanEq
in classVector<Double>
- Parameters:
v
- the input vector- Returns:
- the mask result of testing if this vector is less than or equal to the input vector
-
lessThanEq
public abstract VectorMask<Double> lessThanEq(double s)
Tests if this vector is less or equal to the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive less than or equal to operation (
<=
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the mask result of testing if this vector is less than or equal to the broadcast of an input scalar
-
greaterThan
public abstract VectorMask<Double> greaterThan(Vector<Double> v)
Tests if this vector is greater than an input vector.This is a lane-wise binary test operation which applies the primitive greater than operation (
>
) to each lane.- Specified by:
greaterThan
in classVector<Double>
- Parameters:
v
- the input vector- Returns:
- the mask result of testing if this vector is greater than the input vector
-
greaterThan
public abstract VectorMask<Double> greaterThan(double s)
Tests if this vector is greater than the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive greater than operation (
>
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the mask result of testing if this vector is greater than the broadcast of an input scalar
-
greaterThanEq
public abstract VectorMask<Double> greaterThanEq(Vector<Double> v)
Tests if this vector is greater than or equal to an input vector.This is a lane-wise binary test operation which applies the primitive greater than or equal to operation (
>=
) to each lane.- Specified by:
greaterThanEq
in classVector<Double>
- Parameters:
v
- the input vector- Returns:
- the mask result of testing if this vector is greater than or equal to the given vector
-
greaterThanEq
public abstract VectorMask<Double> greaterThanEq(double s)
Tests if this vector is greater than or equal to the broadcast of an input scalar.This is a lane-wise binary test operation which applies the primitive greater than or equal to operation (
>=
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the mask result of testing if this vector is greater than or equal to the broadcast of an input scalar
-
blend
public abstract DoubleVector blend(Vector<Double> v, VectorMask<Double> m)
Blends the lane elements of this vector with those of an input vector, selecting lanes controlled by a mask.For each lane of the mask, at lane index
N
, if the mask lane is set then the lane element atN
from the input vector is selected and placed into the resulting vector atN
, otherwise the lane element atN
from this vector is selected and placed into the resulting vector atN
.
-
blend
public abstract DoubleVector blend(double s, VectorMask<Double> m)
Blends the lane elements of this vector with those of the broadcast of an input scalar, selecting lanes controlled by a mask.For each lane of the mask, at lane index
N
, if the mask lane is set then the lane element atN
from the input vector is selected and placed into the resulting vector atN
, otherwise the the lane element atN
from this input vector is selected and placed into the resulting vector atN
.- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the result of blending the lane elements of this vector with those of the broadcast of an input scalar
-
rearrange
public abstract DoubleVector rearrange(Vector<Double> v, VectorShuffle<Double> s, VectorMask<Double> m)
Rearranges the lane elements of this vector and those of an input vector, selecting lane indexes controlled by shuffles and a mask.This is a cross-lane operation that rearranges the lane elements of this vector and the input vector. This method behaves as if it rearranges each vector with the corresponding shuffle and then blends the two results with the mask:
return this.rearrange(s1).blend(v.rearrange(s2), m);
- Specified by:
rearrange
in classVector<Double>
- Parameters:
v
- the input vectors
- the shuffle controlling lane index selection of the input vector if corresponding mask lanes are set, otherwise controlling lane index selection of this vectorm
- the mask controlling shuffled lane selection- Returns:
- the rearrangement of lane elements of this vector and those of an input vector
-
rearrange
public abstract DoubleVector rearrange(VectorShuffle<Double> m)
Rearranges the lane elements of this vector selecting lane indexes controlled by a shuffle.This is a cross-lane operation that rearranges the lane elements of this vector. For each lane of the shuffle, at lane index
N
with lane elementI
, the lane element atI
from this vector is selected and placed into the resulting vector atN
.
-
reshape
public abstract DoubleVector reshape(VectorSpecies<Double> s)
Transforms this vector to a vector of same element type but different shape identified by species.The lane elements of this vector are copied without modification to the resulting vector, but those lane elements, before copying, may be truncated if this vector's length is greater than the desired vector's length, or appended to with default element values if this vector's length is less than desired vector's length.
The method behaves as if this vector is stored into a byte array and then the returned vector is loaded from the byte array. The following pseudocode expresses the behavior:
int alen = Math.max(this.bitSize(), s.bitSize()) / Byte.SIZE; byte[] a = new byte[alen]; this.intoByteArray(a, 0); return $type$Vector.fromByteArray(s, a, 0);
- Specified by:
reshape
in classVector<Double>
- Parameters:
s
- species of the desired vector- Returns:
- a vector transformed, by shape, from this vector
- See Also:
Vector.reinterpret(VectorSpecies)
,Vector.cast(VectorSpecies)
-
rotateLanesLeft
public abstract DoubleVector rotateLanesLeft(int i)
Rotates left the lane elements of this vector by the given number of lanes,i
, modulus the vector length.This is a cross-lane operation that permutes the lane elements of this vector. For each lane of the input vector, at lane index
N
, the lane element is placed into the result vector at lane index(N + i) % length()
.- Specified by:
rotateLanesLeft
in classVector<Double>
- Parameters:
i
- the number of lanes to rotate left- Returns:
- the result of rotating left lane elements of this vector by the given number of lanes
-
rotateLanesRight
public abstract DoubleVector rotateLanesRight(int i)
Rotates right the lane elements of this vector by the given number of lanes,i
, modulus the vector length.This is a cross-lane operation that permutes the lane elements of this vector. For each lane of the input vector, at lane index
N
, the lane element is placed into the result vector at lane index(N + length() - (i % length())) % length()
- Specified by:
rotateLanesRight
in classVector<Double>
- Parameters:
i
- the number of lanes to rotate right- Returns:
- the result of rotating right lane elements of this vector by the given number of lanes
-
shiftLanesLeft
public abstract DoubleVector shiftLanesLeft(int i)
Shift left the lane elements of this vector by the given number of lanes,i
, modulus the vector length.This is a cross-lane operation that permutes the lane elements of this vector and behaves as if rotating left the lane elements by
i
, and then the zero value is placed into the result vector at lane indexes less thani % length()
.- Specified by:
shiftLanesLeft
in classVector<Double>
- Parameters:
i
- the number of lanes to shift left- Returns:
- the result of shifting left lane elements of this vector by the given number of lanes
-
shiftLanesRight
public abstract DoubleVector shiftLanesRight(int i)
Shift right the lane elements of this vector by the given number of lanes,i
, modulus the vector length.This is a cross-lane operation that permutes the lane elements of this vector and behaves as if rotating right the lane elements by
i
, and then the zero value is placed into the result vector at lane indexes greater or equal tolength() - (i % length())
.- Specified by:
shiftLanesRight
in classVector<Double>
- Parameters:
i
- the number of lanes to shift right- Returns:
- the result of shifting right lane elements of this vector by the given number of lanes
-
div
public abstract DoubleVector div(Vector<Double> v)
Divides this vector by an input vector.This is a lane-wise binary operation which applies the primitive division operation (
/
) to each lane.- Parameters:
v
- the input vector- Returns:
- the result of dividing this vector by the input vector
-
div
public abstract DoubleVector div(double s)
Divides this vector by the broadcast of an input scalar.This is a lane-wise binary operation which applies the primitive division operation (
/
) to each lane.- Parameters:
s
- the input scalar- Returns:
- the result of dividing this vector by the broadcast of an input scalar
-
div
public abstract DoubleVector div(Vector<Double> v, VectorMask<Double> m)
Divides this vector by an input vector, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive division operation (
/
) to each lane.- Parameters:
v
- the input vectorm
- the mask controlling lane selection- Returns:
- the result of dividing this vector by the input vector
-
div
public abstract DoubleVector div(double s, VectorMask<Double> m)
Divides this vector by the broadcast of an input scalar, selecting lane elements controlled by a mask.This is a lane-wise binary operation which applies the primitive division operation (
/
) to each lane.- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the result of dividing this vector by the broadcast of an input scalar
-
sqrt
public abstract DoubleVector sqrt()
Calculates the square root of this vector.This is a lane-wise unary operation which applies the
Math.sqrt(double)
operation to each lane.- Returns:
- the square root of this vector
-
sqrt
public DoubleVector sqrt(VectorMask<Double> m)
Calculates the square root of this vector, selecting lane elements controlled by a mask.This is a lane-wise unary operation which applies the
Math.sqrt(double)
operation to each lane.- Parameters:
m
- the mask controlling lane selection- Returns:
- the square root of this vector
-
tan
public DoubleVector tan()
Calculates the trigonometric tangent of this vector.This is a lane-wise unary operation with same semantic definition as
Math.tan(double)
operation applied to each lane. The implementation is not required to return same results asMath.tan(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.tan(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the tangent of this vector
-
tan
public DoubleVector tan(VectorMask<Double> m)
Calculates the trigonometric tangent of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
tan()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the tangent of this vector
-
tanh
public DoubleVector tanh()
Calculates the hyperbolic tangent of this vector.This is a lane-wise unary operation with same semantic definition as
Math.tanh(double)
operation applied to each lane. The implementation is not required to return same results asMath.tanh(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.tanh(double)
specifications. The computed result will be within 2.5 ulps of the exact result.- Returns:
- the hyperbolic tangent of this vector
-
tanh
public DoubleVector tanh(VectorMask<Double> m)
Calculates the hyperbolic tangent of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
tanh()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the hyperbolic tangent of this vector
-
sin
public DoubleVector sin()
Calculates the trigonometric sine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.sin(double)
operation applied to each lane. The implementation is not required to return same results asMath.sin(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.sin(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the sine of this vector
-
sin
public DoubleVector sin(VectorMask<Double> m)
Calculates the trigonometric sine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
sin()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the sine of this vector
-
sinh
public DoubleVector sinh()
Calculates the hyperbolic sine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.sinh(double)
operation applied to each lane. The implementation is not required to return same results asMath.sinh(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.sinh(double)
specifications. The computed result will be within 2.5 ulps of the exact result.- Returns:
- the hyperbolic sine of this vector
-
sinh
public DoubleVector sinh(VectorMask<Double> m)
Calculates the hyperbolic sine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
sinh()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the hyperbolic sine of this vector
-
cos
public DoubleVector cos()
Calculates the trigonometric cosine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.cos(double)
operation applied to each lane. The implementation is not required to return same results asMath.cos(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.cos(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the cosine of this vector
-
cos
public DoubleVector cos(VectorMask<Double> m)
Calculates the trigonometric cosine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
cos()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the cosine of this vector
-
cosh
public DoubleVector cosh()
Calculates the hyperbolic cosine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.cosh(double)
operation applied to each lane. The implementation is not required to return same results asMath.cosh(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.cosh(double)
specifications. The computed result will be within 2.5 ulps of the exact result.- Returns:
- the hyperbolic cosine of this vector
-
cosh
public DoubleVector cosh(VectorMask<Double> m)
Calculates the hyperbolic cosine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
cosh()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the hyperbolic cosine of this vector
-
asin
public DoubleVector asin()
Calculates the arc sine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.asin(double)
operation applied to each lane. The implementation is not required to return same results asMath.asin(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.asin(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the arc sine of this vector
-
asin
public DoubleVector asin(VectorMask<Double> m)
Calculates the arc sine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
asin()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the arc sine of this vector
-
acos
public DoubleVector acos()
Calculates the arc cosine of this vector.This is a lane-wise unary operation with same semantic definition as
Math.acos(double)
operation applied to each lane. The implementation is not required to return same results asMath.acos(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.acos(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the arc cosine of this vector
-
acos
public DoubleVector acos(VectorMask<Double> m)
Calculates the arc cosine of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
acos()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the arc cosine of this vector
-
atan
public DoubleVector atan()
Calculates the arc tangent of this vector.This is a lane-wise unary operation with same semantic definition as
Math.atan(double)
operation applied to each lane. The implementation is not required to return same results asMath.atan(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.atan(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the arc tangent of this vector
-
atan
public DoubleVector atan(VectorMask<Double> m)
Calculates the arc tangent of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
atan()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the arc tangent of this vector
-
atan2
public DoubleVector atan2(Vector<Double> v)
Calculates the arc tangent of this vector divided by an input vector.This is a lane-wise binary operation with same semantic definition as
Math.atan2(double, double)
operation applied to each lane. The implementation is not required to return same results asMath.atan2(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.atan2(double, double)
specifications. The computed result will be within 2 ulps of the exact result.- Parameters:
v
- the input vector- Returns:
- the arc tangent of this vector divided by the input vector
-
atan2
public abstract DoubleVector atan2(double s)
Calculates the arc tangent of this vector divided by the broadcast of an an input scalar.This is a lane-wise binary operation with same semantic definition as
Math.atan2(double, double)
operation applied to each lane. The implementation is not required to return same results asMath.atan2(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.atan2(double, double)
specifications. The computed result will be within 1 ulp of the exact result.- Parameters:
s
- the input scalar- Returns:
- the arc tangent of this vector over the input vector
-
atan2
public DoubleVector atan2(Vector<Double> v, VectorMask<Double> m)
Calculates the arc tangent of this vector divided by an input vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
atan2(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
v
- the input vectorm
- the mask controlling lane selection- Returns:
- the arc tangent of this vector divided by the input vector
-
atan2
public abstract DoubleVector atan2(double s, VectorMask<Double> m)
Calculates the arc tangent of this vector divided by the broadcast of an an input scalar, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
atan2(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- the arc tangent of this vector over the input vector
-
cbrt
public DoubleVector cbrt()
Calculates the cube root of this vector.This is a lane-wise unary operation with same semantic definition as
Math.cbrt(double)
operation applied to each lane. The implementation is not required to return same results asMath.cbrt(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.cbrt(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the cube root of this vector
-
cbrt
public DoubleVector cbrt(VectorMask<Double> m)
Calculates the cube root of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
cbrt()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the cube root of this vector
-
log
public DoubleVector log()
Calculates the natural logarithm of this vector.This is a lane-wise unary operation with same semantic definition as
Math.log(double)
operation applied to each lane. The implementation is not required to return same results asMath.log(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.log(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the natural logarithm of this vector
-
log
public DoubleVector log(VectorMask<Double> m)
Calculates the natural logarithm of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
log()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the natural logarithm of this vector
-
log10
public DoubleVector log10()
Calculates the base 10 logarithm of this vector.This is a lane-wise unary operation with same semantic definition as
Math.log10(double)
operation applied to each lane. The implementation is not required to return same results asMath.log10(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.log10(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the base 10 logarithm of this vector
-
log10
public DoubleVector log10(VectorMask<Double> m)
Calculates the base 10 logarithm of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
log10()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the base 10 logarithm of this vector
-
log1p
public DoubleVector log1p()
Calculates the natural logarithm of the sum of this vector and the broadcast of1
.This is a lane-wise unary operation with same semantic definition as
Math.log1p(double)
operation applied to each lane. The implementation is not required to return same results asMath.log1p(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.log1p(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the natural logarithm of the sum of this vector and the broadcast
of
1
-
log1p
public DoubleVector log1p(VectorMask<Double> m)
Calculates the natural logarithm of the sum of this vector and the broadcast of1
, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
log1p()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the natural logarithm of the sum of this vector and the broadcast
of
1
-
pow
public DoubleVector pow(Vector<Double> v)
Calculates this vector raised to the power of an input vector.This is a lane-wise binary operation with same semantic definition as
Math.pow(double, double)
operation applied to each lane. The implementation is not required to return same results asMath.pow(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.pow(double, double)
specifications. The computed result will be within 1 ulp of the exact result.- Parameters:
v
- the input vector- Returns:
- this vector raised to the power of an input vector
-
pow
public abstract DoubleVector pow(double s)
Calculates this vector raised to the power of the broadcast of an input scalar.This is a lane-wise binary operation with same semantic definition as
Math.pow(double, double)
operation applied to each lane. The implementation is not required to return same results asMath.pow(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.pow(double, double)
specifications. The computed result will be within 1 ulp of the exact result.- Parameters:
s
- the input scalar- Returns:
- this vector raised to the power of the broadcast of an input scalar.
-
pow
public DoubleVector pow(Vector<Double> v, VectorMask<Double> m)
Calculates this vector raised to the power of an input vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
pow(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
v
- the input vectorm
- the mask controlling lane selection- Returns:
- this vector raised to the power of an input vector
-
pow
public abstract DoubleVector pow(double s, VectorMask<Double> m)
Calculates this vector raised to the power of the broadcast of an input scalar, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
pow(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- this vector raised to the power of the broadcast of an input scalar.
-
exp
public DoubleVector exp()
Calculates the broadcast of Euler's numbere
raised to the power of this vector.This is a lane-wise unary operation with same semantic definition as
Math.exp(double)
operation applied to each lane. The implementation is not required to return same results asMath.exp(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.exp(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the broadcast of Euler's number
e
raised to the power of this vector
-
exp
public DoubleVector exp(VectorMask<Double> m)
Calculates the broadcast of Euler's numbere
raised to the power of this vector, selecting lane elements controlled by a mask.Semantics for rounding, monotonicity, and special cases are described in
exp()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the broadcast of Euler's number
e
raised to the power of this vector
-
expm1
public DoubleVector expm1()
Calculates the broadcast of Euler's numbere
raised to the power of this vector minus the broadcast of-1
. More specifically as if the following (ignoring any differences in numerical accuracy):this.exp().sub(EVector.broadcast(this.species(), 1))
This is a lane-wise unary operation with same semantic definition as
Math.expm1(double)
operation applied to each lane. The implementation is not required to return same results asMath.expm1(double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.expm1(double)
specifications. The computed result will be within 1 ulp of the exact result.- Returns:
- the broadcast of Euler's number
e
raised to the power of this vector minus the broadcast of-1
-
expm1
public DoubleVector expm1(VectorMask<Double> m)
Calculates the broadcast of Euler's numbere
raised to the power of this vector minus the broadcast of-1
, selecting lane elements controlled by a mask More specifically as if the following (ignoring any differences in numerical accuracy):this.exp(m).sub(EVector.broadcast(this.species(), 1), m)
Semantics for rounding, monotonicity, and special cases are described in
expm1()
- Parameters:
m
- the mask controlling lane selection- Returns:
- the broadcast of Euler's number
e
raised to the power of this vector minus the broadcast of-1
-
fma
public abstract DoubleVector fma(Vector<Double> v1, Vector<Double> v2)
Calculates the product of this vector and a first input vector summed with a second input vector. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(v1).add(v2)
This is a lane-wise ternary operation which applies the
Math.fma(double, double, double)
operation to each lane.- Parameters:
v1
- the first input vectorv2
- the second input vector- Returns:
- the product of this vector and the first input vector summed with the second input vector
-
fma
public abstract DoubleVector fma(double s1, double s2)
Calculates the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar. More specifically as if the following:this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2))
This is a lane-wise ternary operation which applies the
Math.fma(double, double, double)
operation to each lane.- Parameters:
s1
- the first input scalars2
- the second input scalar- Returns:
- the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar
-
fma
public DoubleVector fma(Vector<Double> v1, Vector<Double> v2, VectorMask<Double> m)
Calculates the product of this vector and a first input vector summed with a second input vector, selecting lane elements controlled by a mask. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(v1, m).add(v2, m)
This is a lane-wise ternary operation which applies the
Math.fma(double, double, double)
operation to each lane.- Parameters:
v1
- the first input vectorv2
- the second input vectorm
- the mask controlling lane selection- Returns:
- the product of this vector and the first input vector summed with the second input vector
-
fma
public abstract DoubleVector fma(double s1, double s2, VectorMask<Double> m)
Calculates the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar, selecting lane elements controlled by a mask More specifically as if the following:this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2), m)
This is a lane-wise ternary operation which applies the
Math.fma(double, double, double)
operation to each lane.- Parameters:
s1
- the first input scalars2
- the second input scalarm
- the mask controlling lane selection- Returns:
- the product of this vector and the broadcast of a first input scalar summed with the broadcast of a second input scalar
-
hypot
public DoubleVector hypot(Vector<Double> v)
Calculates square root of the sum of the squares of this vector and an input vector. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(this).add(v.mul(v)).sqrt()
This is a lane-wise binary operation with same semantic definition as
Math.hypot(double, double)
operation applied to each lane. The implementation is not required to return same results asMath.hypot(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.hypot(double, double)
specifications. The computed result will be within 1 ulp of the exact result.- Parameters:
v
- the input vector- Returns:
- square root of the sum of the squares of this vector and an input vector
-
hypot
public abstract DoubleVector hypot(double s)
Calculates square root of the sum of the squares of this vector and the broadcast of an input scalar. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(this).add(EVector.broadcast(this.species(), s * s)).sqrt()
This is a lane-wise binary operation with same semantic definition as
Math.hypot(double, double)
operation applied to each. The implementation is not required to return same results asMath.hypot(double, double)
, but adheres to rounding, monotonicity, and special case semantics as defined in theMath.hypot(double, double)
specifications. The computed result will be within 1 ulp of the exact result.- Parameters:
s
- the input scalar- Returns:
- square root of the sum of the squares of this vector and the broadcast of an input scalar
-
hypot
public DoubleVector hypot(Vector<Double> v, VectorMask<Double> m)
Calculates square root of the sum of the squares of this vector and an input vector, selecting lane elements controlled by a mask. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(this, m).add(v.mul(v), m).sqrt(m)
Semantics for rounding, monotonicity, and special cases are described in
hypot(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
v
- the input vectorm
- the mask controlling lane selection- Returns:
- square root of the sum of the squares of this vector and an input vector
-
hypot
public abstract DoubleVector hypot(double s, VectorMask<Double> m)
Calculates square root of the sum of the squares of this vector and the broadcast of an input scalar, selecting lane elements controlled by a mask. More specifically as if the following (ignoring any differences in numerical accuracy):this.mul(this, m).add(EVector.broadcast(this.species(), s * s), m).sqrt(m)
Semantics for rounding, monotonicity, and special cases are described in
hypot(jdk.incubator.vector.Vector<java.lang.Double>)
- Parameters:
s
- the input scalarm
- the mask controlling lane selection- Returns:
- square root of the sum of the squares of this vector and the broadcast of an input scalar
-
intoByteArray
public abstract void intoByteArray(byte[] a, int ix)
Stores this vector into a byte array starting at an offset.Bytes are extracted from primitive lane elements according to the native byte order of the underlying platform.
This method behaves as it calls the byte buffer, offset, and mask accepting
method
as follows:return this.intoByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
- Specified by:
intoByteArray
in classVector<Double>
- Parameters:
a
- the byte arrayix
- the offset into the array
-
intoByteArray
public abstract void intoByteArray(byte[] a, int ix, VectorMask<Double> m)
Stores this vector into a byte array starting at an offset and using a mask.Bytes are extracted from primitive lane elements according to the native byte order of the underlying platform.
This method behaves as it calls the byte buffer, offset, and mask accepting
method
as follows:return this.intoByteBuffer(ByteBuffer.wrap(a), i, m);
- Specified by:
intoByteArray
in classVector<Double>
- Parameters:
a
- the byte arrayix
- the offset into the arraym
- the mask controlling lane selection
-
intoByteBuffer
public abstract void intoByteBuffer(ByteBuffer bb, int ix)
Stores this vector into abyte buffer
starting at an offset into the byte buffer.Bytes are extracted from primitive lane elements according to the native byte order of the underlying platform.
This method behaves as if it calls the byte buffer, offset, and mask accepting
Vector.intoByteBuffer(ByteBuffer, int, VectorMask)
method} as follows:this.intoByteBuffer(b, i, this.maskAllTrue())
- Specified by:
intoByteBuffer
in classVector<Double>
- Parameters:
bb
- the byte bufferix
- the offset into the byte buffer
-
intoByteBuffer
public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Double> m)
Stores this vector into abyte buffer
starting at an offset into the byte buffer and using a mask.This method behaves as if the byte buffer is viewed as a primitive
buffer
for the primitive element type, according to the native byte order of the underlying platform, and the lane elements of this vector are put into the buffer if the corresponding mask lane is set. The following pseudocode expresses the behavior, where is the primitive buffer type,e
is the primitive element type, andEVector
is the primitive vector type for this vector:EBuffer eb = b.duplicate(). order(ByteOrder.nativeOrder()).position(i). asEBuffer(); e[] es = ((EVector)this).toArray(); for (int n = 0; n < t.length; n++) { if (m.isSet(n)) { eb.put(n, es[n]); } }
- Specified by:
intoByteBuffer
in classVector<Double>
- Parameters:
bb
- the byte bufferix
- the offset into the byte bufferm
- the mask
-
addLanes
public abstract double addLanes()
Adds all lane elements of this vector.This is a cross-lane reduction operation which applies the addition operation (
+
) to lane elements, and the identity value is0.0
.The value of a floating-point sum is a function both of the input values as well as the order of addition operations. The order of addition operations of this method is intentionally not defined to allow for JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to add all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation of adding vectors sequentially from left to right is used. For this reason, the output of this method may vary for the same input values.
- Returns:
- the addition of all the lane elements of this vector
-
addLanes
public abstract double addLanes(VectorMask<Double> m)
Adds all lane elements of this vector, selecting lane elements controlled by a mask.This is a cross-lane reduction operation which applies the addition operation (
+
) to lane elements, and the identity value is0.0
.The value of a floating-point sum is a function both of the input values as well as the order of addition operations. The order of addition operations of this method is intentionally not defined to allow for JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to add all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation of adding vectors sequentially from left to right is used. For this reason, the output of this method may vary on the same input values.
- Parameters:
m
- the mask controlling lane selection- Returns:
- the addition of the selected lane elements of this vector
-
mulLanes
public abstract double mulLanes()
Multiplies all lane elements of this vector.This is a cross-lane reduction operation which applies the multiplication operation (
*
) to lane elements, and the identity value is1.0
.The order of multiplication operations of this method is intentionally not defined to allow for JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to multiply all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation of multiplying vectors sequentially from left to right is used. For this reason, the output of this method may vary on the same input values.
- Returns:
- the multiplication of all the lane elements of this vector
-
mulLanes
public abstract double mulLanes(VectorMask<Double> m)
Multiplies all lane elements of this vector, selecting lane elements controlled by a mask.This is a cross-lane reduction operation which applies the multiplication operation (
*
) to lane elements, and the identity value is1.0
.The order of multiplication operations of this method is intentionally not defined to allow for JVM to generate optimal machine code for the underlying platform at runtime. If the platform supports a vector instruction to multiply all values in the vector, or if there is some other efficient machine code sequence, then the JVM has the option of generating this machine code. Otherwise, the default implementation of multiplying vectors sequentially from left to right is used. For this reason, the output of this method may vary on the same input values.
- Parameters:
m
- the mask controlling lane selection- Returns:
- the multiplication of all the lane elements of this vector
-
minLanes
public abstract double minLanes()
Returns the minimum lane element of this vector.This is an associative cross-lane reduction operation which applies the operation
(a, b) -> Math.min(a, b)
to lane elements, and the identity value isDouble.POSITIVE_INFINITY
.- Returns:
- the minimum lane element of this vector
-
minLanes
public abstract double minLanes(VectorMask<Double> m)
Returns the minimum lane element of this vector, selecting lane elements controlled by a mask.This is an associative cross-lane reduction operation which applies the operation
(a, b) -> Math.min(a, b)
to lane elements, and the identity value isDouble.POSITIVE_INFINITY
.- Parameters:
m
- the mask controlling lane selection- Returns:
- the minimum lane element of this vector
-
maxLanes
public abstract double maxLanes()
Returns the maximum lane element of this vector.This is an associative cross-lane reduction operation which applies the operation
(a, b) -> Math.max(a, b)
to lane elements, and the identity value isDouble.NEGATIVE_INFINITY
.- Returns:
- the maximum lane element of this vector
-
maxLanes
public abstract double maxLanes(VectorMask<Double> m)
Returns the maximum lane element of this vector, selecting lane elements controlled by a mask.This is an associative cross-lane reduction operation which applies the operation
(a, b) -> Math.max(a, b)
to lane elements, and the identity value isDouble.NEGATIVE_INFINITY
.- Parameters:
m
- the mask controlling lane selection- Returns:
- the maximum lane element of this vector
-
lane
public abstract double 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()
)
-
with
public abstract DoubleVector with(int i, double e)
Replaces the lane element of this vector at lane indexi
with valuee
.This is a cross-lane operation and behaves as if it returns the result of blending this vector with an input vector that is the result of broadcasting
e
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 double[] toArray()
Returns an array containing the lane elements of this vector.This method behaves as if it
intoArray(double[], int)
stores} this vector into an allocated array and returns the array as follows:double[] a = new double[this.length()]; this.intoArray(a, 0); return a;
- Returns:
- an array containing the the lane elements of this vector
-
intoArray
public abstract void intoArray(double[] a, int offset)
Stores this vector into an array starting at offset.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is stored into the array at indexoffset + N
.- Parameters:
a
- the arrayoffset
- the offset into the array- Throws:
IndexOutOfBoundsException
- ifoffset < 0
, oroffset > a.length - this.length()
-
intoArray
public abstract void intoArray(double[] a, int offset, VectorMask<Double> m)
Stores this vector into an array starting at offset and using a mask.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 indexoffset + N
.- Parameters:
a
- the arrayoffset
- the offset into the arraym
- the mask- Throws:
IndexOutOfBoundsException
- ifoffset < 0
, or for any vector lane indexN
where the mask at laneN
is setoffset >= a.length - N
-
intoArray
public abstract void intoArray(double[] a, int a_offset, int[] indexMap, int i_offset)
Stores this vector into an array using indexes obtained from an index map.For each vector lane, where
N
is the vector lane index, the lane element at indexN
is stored into the array at indexa_offset + indexMap[i_offset + N]
.- Parameters:
a
- the arraya_offset
- 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 mapi_offset
- the offset into the index map- Throws:
IndexOutOfBoundsException
- ifi_offset < 0
, ori_offset > indexMap.length - this.length()
, or for any vector lane indexN
the result ofa_offset + indexMap[i_offset + N]
is< 0
or>= a.length
-
intoArray
public abstract void intoArray(double[] a, int a_offset, VectorMask<Double> m, int[] indexMap, int i_offset)
Stores this vector into an array using indexes obtained from an index map and using a mask.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 at indexa_offset + indexMap[i_offset + N]
.- Parameters:
a
- the arraya_offset
- the offset into the array, may be negative if relative indexes in the index map compensate to produce a value within the array boundsm
- the maskindexMap
- the index mapi_offset
- the offset into the index map- Throws:
IndexOutOfBoundsException
- ifj < 0
, ori_offset > indexMap.length - this.length()
, or for any vector lane indexN
where the mask at laneN
is set the result ofa_offset + indexMap[i_offset + N]
is< 0
or>= a.length
-
species
public abstract VectorSpecies<Double> species()
Returns the species of this vector.
-
-