< prev index next >

src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java

Print this page
rev 54658 : refactored mask and shuffle creation methods, moved classes to top-level
rev 54660 : Javadoc changes


 108      *
 109      * @param species species of desired vector
 110      * @return a zero vector of given species
 111      */
 112     @ForceInline
 113     @SuppressWarnings("unchecked")
 114     public static FloatVector zero(VectorSpecies<Float> species) {
 115         return VectorIntrinsics.broadcastCoerced((Class<FloatVector>) species.boxType(), float.class, species.length(),
 116                                                  Float.floatToIntBits(0.0f), species,
 117                                                  ((bits, s) -> ((FloatSpecies)s).op(i -> Float.intBitsToFloat((int)bits))));
 118     }
 119 
 120     /**
 121      * Loads a vector from a byte array starting at an offset.
 122      * <p>
 123      * Bytes are composed into primitive lane elements according to the
 124      * native byte order of the underlying platform
 125      * <p>
 126      * This method behaves as if it returns the result of calling the
 127      * byte buffer, offset, and mask accepting
 128      * {@link #fromByteBuffer(VectorSpecies<Float>, ByteBuffer, int, VectorMask) method} as follows:
 129      * <pre>{@code
 130      * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
 131      * }</pre>
 132      *
 133      * @param species species of desired vector
 134      * @param a the byte array
 135      * @param ix the offset into the array
 136      * @return a vector loaded from a byte array
 137      * @throws IndexOutOfBoundsException if {@code i < 0} or
 138      * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
 139      */
 140     @ForceInline
 141     @SuppressWarnings("unchecked")
 142     public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int ix) {
 143         Objects.requireNonNull(a);
 144         ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
 145         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 146                                      a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
 147                                      a, ix, species,
 148                                      (c, idx, s) -> {
 149                                          ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
 150                                          FloatBuffer tb = bbc.asFloatBuffer();
 151                                          return ((FloatSpecies)s).op(i -> tb.get());
 152                                      });
 153     }
 154 
 155     /**
 156      * Loads a vector from a byte array starting at an offset and using a
 157      * mask.
 158      * <p>
 159      * Bytes are composed into primitive lane elements according to the
 160      * native byte order of the underlying platform.
 161      * <p>
 162      * This method behaves as if it returns the result of calling the
 163      * byte buffer, offset, and mask accepting
 164      * {@link #fromByteBuffer(VectorSpecies<Float>, ByteBuffer, int, VectorMask) method} as follows:
 165      * <pre>{@code
 166      * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
 167      * }</pre>
 168      *
 169      * @param species species of desired vector
 170      * @param a the byte array
 171      * @param ix the offset into the array
 172      * @param m the mask
 173      * @return a vector loaded from a byte array
 174      * @throws IndexOutOfBoundsException if {@code i < 0} or
 175      * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
 176      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 177      * or {@code > a.length},
 178      * for any vector lane index {@code N} where the mask at lane {@code N}
 179      * is set
 180      * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
 181      */
 182     @ForceInline
 183     public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int ix, VectorMask<Float> m) {
 184         return zero(species).blend(fromByteArray(species, a, ix), m);
 185     }
 186 
 187     /**
 188      * Loads a vector from an array starting at offset.
 189      * <p>
 190      * For each vector lane, where {@code N} is the vector lane index, the
 191      * array element at index {@code i + N} is placed into the
 192      * resulting vector at lane index {@code N}.
 193      *
 194      * @param species species of desired vector
 195      * @param a the array
 196      * @param i the offset into the array
 197      * @return the vector loaded from an array
 198      * @throws IndexOutOfBoundsException if {@code i < 0}, or
 199      * {@code i > a.length - this.length()}
 200      */
 201     @ForceInline
 202     @SuppressWarnings("unchecked")
 203     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int i){
 204         Objects.requireNonNull(a);
 205         i = VectorIntrinsics.checkIndex(i, a.length, species.length());
 206         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 207                                      a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_FLOAT_BASE_OFFSET,
 208                                      a, i, species,
 209                                      (c, idx, s) -> ((FloatSpecies)s).op(n -> c[idx + n]));
 210     }
 211 
 212 
 213     /**
 214      * Loads a vector from an array starting at offset and using a mask.
 215      * <p>
 216      * For each vector lane, where {@code N} is the vector lane index,
 217      * if the mask lane at index {@code N} is set then the array element at
 218      * index {@code i + N} is placed into the resulting vector at lane index
 219      * {@code N}, otherwise the default element value is placed into the
 220      * resulting vector at lane index {@code N}.
 221      *
 222      * @param species species of desired vector
 223      * @param a the array
 224      * @param i the offset into the array
 225      * @param m the mask
 226      * @return the vector loaded from an array
 227      * @throws IndexOutOfBoundsException if {@code i < 0}, or
 228      * for any vector lane index {@code N} where the mask at lane {@code N}
 229      * is set {@code i > a.length - N}
 230      */
 231     @ForceInline
 232     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int i, VectorMask<Float> m) {
 233         return zero(species).blend(fromArray(species, a, i), m);
 234     }
 235 
 236     /**
 237      * Loads a vector from an array using indexes obtained from an index
 238      * map.
 239      * <p>
 240      * For each vector lane, where {@code N} is the vector lane index, the
 241      * array element at index {@code i + indexMap[j + N]} is placed into the
 242      * resulting vector at lane index {@code N}.
 243      *
 244      * @param species species of desired vector
 245      * @param a the array
 246      * @param i the offset into the array, may be negative if relative
 247      * indexes in the index map compensate to produce a value within the
 248      * array bounds
 249      * @param indexMap the index map
 250      * @param j the offset into the index map
 251      * @return the vector loaded from an array
 252      * @throws IndexOutOfBoundsException if {@code j < 0}, or
 253      * {@code j > indexMap.length - this.length()},
 254      * or for any vector lane index {@code N} the result of
 255      * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
 256      */
 257     @ForceInline
 258     @SuppressWarnings("unchecked")
 259     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int i, int[] indexMap, int j) {
 260         Objects.requireNonNull(a);
 261         Objects.requireNonNull(indexMap);
 262 
 263 
 264         // Index vector: vix[0:n] = k -> i + indexMap[j + k]
 265         IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, j).add(i);
 266 
 267         vix = VectorIntrinsics.checkIndex(vix, a.length);
 268 
 269         return VectorIntrinsics.loadWithMap((Class<FloatVector>) species.boxType(), float.class, species.length(),
 270                                             IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_FLOAT_BASE_OFFSET, vix,
 271                                             a, i, indexMap, j, species,
 272                                             (float[] c, int idx, int[] iMap, int idy, VectorSpecies<Float> s) ->
 273                                                 ((FloatSpecies)s).op(n -> c[idx + iMap[idy+n]]));
 274         }
 275 
 276     /**
 277      * Loads a vector from an array using indexes obtained from an index
 278      * map and using a mask.
 279      * <p>
 280      * For each vector lane, where {@code N} is the vector lane index,
 281      * if the mask lane at index {@code N} is set then the array element at
 282      * index {@code i + indexMap[j + N]} is placed into the resulting vector
 283      * at lane index {@code N}.
 284      *
 285      * @param species species of desired vector
 286      * @param a the array
 287      * @param i the offset into the array, may be negative if relative
 288      * indexes in the index map compensate to produce a value within the
 289      * array bounds
 290      * @param m the mask
 291      * @param indexMap the index map
 292      * @param j the offset into the index map
 293      * @return the vector loaded from an array
 294      * @throws IndexOutOfBoundsException if {@code j < 0}, or
 295      * {@code j > indexMap.length - this.length()},
 296      * or for any vector lane index {@code N} where the mask at lane
 297      * {@code N} is set the result of {@code i + indexMap[j + N]} is
 298      * {@code < 0} or {@code >= a.length}
 299      */
 300     @ForceInline
 301     @SuppressWarnings("unchecked")
 302     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int i, VectorMask<Float> m, int[] indexMap, int j) {
 303         // @@@ This can result in out of bounds errors for unset mask lanes
 304         return zero(species).blend(fromArray(species, a, i, indexMap, j), m);
 305     }
 306 
 307 
 308     /**
 309      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 310      * offset into the byte buffer.
 311      * <p>
 312      * Bytes are composed into primitive lane elements according to the
 313      * native byte order of the underlying platform.
 314      * <p>
 315      * This method behaves as if it returns the result of calling the
 316      * byte buffer, offset, and mask accepting
 317      * {@link #fromByteBuffer(VectorSpecies<Float>, ByteBuffer, int, VectorMask)} method} as follows:
 318      * <pre>{@code
 319      *   return this.fromByteBuffer(b, i, this.maskAllTrue())
 320      * }</pre>
 321      *
 322      * @param species species of desired vector
 323      * @param bb the byte buffer
 324      * @param ix the offset into the byte buffer
 325      * @return a vector loaded from a byte buffer
 326      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 327      * or {@code > b.limit()},
 328      * or if there are fewer than
 329      * {@code this.length() * this.elementSize() / Byte.SIZE} bytes
 330      * remaining in the byte buffer from the given offset
 331      */
 332     @ForceInline
 333     @SuppressWarnings("unchecked")
 334     public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int ix) {
 335         if (bb.order() != ByteOrder.nativeOrder()) {
 336             throw new IllegalArgumentException();
 337         }
 338         ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
 339         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 340                                      U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix,
 341                                      bb, ix, species,
 342                                      (c, idx, s) -> {
 343                                          ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
 344                                          FloatBuffer tb = bbc.asFloatBuffer();
 345                                          return ((FloatSpecies)s).op(i -> tb.get());
 346                                      });
 347     }
 348 
 349     /**
 350      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 351      * offset into the byte buffer and using a mask.
 352      * <p>
 353      * This method behaves as if the byte buffer is viewed as a primitive
 354      * {@link java.nio.Buffer buffer} for the primitive element type,
 355      * according to the native byte order of the underlying platform, and
 356      * the returned vector is loaded with a mask from a primitive array
 357      * obtained from the primitive buffer.
 358      * The following pseudocode expresses the behaviour, where
 359      * {@coce EBuffer} is the primitive buffer type, {@code e} is the
 360      * primitive element type, and {@code ESpecies<S>} is the primitive
 361      * species for {@code e}:
 362      * <pre>{@code
 363      * EBuffer eb = b.duplicate().
 364      *     order(ByteOrder.nativeOrder()).position(i).
 365      *     asEBuffer();
 366      * e[] es = new e[this.length()];
 367      * for (int n = 0; n < t.length; n++) {
 368      *     if (m.isSet(n))
 369      *         es[n] = eb.get(n);
 370      * }
 371      * Vector<E> r = ((ESpecies<S>)this).fromArray(es, 0, m);
 372      * }</pre>
 373      *
 374      * @param species species of desired vector
 375      * @param bb the byte buffer
 376      * @param ix the offset into the byte buffer
 377      * @param m the mask
 378      * @return a vector loaded from a byte buffer
 379      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 380      * or {@code > b.limit()},
 381      * for any vector lane index {@code N} where the mask at lane {@code N}
 382      * is set
 383      * {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
 384      */
 385     @ForceInline
 386     public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int ix, VectorMask<Float> m) {
 387         return zero(species).blend(fromByteBuffer(species, bb, ix), m);
 388     }
 389 
 390     /**
 391      * Returns a vector where all lane elements are set to the primitive
 392      * value {@code e}.
 393      *
 394      * @param s species of the desired vector
 395      * @param e the value
 396      * @return a vector of vector where all lane elements are set to
 397      * the primitive value {@code e}
 398      */
 399     @ForceInline
 400     @SuppressWarnings("unchecked")
 401     public static FloatVector broadcast(VectorSpecies<Float> s, float e) {
 402         return VectorIntrinsics.broadcastCoerced(
 403             (Class<FloatVector>) s.boxType(), float.class, s.length(),
 404             Float.floatToIntBits(e), s,
 405             ((bits, sp) -> ((FloatSpecies)sp).op(i -> Float.intBitsToFloat((int)bits))));
 406     }
 407 
 408     /**
 409      * Returns a vector where each lane element is set to a given
 410      * primitive value.
 411      * <p>
 412      * For each vector lane, where {@code N} is the vector lane index, the
 413      * the primitive value at index {@code N} is placed into the resulting
 414      * vector at lane index {@code N}.
 415      *
 416      * @param s species of the desired vector
 417      * @param es the given primitive values
 418      * @return a vector where each lane element is set to a given primitive
 419      * value
 420      * @throws IndexOutOfBoundsException if {@code es.length < this.length()}
 421      */
 422     @ForceInline
 423     @SuppressWarnings("unchecked")
 424     public static FloatVector scalars(VectorSpecies<Float> s, float... es) {
 425         Objects.requireNonNull(es);
 426         int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
 427         return VectorIntrinsics.load((Class<FloatVector>) s.boxType(), float.class, s.length(),
 428                                      es, Unsafe.ARRAY_FLOAT_BASE_OFFSET,
 429                                      es, ix, s,
 430                                      (c, idx, sp) -> ((FloatSpecies)sp).op(n -> c[idx + n]));
 431     }
 432 
 433     /**
 434      * Returns a vector where the first lane element is set to the primtive
 435      * value {@code e}, all other lane elements are set to the default
 436      * value.
 437      *
 438      * @param s species of the desired vector
 439      * @param e the value
 440      * @return a vector where the first lane element is set to the primitive
 441      * value {@code e}
 442      */
 443     @ForceInline
 444     public static final FloatVector single(VectorSpecies<Float> s, float e) {
 445         return zero(s).with(0, e);
 446     }
 447 
 448     /**
 449      * Returns a vector where each lane element is set to a randomly
 450      * generated primitive value.
 451      *
 452      * The semantics are equivalent to calling
 453      * {@link ThreadLocalRandom#nextFloat()}
 454      *
 455      * @param s species of the desired vector
 456      * @return a vector where each lane elements is set to a randomly
 457      * generated primitive value
 458      */
 459     public static FloatVector random(VectorSpecies<Float> s) {
 460         ThreadLocalRandom r = ThreadLocalRandom.current();
 461         return ((FloatSpecies)s).op(i -> r.nextFloat());
 462     }
 463 
 464     // Ops
 465 
 466     @Override
 467     public abstract FloatVector add(Vector<Float> v);
 468 
 469     /**
 470      * Adds this vector to the broadcast of an input scalar.
 471      * <p>
 472      * This is a vector binary operation where the primitive addition operation
 473      * ({@code +}) is applied to lane elements.
 474      *
 475      * @param s the input scalar
 476      * @return the result of adding this vector to the broadcast of an input
 477      * scalar
 478      */
 479     public abstract FloatVector add(float s);
 480 
 481     @Override
 482     public abstract FloatVector add(Vector<Float> v, VectorMask<Float> m);
 483 
 484     /**
 485      * Adds this vector to broadcast of an input scalar,
 486      * selecting lane elements controlled by a mask.
 487      * <p>
 488      * This is a vector binary operation where the primitive addition operation
 489      * ({@code +}) is applied to lane elements.
 490      *
 491      * @param s the input scalar
 492      * @param m the mask controlling lane selection
 493      * @return the result of adding this vector to the broadcast of an input
 494      * scalar
 495      */
 496     public abstract FloatVector add(float s, VectorMask<Float> m);
 497 
 498     @Override
 499     public abstract FloatVector sub(Vector<Float> v);
 500 
 501     /**
 502      * Subtracts the broadcast of an input scalar from this vector.
 503      * <p>
 504      * This is a vector binary operation where the primitive subtraction
 505      * operation ({@code -}) is applied to lane elements.
 506      *
 507      * @param s the input scalar
 508      * @return the result of subtracting the broadcast of an input
 509      * scalar from this vector
 510      */
 511     public abstract FloatVector sub(float s);
 512 
 513     @Override
 514     public abstract FloatVector sub(Vector<Float> v, VectorMask<Float> m);
 515 
 516     /**
 517      * Subtracts the broadcast of an input scalar from this vector, selecting
 518      * lane elements controlled by a mask.
 519      * <p>
 520      * This is a vector binary operation where the primitive subtraction
 521      * operation ({@code -}) is applied to lane elements.
 522      *
 523      * @param s the input scalar
 524      * @param m the mask controlling lane selection
 525      * @return the result of subtracting the broadcast of an input
 526      * scalar from this vector
 527      */
 528     public abstract FloatVector sub(float s, VectorMask<Float> m);
 529 
 530     @Override
 531     public abstract FloatVector mul(Vector<Float> v);
 532 
 533     /**
 534      * Multiplies this vector with the broadcast of an input scalar.
 535      * <p>
 536      * This is a vector binary operation where the primitive multiplication
 537      * operation ({@code *}) is applied to lane elements.
 538      *
 539      * @param s the input scalar
 540      * @return the result of multiplying this vector with the broadcast of an
 541      * input scalar
 542      */
 543     public abstract FloatVector mul(float s);
 544 
 545     @Override
 546     public abstract FloatVector mul(Vector<Float> v, VectorMask<Float> m);
 547 
 548     /**
 549      * Multiplies this vector with the broadcast of an input scalar, selecting
 550      * lane elements controlled by a mask.
 551      * <p>
 552      * This is a vector binary operation where the primitive multiplication
 553      * operation ({@code *}) is applied to lane elements.
 554      *
 555      * @param s the input scalar
 556      * @param m the mask controlling lane selection
 557      * @return the result of multiplying this vector with the broadcast of an
 558      * input scalar
 559      */
 560     public abstract FloatVector mul(float s, VectorMask<Float> m);
 561 
 562     @Override
 563     public abstract FloatVector neg();
 564 
 565     @Override
 566     public abstract FloatVector neg(VectorMask<Float> m);
 567 
 568     @Override
 569     public abstract FloatVector abs();
 570 
 571     @Override
 572     public abstract FloatVector abs(VectorMask<Float> m);
 573 
 574     @Override
 575     public abstract FloatVector min(Vector<Float> v);
 576 
 577     @Override
 578     public abstract FloatVector min(Vector<Float> v, VectorMask<Float> m);
 579 
 580     /**
 581      * Returns the minimum of this vector and the broadcast of an input scalar.
 582      * <p>
 583      * This is a vector binary operation where the operation
 584      * {@code (a, b) -> Math.min(a, b)} is applied to lane elements.
 585      *
 586      * @param s the input scalar
 587      * @return the minimum of this vector and the broadcast of an input scalar
 588      */
 589     public abstract FloatVector min(float s);
 590 
 591     @Override
 592     public abstract FloatVector max(Vector<Float> v);
 593 
 594     @Override
 595     public abstract FloatVector max(Vector<Float> v, VectorMask<Float> m);
 596 
 597     /**
 598      * Returns the maximum of this vector and the broadcast of an input scalar.
 599      * <p>
 600      * This is a vector binary operation where the operation
 601      * {@code (a, b) -> Math.max(a, b)} is applied to lane elements.
 602      *
 603      * @param s the input scalar
 604      * @return the maximum of this vector and the broadcast of an input scalar
 605      */
 606     public abstract FloatVector max(float s);
 607 
 608     @Override
 609     public abstract VectorMask<Float> equal(Vector<Float> v);
 610 
 611     /**
 612      * Tests if this vector is equal to the broadcast of an input scalar.
 613      * <p>
 614      * This is a vector binary test operation where the primitive equals
 615      * operation ({@code ==}) is applied to lane elements.
 616      *
 617      * @param s the input scalar
 618      * @return the result mask of testing if this vector is equal to the
 619      * broadcast of an input scalar
 620      */
 621     public abstract VectorMask<Float> equal(float s);
 622 
 623     @Override
 624     public abstract VectorMask<Float> notEqual(Vector<Float> v);
 625 
 626     /**
 627      * Tests if this vector is not equal to the broadcast of an input scalar.
 628      * <p>
 629      * This is a vector binary test operation where the primitive not equals
 630      * operation ({@code !=}) is applied to lane elements.
 631      *
 632      * @param s the input scalar
 633      * @return the result mask of testing if this vector is not equal to the
 634      * broadcast of an input scalar
 635      */
 636     public abstract VectorMask<Float> notEqual(float s);
 637 
 638     @Override
 639     public abstract VectorMask<Float> lessThan(Vector<Float> v);
 640 
 641     /**
 642      * Tests if this vector is less than the broadcast of an input scalar.
 643      * <p>
 644      * This is a vector binary test operation where the primitive less than
 645      * operation ({@code <}) is applied to lane elements.
 646      *
 647      * @param s the input scalar
 648      * @return the mask result of testing if this vector is less than the
 649      * broadcast of an input scalar
 650      */
 651     public abstract VectorMask<Float> lessThan(float s);
 652 
 653     @Override
 654     public abstract VectorMask<Float> lessThanEq(Vector<Float> v);
 655 
 656     /**
 657      * Tests if this vector is less or equal to the broadcast of an input scalar.
 658      * <p>
 659      * This is a vector binary test operation where the primitive less than
 660      * or equal to operation ({@code <=}) is applied to lane elements.
 661      *
 662      * @param s the input scalar
 663      * @return the mask result of testing if this vector is less than or equal
 664      * to the broadcast of an input scalar
 665      */
 666     public abstract VectorMask<Float> lessThanEq(float s);
 667 
 668     @Override
 669     public abstract VectorMask<Float> greaterThan(Vector<Float> v);
 670 
 671     /**
 672      * Tests if this vector is greater than the broadcast of an input scalar.
 673      * <p>
 674      * This is a vector binary test operation where the primitive greater than
 675      * operation ({@code >}) is applied to lane elements.
 676      *
 677      * @param s the input scalar
 678      * @return the mask result of testing if this vector is greater than the
 679      * broadcast of an input scalar
 680      */
 681     public abstract VectorMask<Float> greaterThan(float s);
 682 
 683     @Override
 684     public abstract VectorMask<Float> greaterThanEq(Vector<Float> v);
 685 
 686     /**
 687      * Tests if this vector is greater than or equal to the broadcast of an
 688      * input scalar.
 689      * <p>
 690      * This is a vector binary test operation where the primitive greater than
 691      * or equal to operation ({@code >=}) is applied to lane elements.
 692      *
 693      * @param s the input scalar
 694      * @return the mask result of testing if this vector is greater than or
 695      * equal to the broadcast of an input scalar
 696      */
 697     public abstract VectorMask<Float> greaterThanEq(float s);
 698 
 699     @Override
 700     public abstract FloatVector blend(Vector<Float> v, VectorMask<Float> m);
 701 
 702     /**
 703      * Blends the lane elements of this vector with those of the broadcast of an
 704      * input scalar, selecting lanes controlled by a mask.
 705      * <p>
 706      * For each lane of the mask, at lane index {@code N}, if the mask lane
 707      * is set then the lane element at {@code N} from the input vector is
 708      * selected and placed into the resulting vector at {@code N},
 709      * otherwise the the lane element at {@code N} from this input vector is
 710      * selected and placed into the resulting vector at {@code N}.
 711      *


 724     public abstract FloatVector rearrange(VectorShuffle<Float> m);
 725 
 726     @Override
 727     public abstract FloatVector reshape(VectorSpecies<Float> s);
 728 
 729     @Override
 730     public abstract FloatVector rotateEL(int i);
 731 
 732     @Override
 733     public abstract FloatVector rotateER(int i);
 734 
 735     @Override
 736     public abstract FloatVector shiftEL(int i);
 737 
 738     @Override
 739     public abstract FloatVector shiftER(int i);
 740 
 741     /**
 742      * Divides this vector by an input vector.
 743      * <p>
 744      * This is a vector binary operation where the primitive division
 745      * operation ({@code /}) is applied to lane elements.
 746      *
 747      * @param v the input vector
 748      * @return the result of dividing this vector by the input vector
 749      */
 750     public abstract FloatVector div(Vector<Float> v);
 751 
 752     /**
 753      * Divides this vector by the broadcast of an input scalar.
 754      * <p>
 755      * This is a vector binary operation where the primitive division
 756      * operation ({@code /}) is applied to lane elements.
 757      *
 758      * @param s the input scalar
 759      * @return the result of dividing this vector by the broadcast of an input
 760      * scalar
 761      */
 762     public abstract FloatVector div(float s);
 763 
 764     /**
 765      * Divides this vector by an input vector, selecting lane elements
 766      * controlled by a mask.
 767      * <p>
 768      * This is a vector binary operation where the primitive division
 769      * operation ({@code /}) is applied to lane elements.
 770      *
 771      * @param v the input vector
 772      * @param m the mask controlling lane selection
 773      * @return the result of dividing this vector by the input vector
 774      */
 775     public abstract FloatVector div(Vector<Float> v, VectorMask<Float> m);
 776 
 777     /**
 778      * Divides this vector by the broadcast of an input scalar, selecting lane
 779      * elements controlled by a mask.
 780      * <p>
 781      * This is a vector binary operation where the primitive division
 782      * operation ({@code /}) is applied to lane elements.
 783      *
 784      * @param s the input scalar
 785      * @param m the mask controlling lane selection
 786      * @return the result of dividing this vector by the broadcast of an input
 787      * scalar
 788      */
 789     public abstract FloatVector div(float s, VectorMask<Float> m);
 790 
 791     /**
 792      * Calculates the square root of this vector.
 793      * <p>
 794      * This is a vector unary operation where the {@link Math#sqrt} operation
 795      * is applied to lane elements.
 796      *
 797      * @return the square root of this vector
 798      */
 799     public abstract FloatVector sqrt();
 800 
 801     /**
 802      * Calculates the square root of this vector, selecting lane elements
 803      * controlled by a mask.
 804      * <p>
 805      * This is a vector unary operation where the {@link Math#sqrt} operation
 806      * is applied to lane elements.
 807      *
 808      * @param m the mask controlling lane selection
 809      * @return the square root of this vector
 810      */
 811     public FloatVector sqrt(VectorMask<Float> m) {
 812         return uOp(m, (i, a) -> (float) Math.sqrt((double) a));
 813     }
 814 
 815     /**
 816      * Calculates the trigonometric tangent of this vector.
 817      * <p>
 818      * This is a vector unary operation with same semantic definition as
 819      * {@link Math#tan} operation applied to lane elements.
 820      * The implementation is not required to return same
 821      * results as {@link Math#tan}, but adheres to rounding, monotonicity,
 822      * and special case semantics as defined in the {@link Math#tan}
 823      * specifications. The computed result will be within 1 ulp of the
 824      * exact result.
 825      *
 826      * @return the tangent of this vector
 827      */
 828     public FloatVector tan() {
 829         return uOp((i, a) -> (float) Math.tan((double) a));
 830     }
 831 
 832     /**
 833      * Calculates the trigonometric tangent of this vector, selecting lane
 834      * elements controlled by a mask.
 835      * <p>
 836      * Semantics for rounding, monotonicity, and special cases are
 837      * described in {@link FloatVector#tan}
 838      *
 839      * @param m the mask controlling lane selection
 840      * @return the tangent of this vector
 841      */
 842     public FloatVector tan(VectorMask<Float> m) {
 843         return uOp(m, (i, a) -> (float) Math.tan((double) a));
 844     }
 845 
 846     /**
 847      * Calculates the hyperbolic tangent of this vector.
 848      * <p>
 849      * This is a vector unary operation with same semantic definition as
 850      * {@link Math#tanh} operation applied to lane elements.
 851      * The implementation is not required to return same
 852      * results as {@link Math#tanh}, but adheres to rounding, monotonicity,
 853      * and special case semantics as defined in the {@link Math#tanh}
 854      * specifications. The computed result will be within 2.5 ulps of the
 855      * exact result.
 856      *
 857      * @return the hyperbolic tangent of this vector
 858      */
 859     public FloatVector tanh() {
 860         return uOp((i, a) -> (float) Math.tanh((double) a));
 861     }
 862 
 863     /**
 864      * Calculates the hyperbolic tangent of this vector, selecting lane elements
 865      * controlled by a mask.
 866      * <p>
 867      * Semantics for rounding, monotonicity, and special cases are
 868      * described in {@link FloatVector#tanh}
 869      *
 870      * @param m the mask controlling lane selection
 871      * @return the hyperbolic tangent of this vector
 872      */
 873     public FloatVector tanh(VectorMask<Float> m) {
 874         return uOp(m, (i, a) -> (float) Math.tanh((double) a));
 875     }
 876 
 877     /**
 878      * Calculates the trigonometric sine of this vector.
 879      * <p>
 880      * This is a vector unary operation with same semantic definition as
 881      * {@link Math#sin} operation applied to lane elements.
 882      * The implementation is not required to return same
 883      * results as {@link Math#sin}, but adheres to rounding, monotonicity,
 884      * and special case semantics as defined in the {@link Math#sin}
 885      * specifications. The computed result will be within 1 ulp of the
 886      * exact result.
 887      *
 888      * @return the sine of this vector
 889      */
 890     public FloatVector sin() {
 891         return uOp((i, a) -> (float) Math.sin((double) a));
 892     }
 893 
 894     /**
 895      * Calculates the trigonometric sine of this vector, selecting lane elements
 896      * controlled by a mask.
 897      * <p>
 898      * Semantics for rounding, monotonicity, and special cases are
 899      * described in {@link FloatVector#sin}
 900      *
 901      * @param m the mask controlling lane selection
 902      * @return the sine of this vector
 903      */
 904     public FloatVector sin(VectorMask<Float> m) {
 905         return uOp(m, (i, a) -> (float) Math.sin((double) a));
 906     }
 907 
 908     /**
 909      * Calculates the hyperbolic sine of this vector.
 910      * <p>
 911      * This is a vector unary operation with same semantic definition as
 912      * {@link Math#sinh} operation applied to lane elements.
 913      * The implementation is not required to return same
 914      * results as  {@link Math#sinh}, but adheres to rounding, monotonicity,
 915      * and special case semantics as defined in the {@link Math#sinh}
 916      * specifications. The computed result will be within 2.5 ulps of the
 917      * exact result.
 918      *
 919      * @return the hyperbolic sine of this vector
 920      */
 921     public FloatVector sinh() {
 922         return uOp((i, a) -> (float) Math.sinh((double) a));
 923     }
 924 
 925     /**
 926      * Calculates the hyperbolic sine of this vector, selecting lane elements
 927      * controlled by a mask.
 928      * <p>
 929      * Semantics for rounding, monotonicity, and special cases are
 930      * described in {@link FloatVector#sinh}
 931      *
 932      * @param m the mask controlling lane selection
 933      * @return the hyperbolic sine of this vector
 934      */
 935     public FloatVector sinh(VectorMask<Float> m) {
 936         return uOp(m, (i, a) -> (float) Math.sinh((double) a));
 937     }
 938 
 939     /**
 940      * Calculates the trigonometric cosine of this vector.
 941      * <p>
 942      * This is a vector unary operation with same semantic definition as
 943      * {@link Math#cos} operation applied to lane elements.
 944      * The implementation is not required to return same
 945      * results as {@link Math#cos}, but adheres to rounding, monotonicity,
 946      * and special case semantics as defined in the {@link Math#cos}
 947      * specifications. The computed result will be within 1 ulp of the
 948      * exact result.
 949      *
 950      * @return the cosine of this vector
 951      */
 952     public FloatVector cos() {
 953         return uOp((i, a) -> (float) Math.cos((double) a));
 954     }
 955 
 956     /**
 957      * Calculates the trigonometric cosine of this vector, selecting lane
 958      * elements controlled by a mask.
 959      * <p>
 960      * Semantics for rounding, monotonicity, and special cases are
 961      * described in {@link FloatVector#cos}
 962      *
 963      * @param m the mask controlling lane selection
 964      * @return the cosine of this vector
 965      */
 966     public FloatVector cos(VectorMask<Float> m) {
 967         return uOp(m, (i, a) -> (float) Math.cos((double) a));
 968     }
 969 
 970     /**
 971      * Calculates the hyperbolic cosine of this vector.
 972      * <p>
 973      * This is a vector unary operation with same semantic definition as
 974      * {@link Math#cosh} operation applied to lane elements.
 975      * The implementation is not required to return same
 976      * results as {@link Math#cosh}, but adheres to rounding, monotonicity,
 977      * and special case semantics as defined in the {@link Math#cosh}
 978      * specifications. The computed result will be within 2.5 ulps of the
 979      * exact result.
 980      *
 981      * @return the hyperbolic cosine of this vector
 982      */
 983     public FloatVector cosh() {
 984         return uOp((i, a) -> (float) Math.cosh((double) a));
 985     }
 986 
 987     /**
 988      * Calculates the hyperbolic cosine of this vector, selecting lane elements
 989      * controlled by a mask.
 990      * <p>
 991      * Semantics for rounding, monotonicity, and special cases are
 992      * described in {@link FloatVector#cosh}
 993      *
 994      * @param m the mask controlling lane selection
 995      * @return the hyperbolic cosine of this vector
 996      */
 997     public FloatVector cosh(VectorMask<Float> m) {
 998         return uOp(m, (i, a) -> (float) Math.cosh((double) a));
 999     }
1000 
1001     /**
1002      * Calculates the arc sine of this vector.
1003      * <p>
1004      * This is a vector unary operation with same semantic definition as
1005      * {@link Math#asin} operation applied to lane elements.
1006      * The implementation is not required to return same
1007      * results as {@link Math#asin}, but adheres to rounding, monotonicity,
1008      * and special case semantics as defined in the {@link Math#asin}
1009      * specifications. The computed result will be within 1 ulp of the
1010      * exact result.
1011      *
1012      * @return the arc sine of this vector
1013      */
1014     public FloatVector asin() {
1015         return uOp((i, a) -> (float) Math.asin((double) a));
1016     }
1017 
1018     /**
1019      * Calculates the arc sine of this vector, selecting lane elements
1020      * controlled by a mask.
1021      * <p>
1022      * Semantics for rounding, monotonicity, and special cases are
1023      * described in {@link FloatVector#asin}
1024      *
1025      * @param m the mask controlling lane selection
1026      * @return the arc sine of this vector
1027      */
1028     public FloatVector asin(VectorMask<Float> m) {
1029         return uOp(m, (i, a) -> (float) Math.asin((double) a));
1030     }
1031 
1032     /**
1033      * Calculates the arc cosine of this vector.
1034      * <p>
1035      * This is a vector unary operation with same semantic definition as
1036      * {@link Math#acos} operation applied to lane elements.
1037      * The implementation is not required to return same
1038      * results as {@link Math#acos}, but adheres to rounding, monotonicity,
1039      * and special case semantics as defined in the {@link Math#acos}
1040      * specifications. The computed result will be within 1 ulp of the
1041      * exact result.
1042      *
1043      * @return the arc cosine of this vector
1044      */
1045     public FloatVector acos() {
1046         return uOp((i, a) -> (float) Math.acos((double) a));
1047     }
1048 
1049     /**
1050      * Calculates the arc cosine of this vector, selecting lane elements
1051      * controlled by a mask.
1052      * <p>
1053      * Semantics for rounding, monotonicity, and special cases are
1054      * described in {@link FloatVector#acos}
1055      *
1056      * @param m the mask controlling lane selection
1057      * @return the arc cosine of this vector
1058      */
1059     public FloatVector acos(VectorMask<Float> m) {
1060         return uOp(m, (i, a) -> (float) Math.acos((double) a));
1061     }
1062 
1063     /**
1064      * Calculates the arc tangent of this vector.
1065      * <p>
1066      * This is a vector unary operation with same semantic definition as
1067      * {@link Math#atan} operation applied to lane elements.
1068      * The implementation is not required to return same
1069      * results as {@link Math#atan}, but adheres to rounding, monotonicity,
1070      * and special case semantics as defined in the {@link Math#atan}
1071      * specifications. The computed result will be within 1 ulp of the
1072      * exact result.
1073      *
1074      * @return the arc tangent of this vector
1075      */
1076     public FloatVector atan() {
1077         return uOp((i, a) -> (float) Math.atan((double) a));
1078     }
1079 
1080     /**
1081      * Calculates the arc tangent of this vector, selecting lane elements
1082      * controlled by a mask.
1083      * <p>
1084      * Semantics for rounding, monotonicity, and special cases are
1085      * described in {@link FloatVector#atan}
1086      *
1087      * @param m the mask controlling lane selection
1088      * @return the arc tangent of this vector
1089      */
1090     public FloatVector atan(VectorMask<Float> m) {
1091         return uOp(m, (i, a) -> (float) Math.atan((double) a));
1092     }
1093 
1094     /**
1095      * Calculates the arc tangent of this vector divided by an input vector.
1096      * <p>
1097      * This is a vector binary operation with same semantic definition as
1098      * {@link Math#atan2} operation applied to lane elements.
1099      * The implementation is not required to return same
1100      * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1101      * and special case semantics as defined in the {@link Math#atan2}
1102      * specifications. The computed result will be within 2 ulps of the
1103      * exact result.
1104      *
1105      * @param v the input vector
1106      * @return the arc tangent of this vector divided by the input vector
1107      */
1108     public FloatVector atan2(Vector<Float> v) {
1109         return bOp(v, (i, a, b) -> (float) Math.atan2((double) a, (double) b));
1110     }
1111 
1112     /**
1113      * Calculates the arc tangent of this vector divided by the broadcast of an
1114      * an input scalar.
1115      * <p>
1116      * This is a vector binary operation with same semantic definition as
1117      * {@link Math#atan2} operation applied to lane elements.
1118      * The implementation is not required to return same
1119      * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1120      * and special case semantics as defined in the {@link Math#atan2}
1121      * specifications. The computed result will be within 1 ulp of the
1122      * exact result.
1123      *
1124      * @param s the input scalar
1125      * @return the arc tangent of this vector over the input vector
1126      */
1127     public abstract FloatVector atan2(float s);
1128 
1129     /**
1130      * Calculates the arc tangent of this vector divided by an input vector,
1131      * selecting lane elements controlled by a mask.
1132      * <p>
1133      * Semantics for rounding, monotonicity, and special cases are
1134      * described in {@link FloatVector#atan2}
1135      *
1136      * @param v the input vector
1137      * @param m the mask controlling lane selection


1140     public FloatVector atan2(Vector<Float> v, VectorMask<Float> m) {
1141         return bOp(v, m, (i, a, b) -> (float) Math.atan2((double) a, (double) b));
1142     }
1143 
1144     /**
1145      * Calculates the arc tangent of this vector divided by the broadcast of an
1146      * an input scalar, selecting lane elements controlled by a mask.
1147      * <p>
1148      * Semantics for rounding, monotonicity, and special cases are
1149      * described in {@link FloatVector#atan2}
1150      *
1151      * @param s the input scalar
1152      * @param m the mask controlling lane selection
1153      * @return the arc tangent of this vector over the input vector
1154      */
1155     public abstract FloatVector atan2(float s, VectorMask<Float> m);
1156 
1157     /**
1158      * Calculates the cube root of this vector.
1159      * <p>
1160      * This is a vector unary operation with same semantic definition as
1161      * {@link Math#cbrt} operation applied to lane elements.
1162      * The implementation is not required to return same
1163      * results as {@link Math#cbrt}, but adheres to rounding, monotonicity,
1164      * and special case semantics as defined in the {@link Math#cbrt}
1165      * specifications. The computed result will be within 1 ulp of the
1166      * exact result.
1167      *
1168      * @return the cube root of this vector
1169      */
1170     public FloatVector cbrt() {
1171         return uOp((i, a) -> (float) Math.cbrt((double) a));
1172     }
1173 
1174     /**
1175      * Calculates the cube root of this vector, selecting lane elements
1176      * controlled by a mask.
1177      * <p>
1178      * Semantics for rounding, monotonicity, and special cases are
1179      * described in {@link FloatVector#cbrt}
1180      *
1181      * @param m the mask controlling lane selection
1182      * @return the cube root of this vector
1183      */
1184     public FloatVector cbrt(VectorMask<Float> m) {
1185         return uOp(m, (i, a) -> (float) Math.cbrt((double) a));
1186     }
1187 
1188     /**
1189      * Calculates the natural logarithm of this vector.
1190      * <p>
1191      * This is a vector unary operation with same semantic definition as
1192      * {@link Math#log} operation applied to lane elements.
1193      * The implementation is not required to return same
1194      * results as {@link Math#log}, but adheres to rounding, monotonicity,
1195      * and special case semantics as defined in the {@link Math#log}
1196      * specifications. The computed result will be within 1 ulp of the
1197      * exact result.
1198      *
1199      * @return the natural logarithm of this vector
1200      */
1201     public FloatVector log() {
1202         return uOp((i, a) -> (float) Math.log((double) a));
1203     }
1204 
1205     /**
1206      * Calculates the natural logarithm of this vector, selecting lane elements
1207      * controlled by a mask.
1208      * <p>
1209      * Semantics for rounding, monotonicity, and special cases are
1210      * described in {@link FloatVector#log}
1211      *
1212      * @param m the mask controlling lane selection
1213      * @return the natural logarithm of this vector
1214      */
1215     public FloatVector log(VectorMask<Float> m) {
1216         return uOp(m, (i, a) -> (float) Math.log((double) a));
1217     }
1218 
1219     /**
1220      * Calculates the base 10 logarithm of this vector.
1221      * <p>
1222      * This is a vector unary operation with same semantic definition as
1223      * {@link Math#log10} operation applied to lane elements.
1224      * The implementation is not required to return same
1225      * results as {@link Math#log10}, but adheres to rounding, monotonicity,
1226      * and special case semantics as defined in the {@link Math#log10}
1227      * specifications. The computed result will be within 1 ulp of the
1228      * exact result.
1229      *
1230      * @return the base 10 logarithm of this vector
1231      */
1232     public FloatVector log10() {
1233         return uOp((i, a) -> (float) Math.log10((double) a));
1234     }
1235 
1236     /**
1237      * Calculates the base 10 logarithm of this vector, selecting lane elements
1238      * controlled by a mask.
1239      * <p>
1240      * Semantics for rounding, monotonicity, and special cases are
1241      * described in {@link FloatVector#log10}
1242      *
1243      * @param m the mask controlling lane selection
1244      * @return the base 10 logarithm of this vector
1245      */
1246     public FloatVector log10(VectorMask<Float> m) {
1247         return uOp(m, (i, a) -> (float) Math.log10((double) a));
1248     }
1249 
1250     /**
1251      * Calculates the natural logarithm of the sum of this vector and the
1252      * broadcast of {@code 1}.
1253      * <p>
1254      * This is a vector unary operation with same semantic definition as
1255      * {@link Math#log1p} operation applied to lane elements.
1256      * The implementation is not required to return same
1257      * results as  {@link Math#log1p}, but adheres to rounding, monotonicity,
1258      * and special case semantics as defined in the {@link Math#log1p}
1259      * specifications. The computed result will be within 1 ulp of the
1260      * exact result.
1261      *
1262      * @return the natural logarithm of the sum of this vector and the broadcast
1263      * of {@code 1}
1264      */
1265     public FloatVector log1p() {
1266         return uOp((i, a) -> (float) Math.log1p((double) a));
1267     }
1268 
1269     /**
1270      * Calculates the natural logarithm of the sum of this vector and the
1271      * broadcast of {@code 1}, selecting lane elements controlled by a mask.
1272      * <p>
1273      * Semantics for rounding, monotonicity, and special cases are
1274      * described in {@link FloatVector#log1p}
1275      *
1276      * @param m the mask controlling lane selection
1277      * @return the natural logarithm of the sum of this vector and the broadcast
1278      * of {@code 1}
1279      */
1280     public FloatVector log1p(VectorMask<Float> m) {
1281         return uOp(m, (i, a) -> (float) Math.log1p((double) a));
1282     }
1283 
1284     /**
1285      * Calculates this vector raised to the power of an input vector.
1286      * <p>
1287      * This is a vector binary operation with same semantic definition as
1288      * {@link Math#pow} operation applied to lane elements.
1289      * The implementation is not required to return same
1290      * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1291      * and special case semantics as defined in the {@link Math#pow}
1292      * specifications. The computed result will be within 1 ulp of the
1293      * exact result.
1294      *
1295      * @param v the input vector
1296      * @return this vector raised to the power of an input vector
1297      */
1298     public FloatVector pow(Vector<Float> v) {
1299         return bOp(v, (i, a, b) -> (float) Math.pow((double) a, (double) b));
1300     }
1301 
1302     /**
1303      * Calculates this vector raised to the power of the broadcast of an input
1304      * scalar.
1305      * <p>
1306      * This is a vector binary operation with same semantic definition as
1307      * {@link Math#pow} operation applied to lane elements.
1308      * The implementation is not required to return same
1309      * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1310      * and special case semantics as defined in the {@link Math#pow}
1311      * specifications. The computed result will be within 1 ulp of the
1312      * exact result.
1313      *
1314      * @param s the input scalar
1315      * @return this vector raised to the power of the broadcast of an input
1316      * scalar.
1317      */
1318     public abstract FloatVector pow(float s);
1319 
1320     /**
1321      * Calculates this vector raised to the power of an input vector, selecting
1322      * lane elements controlled by a mask.
1323      * <p>
1324      * Semantics for rounding, monotonicity, and special cases are
1325      * described in {@link FloatVector#pow}
1326      *
1327      * @param v the input vector


1333     }
1334 
1335     /**
1336      * Calculates this vector raised to the power of the broadcast of an input
1337      * scalar, selecting lane elements controlled by a mask.
1338      * <p>
1339      * Semantics for rounding, monotonicity, and special cases are
1340      * described in {@link FloatVector#pow}
1341      *
1342      * @param s the input scalar
1343      * @param m the mask controlling lane selection
1344      * @return this vector raised to the power of the broadcast of an input
1345      * scalar.
1346      */
1347     public abstract FloatVector pow(float s, VectorMask<Float> m);
1348 
1349     /**
1350      * Calculates the broadcast of Euler's number {@code e} raised to the power
1351      * of this vector.
1352      * <p>
1353      * This is a vector unary operation with same semantic definition as
1354      * {@link Math#exp} operation applied to lane elements.
1355      * The implementation is not required to return same
1356      * results as {@link Math#exp}, but adheres to rounding, monotonicity,
1357      * and special case semantics as defined in the {@link Math#exp}
1358      * specifications. The computed result will be within 1 ulp of the
1359      * exact result.
1360      *
1361      * @return the broadcast of Euler's number {@code e} raised to the power of
1362      * this vector
1363      */
1364     public FloatVector exp() {
1365         return uOp((i, a) -> (float) Math.exp((double) a));
1366     }
1367 
1368     /**
1369      * Calculates the broadcast of Euler's number {@code e} raised to the power
1370      * of this vector, selecting lane elements controlled by a mask.
1371      * <p>
1372      * Semantics for rounding, monotonicity, and special cases are
1373      * described in {@link FloatVector#exp}
1374      *
1375      * @param m the mask controlling lane selection
1376      * @return the broadcast of Euler's number {@code e} raised to the power of
1377      * this vector
1378      */
1379     public FloatVector exp(VectorMask<Float> m) {
1380         return uOp(m, (i, a) -> (float) Math.exp((double) a));
1381     }
1382 
1383     /**
1384      * Calculates the broadcast of Euler's number {@code e} raised to the power
1385      * of this vector minus the broadcast of {@code -1}.
1386      * More specifically as if the following (ignoring any differences in
1387      * numerical accuracy):
1388      * <pre>{@code
1389      *   this.exp().sub(this.species().broadcast(1))
1390      * }</pre>
1391      * <p>
1392      * This is a vector unary operation with same semantic definition as
1393      * {@link Math#expm1} operation applied to lane elements.
1394      * The implementation is not required to return same
1395      * results as {@link Math#expm1}, but adheres to rounding, monotonicity,
1396      * and special case semantics as defined in the {@link Math#expm1}
1397      * specifications. The computed result will be within 1 ulp of the
1398      * exact result.
1399      *
1400      * @return the broadcast of Euler's number {@code e} raised to the power of
1401      * this vector minus the broadcast of {@code -1}
1402      */
1403     public FloatVector expm1() {
1404         return uOp((i, a) -> (float) Math.expm1((double) a));
1405     }
1406 
1407     /**
1408      * Calculates the broadcast of Euler's number {@code e} raised to the power
1409      * of this vector minus the broadcast of {@code -1}, selecting lane elements
1410      * controlled by a mask
1411      * More specifically as if the following (ignoring any differences in
1412      * numerical accuracy):
1413      * <pre>{@code
1414      *   this.exp(m).sub(this.species().broadcast(1), m)
1415      * }</pre>
1416      * <p>
1417      * Semantics for rounding, monotonicity, and special cases are
1418      * described in {@link FloatVector#expm1}
1419      *
1420      * @param m the mask controlling lane selection
1421      * @return the broadcast of Euler's number {@code e} raised to the power of
1422      * this vector minus the broadcast of {@code -1}
1423      */
1424     public FloatVector expm1(VectorMask<Float> m) {
1425         return uOp(m, (i, a) -> (float) Math.expm1((double) a));
1426     }
1427 
1428     /**
1429      * Calculates the product of this vector and a first input vector summed
1430      * with a second input vector.
1431      * More specifically as if the following (ignoring any differences in
1432      * numerical accuracy):
1433      * <pre>{@code
1434      *   this.mul(v1).add(v2)
1435      * }</pre>
1436      * <p>
1437      * This is a vector ternary operation where the {@link Math#fma} operation
1438      * is applied to lane elements.
1439      *
1440      * @param v1 the first input vector
1441      * @param v2 the second input vector
1442      * @return the product of this vector and the first input vector summed with
1443      * the second input vector
1444      */
1445     public abstract FloatVector fma(Vector<Float> v1, Vector<Float> v2);
1446 
1447     /**
1448      * Calculates the product of this vector and the broadcast of a first input
1449      * scalar summed with the broadcast of a second input scalar.
1450      * More specifically as if the following:
1451      * <pre>{@code
1452      *   this.fma(this.species().broadcast(s1), this.species().broadcast(s2))
1453      * }</pre>
1454      * <p>
1455      * This is a vector ternary operation where the {@link Math#fma} operation
1456      * is applied to lane elements.
1457      *
1458      * @param s1 the first input scalar
1459      * @param s2 the second input scalar
1460      * @return the product of this vector and the broadcast of a first input
1461      * scalar summed with the broadcast of a second input scalar
1462      */
1463     public abstract FloatVector fma(float s1, float s2);
1464 
1465     /**
1466      * Calculates the product of this vector and a first input vector summed
1467      * with a second input vector, selecting lane elements controlled by a mask.
1468      * More specifically as if the following (ignoring any differences in
1469      * numerical accuracy):
1470      * <pre>{@code
1471      *   this.mul(v1, m).add(v2, m)
1472      * }</pre>
1473      * <p>
1474      * This is a vector ternary operation where the {@link Math#fma} operation
1475      * is applied to lane elements.
1476      *
1477      * @param v1 the first input vector
1478      * @param v2 the second input vector
1479      * @param m the mask controlling lane selection
1480      * @return the product of this vector and the first input vector summed with
1481      * the second input vector
1482      */
1483     public FloatVector fma(Vector<Float> v1, Vector<Float> v2, VectorMask<Float> m) {
1484         return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
1485     }
1486 
1487     /**
1488      * Calculates the product of this vector and the broadcast of a first input
1489      * scalar summed with the broadcast of a second input scalar, selecting lane
1490      * elements controlled by a mask
1491      * More specifically as if the following:
1492      * <pre>{@code
1493      *   this.fma(this.species().broadcast(s1), this.species().broadcast(s2), m)
1494      * }</pre>
1495      * <p>
1496      * This is a vector ternary operation where the {@link Math#fma} operation
1497      * is applied to lane elements.
1498      *
1499      * @param s1 the first input scalar
1500      * @param s2 the second input scalar
1501      * @param m the mask controlling lane selection
1502      * @return the product of this vector and the broadcast of a first input
1503      * scalar summed with the broadcast of a second input scalar
1504      */
1505     public abstract FloatVector fma(float s1, float s2, VectorMask<Float> m);
1506 
1507     /**
1508      * Calculates square root of the sum of the squares of this vector and an
1509      * input vector.
1510      * More specifically as if the following (ignoring any differences in
1511      * numerical accuracy):
1512      * <pre>{@code
1513      *   this.mul(this).add(v.mul(v)).sqrt()
1514      * }</pre>
1515      * <p>
1516      * This is a vector binary operation with same semantic definition as
1517      * {@link Math#hypot} operation applied to lane elements.
1518      * The implementation is not required to return same
1519      * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1520      * and special case semantics as defined in the {@link Math#hypot}
1521      * specifications. The computed result will be within 1 ulp of the
1522      * exact result.
1523      *
1524      * @param v the input vector
1525      * @return square root of the sum of the squares of this vector and an input
1526      * vector
1527      */
1528     public FloatVector hypot(Vector<Float> v) {
1529         return bOp(v, (i, a, b) -> (float) Math.hypot((double) a, (double) b));
1530     }
1531 
1532     /**
1533      * Calculates square root of the sum of the squares of this vector and the
1534      * broadcast of an input scalar.
1535      * More specifically as if the following (ignoring any differences in
1536      * numerical accuracy):
1537      * <pre>{@code
1538      *   this.mul(this).add(this.species().broadcast(v * v)).sqrt()
1539      * }</pre>
1540      * <p>
1541      * This is a vector binary operation with same semantic definition as
1542      * {@link Math#hypot} operation applied to lane elements.
1543      * The implementation is not required to return same
1544      * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1545      * and special case semantics as defined in the {@link Math#hypot}
1546      * specifications. The computed result will be within 1 ulp of the
1547      * exact result.
1548      *
1549      * @param s the input scalar
1550      * @return square root of the sum of the squares of this vector and the
1551      * broadcast of an input scalar
1552      */
1553     public abstract FloatVector hypot(float s);
1554 
1555     /**
1556      * Calculates square root of the sum of the squares of this vector and an
1557      * input vector, selecting lane elements controlled by a mask.
1558      * More specifically as if the following (ignoring any differences in
1559      * numerical accuracy):
1560      * <pre>{@code
1561      *   this.mul(this, m).add(v.mul(v), m).sqrt(m)
1562      * }</pre>
1563      * <p>
1564      * Semantics for rounding, monotonicity, and special cases are
1565      * described in {@link FloatVector#hypot}
1566      *
1567      * @param v the input vector
1568      * @param m the mask controlling lane selection
1569      * @return square root of the sum of the squares of this vector and an input
1570      * vector
1571      */
1572     public FloatVector hypot(Vector<Float> v, VectorMask<Float> m) {
1573         return bOp(v, m, (i, a, b) -> (float) Math.hypot((double) a, (double) b));
1574     }
1575 
1576     /**
1577      * Calculates square root of the sum of the squares of this vector and the
1578      * broadcast of an input scalar, selecting lane elements controlled by a
1579      * mask.
1580      * More specifically as if the following (ignoring any differences in
1581      * numerical accuracy):
1582      * <pre>{@code
1583      *   this.mul(this, m).add(this.species().broadcast(v * v), m).sqrt(m)
1584      * }</pre>
1585      * <p>
1586      * Semantics for rounding, monotonicity, and special cases are
1587      * described in {@link FloatVector#hypot}
1588      *
1589      * @param s the input scalar
1590      * @param m the mask controlling lane selection
1591      * @return square root of the sum of the squares of this vector and the
1592      * broadcast of an input scalar
1593      */
1594     public abstract FloatVector hypot(float s, VectorMask<Float> m);
1595 
1596 
1597     @Override
1598     public abstract void intoByteArray(byte[] a, int ix);
1599 
1600     @Override
1601     public abstract void intoByteArray(byte[] a, int ix, VectorMask<Float> m);
1602 
1603     @Override
1604     public abstract void intoByteBuffer(ByteBuffer bb, int ix);
1605 
1606     @Override
1607     public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Float> m);
1608 
1609 
1610     // Type specific horizontal reductions
1611     /**
1612      * Adds all lane elements of this vector.
1613      * <p>
1614      * This is a vector reduction operation where the addition
1615      * operation ({@code +}) is applied to lane elements,
1616      * and the identity value is {@code 0.0}.
1617      *
1618      * <p>The value of a floating-point sum is a function both of the input values as well
1619      * as the order of addition operations. The order of addition operations of this method
1620      * is intentionally not defined to allow for JVM to generate optimal machine
1621      * code for the underlying platform at runtime. If the platform supports a vector
1622      * instruction to add all values in the vector, or if there is some other efficient machine
1623      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1624      * the default implementation of adding vectors sequentially from left to right is used.
1625      * For this reason, the output of this method may vary for the same input values.
1626      *
1627      * @return the addition of all the lane elements of this vector
1628      */
1629     public abstract float addAll();
1630 
1631     /**
1632      * Adds all lane elements of this vector, selecting lane elements
1633      * controlled by a mask.
1634      * <p>
1635      * This is a vector reduction operation where the addition
1636      * operation ({@code +}) is applied to lane elements,
1637      * and the identity value is {@code 0.0}.
1638      *
1639      * <p>The value of a floating-point sum is a function both of the input values as well
1640      * as the order of addition operations. The order of addition operations of this method
1641      * is intentionally not defined to allow for JVM to generate optimal machine
1642      * code for the underlying platform at runtime. If the platform supports a vector
1643      * instruction to add all values in the vector, or if there is some other efficient machine
1644      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1645      * the default implementation of adding vectors sequentially from left to right is used.
1646      * For this reason, the output of this method may vary on the same input values.
1647      *
1648      * @param m the mask controlling lane selection
1649      * @return the addition of the selected lane elements of this vector
1650      */
1651     public abstract float addAll(VectorMask<Float> m);
1652 
1653     /**
1654      * Multiplies all lane elements of this vector.
1655      * <p>
1656      * This is a vector reduction operation where the
1657      * multiplication operation ({@code *}) is applied to lane elements,
1658      * and the identity value is {@code 1.0}.
1659      *
1660      * <p>The order of multiplication operations of this method
1661      * is intentionally not defined to allow for JVM to generate optimal machine
1662      * code for the underlying platform at runtime. If the platform supports a vector
1663      * instruction to multiply all values in the vector, or if there is some other efficient machine
1664      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1665      * the default implementation of multiplying vectors sequentially from left to right is used.
1666      * For this reason, the output of this method may vary on the same input values.
1667      *
1668      * @return the multiplication of all the lane elements of this vector
1669      */
1670     public abstract float mulAll();
1671 
1672     /**
1673      * Multiplies all lane elements of this vector, selecting lane elements
1674      * controlled by a mask.
1675      * <p>
1676      * This is a vector reduction operation where the
1677      * multiplication operation ({@code *}) is applied to lane elements,
1678      * and the identity value is {@code 1.0}.
1679      *
1680      * <p>The order of multiplication operations of this method
1681      * is intentionally not defined to allow for JVM to generate optimal machine
1682      * code for the underlying platform at runtime. If the platform supports a vector
1683      * instruction to multiply all values in the vector, or if there is some other efficient machine
1684      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1685      * the default implementation of multiplying vectors sequentially from left to right is used.
1686      * For this reason, the output of this method may vary on the same input values.
1687      *
1688      * @param m the mask controlling lane selection
1689      * @return the multiplication of all the lane elements of this vector
1690      */
1691     public abstract float mulAll(VectorMask<Float> m);
1692 
1693     /**
1694      * Returns the minimum lane element of this vector.
1695      * <p>
1696      * This is an associative vector reduction operation where the operation
1697      * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
1698      * and the identity value is
1699      * {@link Float#POSITIVE_INFINITY}.
1700      *
1701      * @return the minimum lane element of this vector
1702      */
1703     public abstract float minAll();
1704 
1705     /**
1706      * Returns the minimum lane element of this vector, selecting lane elements
1707      * controlled by a mask.
1708      * <p>
1709      * This is an associative vector reduction operation where the operation
1710      * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
1711      * and the identity value is
1712      * {@link Float#POSITIVE_INFINITY}.
1713      *
1714      * @param m the mask controlling lane selection
1715      * @return the minimum lane element of this vector
1716      */
1717     public abstract float minAll(VectorMask<Float> m);
1718 
1719     /**
1720      * Returns the maximum lane element of this vector.
1721      * <p>
1722      * This is an associative vector reduction operation where the operation
1723      * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
1724      * and the identity value is
1725      * {@link Float#NEGATIVE_INFINITY}.
1726      *
1727      * @return the maximum lane element of this vector
1728      */
1729     public abstract float maxAll();
1730 
1731     /**
1732      * Returns the maximum lane element of this vector, selecting lane elements
1733      * controlled by a mask.
1734      * <p>
1735      * This is an associative vector reduction operation where the operation
1736      * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
1737      * and the identity value is
1738      * {@link Float#NEGATIVE_INFINITY}.
1739      *
1740      * @param m the mask controlling lane selection
1741      * @return the maximum lane element of this vector
1742      */
1743     public abstract float maxAll(VectorMask<Float> m);
1744 
1745 
1746     // Type specific accessors
1747 
1748     /**
1749      * Gets the lane element at lane index {@code i}
1750      *
1751      * @param i the lane index
1752      * @return the lane element at lane index {@code i}
1753      * @throws IllegalArgumentException if the index is is out of range
1754      * ({@code < 0 || >= length()})
1755      */
1756     public abstract float get(int i);
1757 
1758     /**
1759      * Replaces the lane element of this vector at lane index {@code i} with
1760      * value {@code e}.
1761      * <p>
1762      * This is a cross-lane operation and behaves as if it returns the result
1763      * of blending this vector with an input vector that is the result of
1764      * broadcasting {@code e} and a mask that has only one lane set at lane
1765      * index {@code i}.
1766      *
1767      * @param i the lane index of the lane element to be replaced
1768      * @param e the value to be placed
1769      * @return the result of replacing the lane element of this vector at lane
1770      * index {@code i} with value {@code e}.
1771      * @throws IllegalArgumentException if the index is is out of range
1772      * ({@code < 0 || >= length()})
1773      */
1774     public abstract FloatVector with(int i, float e);
1775 
1776     // Type specific extractors


1783      * <pre>{@code
1784      *   float[] a = new float[this.length()];
1785      *   this.intoArray(a, 0);
1786      *   return a;
1787      * }</pre>
1788      *
1789      * @return an array containing the the lane elements of this vector
1790      */
1791     @ForceInline
1792     public final float[] toArray() {
1793         float[] a = new float[species().length()];
1794         intoArray(a, 0);
1795         return a;
1796     }
1797 
1798     /**
1799      * Stores this vector into an array starting at offset.
1800      * <p>
1801      * For each vector lane, where {@code N} is the vector lane index,
1802      * the lane element at index {@code N} is stored into the array at index
1803      * {@code i + N}.
1804      *
1805      * @param a the array
1806      * @param i the offset into the array
1807      * @throws IndexOutOfBoundsException if {@code i < 0}, or
1808      * {@code i > a.length - this.length()}
1809      */
1810     public abstract void intoArray(float[] a, int i);
1811 
1812     /**
1813      * Stores this vector into an array starting at offset and using a mask.
1814      * <p>
1815      * For each vector lane, where {@code N} is the vector lane index,
1816      * if the mask lane at index {@code N} is set then the lane element at
1817      * index {@code N} is stored into the array index {@code i + N}.
1818      *
1819      * @param a the array
1820      * @param i the offset into the array
1821      * @param m the mask
1822      * @throws IndexOutOfBoundsException if {@code i < 0}, or
1823      * for any vector lane index {@code N} where the mask at lane {@code N}
1824      * is set {@code i >= a.length - N}
1825      */
1826     public abstract void intoArray(float[] a, int i, VectorMask<Float> m);
1827 
1828     /**
1829      * Stores this vector into an array using indexes obtained from an index
1830      * map.
1831      * <p>
1832      * For each vector lane, where {@code N} is the vector lane index, the
1833      * lane element at index {@code N} is stored into the array at index
1834      * {@code i + indexMap[j + N]}.
1835      *
1836      * @param a the array
1837      * @param i the offset into the array, may be negative if relative
1838      * indexes in the index map compensate to produce a value within the
1839      * array bounds
1840      * @param indexMap the index map
1841      * @param j the offset into the index map
1842      * @throws IndexOutOfBoundsException if {@code j < 0}, or
1843      * {@code j > indexMap.length - this.length()},
1844      * or for any vector lane index {@code N} the result of
1845      * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
1846      */
1847     public abstract void intoArray(float[] a, int i, int[] indexMap, int j);
1848 
1849     /**
1850      * Stores this vector into an array using indexes obtained from an index
1851      * map and using a mask.
1852      * <p>
1853      * For each vector lane, where {@code N} is the vector lane index,
1854      * if the mask lane at index {@code N} is set then the lane element at
1855      * index {@code N} is stored into the array at index
1856      * {@code i + indexMap[j + N]}.
1857      *
1858      * @param a the array
1859      * @param i the offset into the array, may be negative if relative
1860      * indexes in the index map compensate to produce a value within the
1861      * array bounds
1862      * @param m the mask
1863      * @param indexMap the index map
1864      * @param j the offset into the index map
1865      * @throws IndexOutOfBoundsException if {@code j < 0}, or
1866      * {@code j > indexMap.length - this.length()},
1867      * or for any vector lane index {@code N} where the mask at lane
1868      * {@code N} is set the result of {@code i + indexMap[j + N]} is
1869      * {@code < 0} or {@code >= a.length}
1870      */
1871     public abstract void intoArray(float[] a, int i, VectorMask<Float> m, int[] indexMap, int j);
1872     // Species
1873 
1874     @Override
1875     public abstract VectorSpecies<Float> species();
1876 
1877     /**
1878      * Class representing {@link FloatVector}'s of the same {@link VectorShape VectorShape}.
1879      */
1880     static final class FloatSpecies extends AbstractSpecies<Float> {
1881         final Function<float[], FloatVector> vectorFactory;
1882 
1883         private FloatSpecies(VectorShape shape,
1884                           Class<?> boxType,
1885                           Class<?> maskType,
1886                           Function<float[], FloatVector> vectorFactory,
1887                           Function<boolean[], VectorMask<Float>> maskFactory,
1888                           Function<IntUnaryOperator, VectorShuffle<Float>> shuffleFromArrayFactory,
1889                           fShuffleFromArray<Float> shuffleFromOpFactory) {
1890             super(shape, float.class, Float.SIZE, boxType, maskType, maskFactory,
1891                   shuffleFromArrayFactory, shuffleFromOpFactory);




 108      *
 109      * @param species species of desired vector
 110      * @return a zero vector of given species
 111      */
 112     @ForceInline
 113     @SuppressWarnings("unchecked")
 114     public static FloatVector zero(VectorSpecies<Float> species) {
 115         return VectorIntrinsics.broadcastCoerced((Class<FloatVector>) species.boxType(), float.class, species.length(),
 116                                                  Float.floatToIntBits(0.0f), species,
 117                                                  ((bits, s) -> ((FloatSpecies)s).op(i -> Float.intBitsToFloat((int)bits))));
 118     }
 119 
 120     /**
 121      * Loads a vector from a byte array starting at an offset.
 122      * <p>
 123      * Bytes are composed into primitive lane elements according to the
 124      * native byte order of the underlying platform
 125      * <p>
 126      * This method behaves as if it returns the result of calling the
 127      * byte buffer, offset, and mask accepting
 128      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 129      * <pre>{@code
 130      * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
 131      * }</pre>
 132      *
 133      * @param species species of desired vector
 134      * @param a the byte array
 135      * @param offset the offset into the array
 136      * @return a vector loaded from a byte array
 137      * @throws IndexOutOfBoundsException if {@code i < 0} or
 138      * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)}
 139      */
 140     @ForceInline
 141     @SuppressWarnings("unchecked")
 142     public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int offset) {
 143         Objects.requireNonNull(a);
 144         offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE);
 145         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 146                                      a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
 147                                      a, offset, species,
 148                                      (c, idx, s) -> {
 149                                          ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
 150                                          FloatBuffer tb = bbc.asFloatBuffer();
 151                                          return ((FloatSpecies)s).op(i -> tb.get());
 152                                      });
 153     }
 154 
 155     /**
 156      * Loads a vector from a byte array starting at an offset and using a
 157      * mask.
 158      * <p>
 159      * Bytes are composed into primitive lane elements according to the
 160      * native byte order of the underlying platform.
 161      * <p>
 162      * This method behaves as if it returns the result of calling the
 163      * byte buffer, offset, and mask accepting
 164      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
 165      * <pre>{@code
 166      * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
 167      * }</pre>
 168      *
 169      * @param species species of desired vector
 170      * @param a the byte array
 171      * @param offset the offset into the array
 172      * @param m the mask
 173      * @return a vector loaded from a byte array
 174      * @throws IndexOutOfBoundsException if {@code offset < 0} or



 175      * for any vector lane index {@code N} where the mask at lane {@code N}
 176      * is set
 177      * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)}
 178      */
 179     @ForceInline
 180     public static FloatVector fromByteArray(VectorSpecies<Float> species, byte[] a, int offset, VectorMask<Float> m) {
 181         return zero(species).blend(fromByteArray(species, a, offset), m);
 182     }
 183 
 184     /**
 185      * Loads a vector from an array starting at offset.
 186      * <p>
 187      * For each vector lane, where {@code N} is the vector lane index, the
 188      * array element at index {@code offset + N} is placed into the
 189      * resulting vector at lane index {@code N}.
 190      *
 191      * @param species species of desired vector
 192      * @param a the array
 193      * @param offset the offset into the array
 194      * @return the vector loaded from an array
 195      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
 196      * {@code offset > a.length - species.length()}
 197      */
 198     @ForceInline
 199     @SuppressWarnings("unchecked")
 200     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int offset){
 201         Objects.requireNonNull(a);
 202         offset = VectorIntrinsics.checkIndex(offset, a.length, species.length());
 203         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 204                                      a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_FLOAT_BASE_OFFSET,
 205                                      a, offset, species,
 206                                      (c, idx, s) -> ((FloatSpecies)s).op(n -> c[idx + n]));
 207     }
 208 
 209 
 210     /**
 211      * Loads a vector from an array starting at offset and using a mask.
 212      * <p>
 213      * For each vector lane, where {@code N} is the vector lane index,
 214      * if the mask lane at index {@code N} is set then the array element at
 215      * index {@code offset + N} is placed into the resulting vector at lane index
 216      * {@code N}, otherwise the default element value is placed into the
 217      * resulting vector at lane index {@code N}.
 218      *
 219      * @param species species of desired vector
 220      * @param a the array
 221      * @param offset the offset into the array
 222      * @param m the mask
 223      * @return the vector loaded from an array
 224      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
 225      * for any vector lane index {@code N} where the mask at lane {@code N}
 226      * is set {@code offset > a.length - N}
 227      */
 228     @ForceInline
 229     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int offset, VectorMask<Float> m) {
 230         return zero(species).blend(fromArray(species, a, offset), m);
 231     }
 232 
 233     /**
 234      * Loads a vector from an array using indexes obtained from an index
 235      * map.
 236      * <p>
 237      * For each vector lane, where {@code N} is the vector lane index, the
 238      * array element at index {@code a_offset + indexMap[i_offset + N]} is placed into the
 239      * resulting vector at lane index {@code N}.
 240      *
 241      * @param species species of desired vector
 242      * @param a the array
 243      * @param a_offset the offset into the array, may be negative if relative
 244      * indexes in the index map compensate to produce a value within the
 245      * array bounds
 246      * @param indexMap the index map
 247      * @param i_offset the offset into the index map
 248      * @return the vector loaded from an array
 249      * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
 250      * {@code i_offset > indexMap.length - species.length()},
 251      * or for any vector lane index {@code N} the result of
 252      * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
 253      */
 254     @ForceInline
 255     @SuppressWarnings("unchecked")
 256     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int a_offset, int[] indexMap, int i_offset) {
 257         Objects.requireNonNull(a);
 258         Objects.requireNonNull(indexMap);
 259 
 260 
 261         // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k]
 262         IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset);
 263 
 264         vix = VectorIntrinsics.checkIndex(vix, a.length);
 265 
 266         return VectorIntrinsics.loadWithMap((Class<FloatVector>) species.boxType(), float.class, species.length(),
 267                                             IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_FLOAT_BASE_OFFSET, vix,
 268                                             a, a_offset, indexMap, i_offset, species,
 269                                             (float[] c, int idx, int[] iMap, int idy, VectorSpecies<Float> s) ->
 270                                                 ((FloatSpecies)s).op(n -> c[idx + iMap[idy+n]]));
 271         }
 272 
 273     /**
 274      * Loads a vector from an array using indexes obtained from an index
 275      * map and using a mask.
 276      * <p>
 277      * For each vector lane, where {@code N} is the vector lane index,
 278      * if the mask lane at index {@code N} is set then the array element at
 279      * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector
 280      * at lane index {@code N}.
 281      *
 282      * @param species species of desired vector
 283      * @param a the array
 284      * @param a_offset the offset into the array, may be negative if relative
 285      * indexes in the index map compensate to produce a value within the
 286      * array bounds
 287      * @param m the mask
 288      * @param indexMap the index map
 289      * @param i_offset the offset into the index map
 290      * @return the vector loaded from an array
 291      * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
 292      * {@code i_offset > indexMap.length - species.length()},
 293      * or for any vector lane index {@code N} where the mask at lane
 294      * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
 295      * {@code < 0} or {@code >= a.length}
 296      */
 297     @ForceInline
 298     @SuppressWarnings("unchecked")
 299     public static FloatVector fromArray(VectorSpecies<Float> species, float[] a, int a_offset, VectorMask<Float> m, int[] indexMap, int i_offset) {
 300         // @@@ This can result in out of bounds errors for unset mask lanes
 301         return zero(species).blend(fromArray(species, a, a_offset, indexMap, i_offset), m);
 302     }
 303 
 304 
 305     /**
 306      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 307      * offset into the byte buffer.
 308      * <p>
 309      * Bytes are composed into primitive lane elements according to the
 310      * native byte order of the underlying platform.
 311      * <p>
 312      * This method behaves as if it returns the result of calling the
 313      * byte buffer, offset, and mask accepting
 314      * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows:
 315      * <pre>{@code
 316      *   return fromByteBuffer(b, offset, VectorMask.allTrue())
 317      * }</pre>
 318      *
 319      * @param species species of desired vector
 320      * @param bb the byte buffer
 321      * @param offset the offset into the byte buffer
 322      * @return a vector loaded from a byte buffer
 323      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 324      * or {@code > b.limit()},
 325      * or if there are fewer than
 326      * {@code species.length() * species.elementSize() / Byte.SIZE} bytes
 327      * remaining in the byte buffer from the given offset
 328      */
 329     @ForceInline
 330     @SuppressWarnings("unchecked")
 331     public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int offset) {
 332         if (bb.order() != ByteOrder.nativeOrder()) {
 333             throw new IllegalArgumentException();
 334         }
 335         offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE);
 336         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 337                                      U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset,
 338                                      bb, offset, species,
 339                                      (c, idx, s) -> {
 340                                          ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
 341                                          FloatBuffer tb = bbc.asFloatBuffer();
 342                                          return ((FloatSpecies)s).op(i -> tb.get());
 343                                      });
 344     }
 345 
 346     /**
 347      * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
 348      * offset into the byte buffer and using a mask.
 349      * <p>
 350      * This method behaves as if the byte buffer is viewed as a primitive
 351      * {@link java.nio.Buffer buffer} for the primitive element type,
 352      * according to the native byte order of the underlying platform, and
 353      * the returned vector is loaded with a mask from a primitive array
 354      * obtained from the primitive buffer.
 355      * The following pseudocode expresses the behaviour, where
 356      * {@code EBuffer} is the primitive buffer type, {@code e} is the
 357      * primitive element type, and {@code ESpecies} is the primitive
 358      * species for {@code e}:
 359      * <pre>{@code
 360      * EBuffer eb = b.duplicate().
 361      *     order(ByteOrder.nativeOrder()).position(offset).
 362      *     asEBuffer();
 363      * e[] es = new e[species.length()];
 364      * for (int n = 0; n < t.length; n++) {
 365      *     if (m.isSet(n))
 366      *         es[n] = eb.get(n);
 367      * }
 368      * EVector r = EVector.fromArray(es, 0, m);
 369      * }</pre>
 370      *
 371      * @param species species of desired vector
 372      * @param bb the byte buffer
 373      * @param offset the offset into the byte buffer
 374      * @param m the mask
 375      * @return a vector loaded from a byte buffer
 376      * @throws IndexOutOfBoundsException if the offset is {@code < 0},
 377      * or {@code > b.limit()},
 378      * for any vector lane index {@code N} where the mask at lane {@code N}
 379      * is set
 380      * {@code offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)}
 381      */
 382     @ForceInline
 383     public static FloatVector fromByteBuffer(VectorSpecies<Float> species, ByteBuffer bb, int offset, VectorMask<Float> m) {
 384         return zero(species).blend(fromByteBuffer(species, bb, offset), m);
 385     }
 386 
 387     /**
 388      * Returns a vector where all lane elements are set to the primitive
 389      * value {@code e}.
 390      *
 391      * @param species species of the desired vector
 392      * @param e the value
 393      * @return a vector of vector where all lane elements are set to
 394      * the primitive value {@code e}
 395      */
 396     @ForceInline
 397     @SuppressWarnings("unchecked")
 398     public static FloatVector broadcast(VectorSpecies<Float> species, float e) {
 399         return VectorIntrinsics.broadcastCoerced(
 400             (Class<FloatVector>) species.boxType(), float.class, species.length(),
 401             Float.floatToIntBits(e), species,
 402             ((bits, sp) -> ((FloatSpecies)sp).op(i -> Float.intBitsToFloat((int)bits))));
 403     }
 404 
 405     /**
 406      * Returns a vector where each lane element is set to given
 407      * primitive values.
 408      * <p>
 409      * For each vector lane, where {@code N} is the vector lane index, the
 410      * the primitive value at index {@code N} is placed into the resulting
 411      * vector at lane index {@code N}.
 412      *
 413      * @param species species of the desired vector
 414      * @param es the given primitive values
 415      * @return a vector where each lane element is set to given primitive
 416      * values
 417      * @throws IndexOutOfBoundsException if {@code es.length < species.length()}
 418      */
 419     @ForceInline
 420     @SuppressWarnings("unchecked")
 421     public static FloatVector scalars(VectorSpecies<Float> species, float... es) {
 422         Objects.requireNonNull(es);
 423         int ix = VectorIntrinsics.checkIndex(0, es.length, species.length());
 424         return VectorIntrinsics.load((Class<FloatVector>) species.boxType(), float.class, species.length(),
 425                                      es, Unsafe.ARRAY_FLOAT_BASE_OFFSET,
 426                                      es, ix, species,
 427                                      (c, idx, sp) -> ((FloatSpecies)sp).op(n -> c[idx + n]));
 428     }
 429 
 430     /**
 431      * Returns a vector where the first lane element is set to the primtive
 432      * value {@code e}, all other lane elements are set to the default
 433      * value.
 434      *
 435      * @param species species of the desired vector
 436      * @param e the value
 437      * @return a vector where the first lane element is set to the primitive
 438      * value {@code e}
 439      */
 440     @ForceInline
 441     public static final FloatVector single(VectorSpecies<Float> species, float e) {
 442         return zero(species).with(0, e);
 443     }
 444 
 445     /**
 446      * Returns a vector where each lane element is set to a randomly
 447      * generated primitive value.
 448      *
 449      * The semantics are equivalent to calling
 450      * {@link ThreadLocalRandom#nextFloat()}
 451      *
 452      * @param species species of the desired vector
 453      * @return a vector where each lane elements is set to a randomly
 454      * generated primitive value
 455      */
 456     public static FloatVector random(VectorSpecies<Float> species) {
 457         ThreadLocalRandom r = ThreadLocalRandom.current();
 458         return ((FloatSpecies)species).op(i -> r.nextFloat());
 459     }
 460 
 461     // Ops
 462 
 463     @Override
 464     public abstract FloatVector add(Vector<Float> v);
 465 
 466     /**
 467      * Adds this vector to the broadcast of an input scalar.
 468      * <p>
 469      * This is a lane-wise binary operation which applies the primitive addition operation
 470      * ({@code +}) to each lane.
 471      *
 472      * @param s the input scalar
 473      * @return the result of adding this vector to the broadcast of an input
 474      * scalar
 475      */
 476     public abstract FloatVector add(float s);
 477 
 478     @Override
 479     public abstract FloatVector add(Vector<Float> v, VectorMask<Float> m);
 480 
 481     /**
 482      * Adds this vector to broadcast of an input scalar,
 483      * selecting lane elements controlled by a mask.
 484      * <p>
 485      * This is a lane-wise binary operation which applies the primitive addition operation
 486      * ({@code +}) to each lane.
 487      *
 488      * @param s the input scalar
 489      * @param m the mask controlling lane selection
 490      * @return the result of adding this vector to the broadcast of an input
 491      * scalar
 492      */
 493     public abstract FloatVector add(float s, VectorMask<Float> m);
 494 
 495     @Override
 496     public abstract FloatVector sub(Vector<Float> v);
 497 
 498     /**
 499      * Subtracts the broadcast of an input scalar from this vector.
 500      * <p>
 501      * This is a lane-wise binary operation which applies the primitive subtraction
 502      * operation ({@code -}) to each lane.
 503      *
 504      * @param s the input scalar
 505      * @return the result of subtracting the broadcast of an input
 506      * scalar from this vector
 507      */
 508     public abstract FloatVector sub(float s);
 509 
 510     @Override
 511     public abstract FloatVector sub(Vector<Float> v, VectorMask<Float> m);
 512 
 513     /**
 514      * Subtracts the broadcast of an input scalar from this vector, selecting
 515      * lane elements controlled by a mask.
 516      * <p>
 517      * This is a lane-wise binary operation which applies the primitive subtraction
 518      * operation ({@code -}) to each lane.
 519      *
 520      * @param s the input scalar
 521      * @param m the mask controlling lane selection
 522      * @return the result of subtracting the broadcast of an input
 523      * scalar from this vector
 524      */
 525     public abstract FloatVector sub(float s, VectorMask<Float> m);
 526 
 527     @Override
 528     public abstract FloatVector mul(Vector<Float> v);
 529 
 530     /**
 531      * Multiplies this vector with the broadcast of an input scalar.
 532      * <p>
 533      * This is a lane-wise binary operation which applies the primitive multiplication
 534      * operation ({@code *}) to each lane.
 535      *
 536      * @param s the input scalar
 537      * @return the result of multiplying this vector with the broadcast of an
 538      * input scalar
 539      */
 540     public abstract FloatVector mul(float s);
 541 
 542     @Override
 543     public abstract FloatVector mul(Vector<Float> v, VectorMask<Float> m);
 544 
 545     /**
 546      * Multiplies this vector with the broadcast of an input scalar, selecting
 547      * lane elements controlled by a mask.
 548      * <p>
 549      * This is a lane-wise binary operation which applies the primitive multiplication
 550      * operation ({@code *}) to each lane.
 551      *
 552      * @param s the input scalar
 553      * @param m the mask controlling lane selection
 554      * @return the result of multiplying this vector with the broadcast of an
 555      * input scalar
 556      */
 557     public abstract FloatVector mul(float s, VectorMask<Float> m);
 558 
 559     @Override
 560     public abstract FloatVector neg();
 561 
 562     @Override
 563     public abstract FloatVector neg(VectorMask<Float> m);
 564 
 565     @Override
 566     public abstract FloatVector abs();
 567 
 568     @Override
 569     public abstract FloatVector abs(VectorMask<Float> m);
 570 
 571     @Override
 572     public abstract FloatVector min(Vector<Float> v);
 573 
 574     @Override
 575     public abstract FloatVector min(Vector<Float> v, VectorMask<Float> m);
 576 
 577     /**
 578      * Returns the minimum of this vector and the broadcast of an input scalar.
 579      * <p>
 580      * This is a lane-wise binary operation which applies the operation
 581      * {@code (a, b) -> Math.min(a, b)} to each lane.
 582      *
 583      * @param s the input scalar
 584      * @return the minimum of this vector and the broadcast of an input scalar
 585      */
 586     public abstract FloatVector min(float s);
 587 
 588     @Override
 589     public abstract FloatVector max(Vector<Float> v);
 590 
 591     @Override
 592     public abstract FloatVector max(Vector<Float> v, VectorMask<Float> m);
 593 
 594     /**
 595      * Returns the maximum of this vector and the broadcast of an input scalar.
 596      * <p>
 597      * This is a lane-wise binary operation which applies the operation
 598      * {@code (a, b) -> Math.max(a, b)} to each lane.
 599      *
 600      * @param s the input scalar
 601      * @return the maximum of this vector and the broadcast of an input scalar
 602      */
 603     public abstract FloatVector max(float s);
 604 
 605     @Override
 606     public abstract VectorMask<Float> equal(Vector<Float> v);
 607 
 608     /**
 609      * Tests if this vector is equal to the broadcast of an input scalar.
 610      * <p>
 611      * This is a lane-wise binary test operation which applies the primitive equals
 612      * operation ({@code ==}) each lane.
 613      *
 614      * @param s the input scalar
 615      * @return the result mask of testing if this vector is equal to the
 616      * broadcast of an input scalar
 617      */
 618     public abstract VectorMask<Float> equal(float s);
 619 
 620     @Override
 621     public abstract VectorMask<Float> notEqual(Vector<Float> v);
 622 
 623     /**
 624      * Tests if this vector is not equal to the broadcast of an input scalar.
 625      * <p>
 626      * This is a lane-wise binary test operation which applies the primitive not equals
 627      * operation ({@code !=}) to each lane.
 628      *
 629      * @param s the input scalar
 630      * @return the result mask of testing if this vector is not equal to the
 631      * broadcast of an input scalar
 632      */
 633     public abstract VectorMask<Float> notEqual(float s);
 634 
 635     @Override
 636     public abstract VectorMask<Float> lessThan(Vector<Float> v);
 637 
 638     /**
 639      * Tests if this vector is less than the broadcast of an input scalar.
 640      * <p>
 641      * This is a lane-wise binary test operation which applies the primitive less than
 642      * operation ({@code <}) to each lane.
 643      *
 644      * @param s the input scalar
 645      * @return the mask result of testing if this vector is less than the
 646      * broadcast of an input scalar
 647      */
 648     public abstract VectorMask<Float> lessThan(float s);
 649 
 650     @Override
 651     public abstract VectorMask<Float> lessThanEq(Vector<Float> v);
 652 
 653     /**
 654      * Tests if this vector is less or equal to the broadcast of an input scalar.
 655      * <p>
 656      * This is a lane-wise binary test operation which applies the primitive less than
 657      * or equal to operation ({@code <=}) to each lane.
 658      *
 659      * @param s the input scalar
 660      * @return the mask result of testing if this vector is less than or equal
 661      * to the broadcast of an input scalar
 662      */
 663     public abstract VectorMask<Float> lessThanEq(float s);
 664 
 665     @Override
 666     public abstract VectorMask<Float> greaterThan(Vector<Float> v);
 667 
 668     /**
 669      * Tests if this vector is greater than the broadcast of an input scalar.
 670      * <p>
 671      * This is a lane-wise binary test operation which applies the primitive greater than
 672      * operation ({@code >}) to each lane.
 673      *
 674      * @param s the input scalar
 675      * @return the mask result of testing if this vector is greater than the
 676      * broadcast of an input scalar
 677      */
 678     public abstract VectorMask<Float> greaterThan(float s);
 679 
 680     @Override
 681     public abstract VectorMask<Float> greaterThanEq(Vector<Float> v);
 682 
 683     /**
 684      * Tests if this vector is greater than or equal to the broadcast of an
 685      * input scalar.
 686      * <p>
 687      * This is a lane-wise binary test operation which applies the primitive greater than
 688      * or equal to operation ({@code >=}) to each lane.
 689      *
 690      * @param s the input scalar
 691      * @return the mask result of testing if this vector is greater than or
 692      * equal to the broadcast of an input scalar
 693      */
 694     public abstract VectorMask<Float> greaterThanEq(float s);
 695 
 696     @Override
 697     public abstract FloatVector blend(Vector<Float> v, VectorMask<Float> m);
 698 
 699     /**
 700      * Blends the lane elements of this vector with those of the broadcast of an
 701      * input scalar, selecting lanes controlled by a mask.
 702      * <p>
 703      * For each lane of the mask, at lane index {@code N}, if the mask lane
 704      * is set then the lane element at {@code N} from the input vector is
 705      * selected and placed into the resulting vector at {@code N},
 706      * otherwise the the lane element at {@code N} from this input vector is
 707      * selected and placed into the resulting vector at {@code N}.
 708      *


 721     public abstract FloatVector rearrange(VectorShuffle<Float> m);
 722 
 723     @Override
 724     public abstract FloatVector reshape(VectorSpecies<Float> s);
 725 
 726     @Override
 727     public abstract FloatVector rotateEL(int i);
 728 
 729     @Override
 730     public abstract FloatVector rotateER(int i);
 731 
 732     @Override
 733     public abstract FloatVector shiftEL(int i);
 734 
 735     @Override
 736     public abstract FloatVector shiftER(int i);
 737 
 738     /**
 739      * Divides this vector by an input vector.
 740      * <p>
 741      * This is a lane-wise binary operation which applies the primitive division
 742      * operation ({@code /}) to each lane.
 743      *
 744      * @param v the input vector
 745      * @return the result of dividing this vector by the input vector
 746      */
 747     public abstract FloatVector div(Vector<Float> v);
 748 
 749     /**
 750      * Divides this vector by the broadcast of an input scalar.
 751      * <p>
 752      * This is a lane-wise binary operation which applies the primitive division
 753      * operation ({@code /}) to each lane.
 754      *
 755      * @param s the input scalar
 756      * @return the result of dividing this vector by the broadcast of an input
 757      * scalar
 758      */
 759     public abstract FloatVector div(float s);
 760 
 761     /**
 762      * Divides this vector by an input vector, selecting lane elements
 763      * controlled by a mask.
 764      * <p>
 765      * This is a lane-wise binary operation which applies the primitive division
 766      * operation ({@code /}) to each lane.
 767      *
 768      * @param v the input vector
 769      * @param m the mask controlling lane selection
 770      * @return the result of dividing this vector by the input vector
 771      */
 772     public abstract FloatVector div(Vector<Float> v, VectorMask<Float> m);
 773 
 774     /**
 775      * Divides this vector by the broadcast of an input scalar, selecting lane
 776      * elements controlled by a mask.
 777      * <p>
 778      * This is a lane-wise binary operation which applies the primitive division
 779      * operation ({@code /}) to each lane.
 780      *
 781      * @param s the input scalar
 782      * @param m the mask controlling lane selection
 783      * @return the result of dividing this vector by the broadcast of an input
 784      * scalar
 785      */
 786     public abstract FloatVector div(float s, VectorMask<Float> m);
 787 
 788     /**
 789      * Calculates the square root of this vector.
 790      * <p>
 791      * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation
 792      * to each lane.
 793      *
 794      * @return the square root of this vector
 795      */
 796     public abstract FloatVector sqrt();
 797 
 798     /**
 799      * Calculates the square root of this vector, selecting lane elements
 800      * controlled by a mask.
 801      * <p>
 802      * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation
 803      * to each lane.
 804      *
 805      * @param m the mask controlling lane selection
 806      * @return the square root of this vector
 807      */
 808     public FloatVector sqrt(VectorMask<Float> m) {
 809         return uOp(m, (i, a) -> (float) Math.sqrt((double) a));
 810     }
 811 
 812     /**
 813      * Calculates the trigonometric tangent of this vector.
 814      * <p>
 815      * This is a lane-wise unary operation with same semantic definition as
 816      * {@link Math#tan} operation applied to each lane.
 817      * The implementation is not required to return same
 818      * results as {@link Math#tan}, but adheres to rounding, monotonicity,
 819      * and special case semantics as defined in the {@link Math#tan}
 820      * specifications. The computed result will be within 1 ulp of the
 821      * exact result.
 822      *
 823      * @return the tangent of this vector
 824      */
 825     public FloatVector tan() {
 826         return uOp((i, a) -> (float) Math.tan((double) a));
 827     }
 828 
 829     /**
 830      * Calculates the trigonometric tangent of this vector, selecting lane
 831      * elements controlled by a mask.
 832      * <p>
 833      * Semantics for rounding, monotonicity, and special cases are
 834      * described in {@link FloatVector#tan}
 835      *
 836      * @param m the mask controlling lane selection
 837      * @return the tangent of this vector
 838      */
 839     public FloatVector tan(VectorMask<Float> m) {
 840         return uOp(m, (i, a) -> (float) Math.tan((double) a));
 841     }
 842 
 843     /**
 844      * Calculates the hyperbolic tangent of this vector.
 845      * <p>
 846      * This is a lane-wise unary operation with same semantic definition as
 847      * {@link Math#tanh} operation applied to each lane.
 848      * The implementation is not required to return same
 849      * results as {@link Math#tanh}, but adheres to rounding, monotonicity,
 850      * and special case semantics as defined in the {@link Math#tanh}
 851      * specifications. The computed result will be within 2.5 ulps of the
 852      * exact result.
 853      *
 854      * @return the hyperbolic tangent of this vector
 855      */
 856     public FloatVector tanh() {
 857         return uOp((i, a) -> (float) Math.tanh((double) a));
 858     }
 859 
 860     /**
 861      * Calculates the hyperbolic tangent of this vector, selecting lane elements
 862      * controlled by a mask.
 863      * <p>
 864      * Semantics for rounding, monotonicity, and special cases are
 865      * described in {@link FloatVector#tanh}
 866      *
 867      * @param m the mask controlling lane selection
 868      * @return the hyperbolic tangent of this vector
 869      */
 870     public FloatVector tanh(VectorMask<Float> m) {
 871         return uOp(m, (i, a) -> (float) Math.tanh((double) a));
 872     }
 873 
 874     /**
 875      * Calculates the trigonometric sine of this vector.
 876      * <p>
 877      * This is a lane-wise unary operation with same semantic definition as
 878      * {@link Math#sin} operation applied to each lane.
 879      * The implementation is not required to return same
 880      * results as {@link Math#sin}, but adheres to rounding, monotonicity,
 881      * and special case semantics as defined in the {@link Math#sin}
 882      * specifications. The computed result will be within 1 ulp of the
 883      * exact result.
 884      *
 885      * @return the sine of this vector
 886      */
 887     public FloatVector sin() {
 888         return uOp((i, a) -> (float) Math.sin((double) a));
 889     }
 890 
 891     /**
 892      * Calculates the trigonometric sine of this vector, selecting lane elements
 893      * controlled by a mask.
 894      * <p>
 895      * Semantics for rounding, monotonicity, and special cases are
 896      * described in {@link FloatVector#sin}
 897      *
 898      * @param m the mask controlling lane selection
 899      * @return the sine of this vector
 900      */
 901     public FloatVector sin(VectorMask<Float> m) {
 902         return uOp(m, (i, a) -> (float) Math.sin((double) a));
 903     }
 904 
 905     /**
 906      * Calculates the hyperbolic sine of this vector.
 907      * <p>
 908      * This is a lane-wise unary operation with same semantic definition as
 909      * {@link Math#sinh} operation applied to each lane.
 910      * The implementation is not required to return same
 911      * results as  {@link Math#sinh}, but adheres to rounding, monotonicity,
 912      * and special case semantics as defined in the {@link Math#sinh}
 913      * specifications. The computed result will be within 2.5 ulps of the
 914      * exact result.
 915      *
 916      * @return the hyperbolic sine of this vector
 917      */
 918     public FloatVector sinh() {
 919         return uOp((i, a) -> (float) Math.sinh((double) a));
 920     }
 921 
 922     /**
 923      * Calculates the hyperbolic sine of this vector, selecting lane elements
 924      * controlled by a mask.
 925      * <p>
 926      * Semantics for rounding, monotonicity, and special cases are
 927      * described in {@link FloatVector#sinh}
 928      *
 929      * @param m the mask controlling lane selection
 930      * @return the hyperbolic sine of this vector
 931      */
 932     public FloatVector sinh(VectorMask<Float> m) {
 933         return uOp(m, (i, a) -> (float) Math.sinh((double) a));
 934     }
 935 
 936     /**
 937      * Calculates the trigonometric cosine of this vector.
 938      * <p>
 939      * This is a lane-wise unary operation with same semantic definition as
 940      * {@link Math#cos} operation applied to each lane.
 941      * The implementation is not required to return same
 942      * results as {@link Math#cos}, but adheres to rounding, monotonicity,
 943      * and special case semantics as defined in the {@link Math#cos}
 944      * specifications. The computed result will be within 1 ulp of the
 945      * exact result.
 946      *
 947      * @return the cosine of this vector
 948      */
 949     public FloatVector cos() {
 950         return uOp((i, a) -> (float) Math.cos((double) a));
 951     }
 952 
 953     /**
 954      * Calculates the trigonometric cosine of this vector, selecting lane
 955      * elements controlled by a mask.
 956      * <p>
 957      * Semantics for rounding, monotonicity, and special cases are
 958      * described in {@link FloatVector#cos}
 959      *
 960      * @param m the mask controlling lane selection
 961      * @return the cosine of this vector
 962      */
 963     public FloatVector cos(VectorMask<Float> m) {
 964         return uOp(m, (i, a) -> (float) Math.cos((double) a));
 965     }
 966 
 967     /**
 968      * Calculates the hyperbolic cosine of this vector.
 969      * <p>
 970      * This is a lane-wise unary operation with same semantic definition as
 971      * {@link Math#cosh} operation applied to each lane.
 972      * The implementation is not required to return same
 973      * results as {@link Math#cosh}, but adheres to rounding, monotonicity,
 974      * and special case semantics as defined in the {@link Math#cosh}
 975      * specifications. The computed result will be within 2.5 ulps of the
 976      * exact result.
 977      *
 978      * @return the hyperbolic cosine of this vector
 979      */
 980     public FloatVector cosh() {
 981         return uOp((i, a) -> (float) Math.cosh((double) a));
 982     }
 983 
 984     /**
 985      * Calculates the hyperbolic cosine of this vector, selecting lane elements
 986      * controlled by a mask.
 987      * <p>
 988      * Semantics for rounding, monotonicity, and special cases are
 989      * described in {@link FloatVector#cosh}
 990      *
 991      * @param m the mask controlling lane selection
 992      * @return the hyperbolic cosine of this vector
 993      */
 994     public FloatVector cosh(VectorMask<Float> m) {
 995         return uOp(m, (i, a) -> (float) Math.cosh((double) a));
 996     }
 997 
 998     /**
 999      * Calculates the arc sine of this vector.
1000      * <p>
1001      * This is a lane-wise unary operation with same semantic definition as
1002      * {@link Math#asin} operation applied to each lane.
1003      * The implementation is not required to return same
1004      * results as {@link Math#asin}, but adheres to rounding, monotonicity,
1005      * and special case semantics as defined in the {@link Math#asin}
1006      * specifications. The computed result will be within 1 ulp of the
1007      * exact result.
1008      *
1009      * @return the arc sine of this vector
1010      */
1011     public FloatVector asin() {
1012         return uOp((i, a) -> (float) Math.asin((double) a));
1013     }
1014 
1015     /**
1016      * Calculates the arc sine of this vector, selecting lane elements
1017      * controlled by a mask.
1018      * <p>
1019      * Semantics for rounding, monotonicity, and special cases are
1020      * described in {@link FloatVector#asin}
1021      *
1022      * @param m the mask controlling lane selection
1023      * @return the arc sine of this vector
1024      */
1025     public FloatVector asin(VectorMask<Float> m) {
1026         return uOp(m, (i, a) -> (float) Math.asin((double) a));
1027     }
1028 
1029     /**
1030      * Calculates the arc cosine of this vector.
1031      * <p>
1032      * This is a lane-wise unary operation with same semantic definition as
1033      * {@link Math#acos} operation applied to each lane.
1034      * The implementation is not required to return same
1035      * results as {@link Math#acos}, but adheres to rounding, monotonicity,
1036      * and special case semantics as defined in the {@link Math#acos}
1037      * specifications. The computed result will be within 1 ulp of the
1038      * exact result.
1039      *
1040      * @return the arc cosine of this vector
1041      */
1042     public FloatVector acos() {
1043         return uOp((i, a) -> (float) Math.acos((double) a));
1044     }
1045 
1046     /**
1047      * Calculates the arc cosine of this vector, selecting lane elements
1048      * controlled by a mask.
1049      * <p>
1050      * Semantics for rounding, monotonicity, and special cases are
1051      * described in {@link FloatVector#acos}
1052      *
1053      * @param m the mask controlling lane selection
1054      * @return the arc cosine of this vector
1055      */
1056     public FloatVector acos(VectorMask<Float> m) {
1057         return uOp(m, (i, a) -> (float) Math.acos((double) a));
1058     }
1059 
1060     /**
1061      * Calculates the arc tangent of this vector.
1062      * <p>
1063      * This is a lane-wise unary operation with same semantic definition as
1064      * {@link Math#atan} operation applied to each lane.
1065      * The implementation is not required to return same
1066      * results as {@link Math#atan}, but adheres to rounding, monotonicity,
1067      * and special case semantics as defined in the {@link Math#atan}
1068      * specifications. The computed result will be within 1 ulp of the
1069      * exact result.
1070      *
1071      * @return the arc tangent of this vector
1072      */
1073     public FloatVector atan() {
1074         return uOp((i, a) -> (float) Math.atan((double) a));
1075     }
1076 
1077     /**
1078      * Calculates the arc tangent of this vector, selecting lane elements
1079      * controlled by a mask.
1080      * <p>
1081      * Semantics for rounding, monotonicity, and special cases are
1082      * described in {@link FloatVector#atan}
1083      *
1084      * @param m the mask controlling lane selection
1085      * @return the arc tangent of this vector
1086      */
1087     public FloatVector atan(VectorMask<Float> m) {
1088         return uOp(m, (i, a) -> (float) Math.atan((double) a));
1089     }
1090 
1091     /**
1092      * Calculates the arc tangent of this vector divided by an input vector.
1093      * <p>
1094      * This is a lane-wise binary operation with same semantic definition as
1095      * {@link Math#atan2} operation applied to each lane.
1096      * The implementation is not required to return same
1097      * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1098      * and special case semantics as defined in the {@link Math#atan2}
1099      * specifications. The computed result will be within 2 ulps of the
1100      * exact result.
1101      *
1102      * @param v the input vector
1103      * @return the arc tangent of this vector divided by the input vector
1104      */
1105     public FloatVector atan2(Vector<Float> v) {
1106         return bOp(v, (i, a, b) -> (float) Math.atan2((double) a, (double) b));
1107     }
1108 
1109     /**
1110      * Calculates the arc tangent of this vector divided by the broadcast of an
1111      * an input scalar.
1112      * <p>
1113      * This is a lane-wise binary operation with same semantic definition as
1114      * {@link Math#atan2} operation applied to each lane.
1115      * The implementation is not required to return same
1116      * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1117      * and special case semantics as defined in the {@link Math#atan2}
1118      * specifications. The computed result will be within 1 ulp of the
1119      * exact result.
1120      *
1121      * @param s the input scalar
1122      * @return the arc tangent of this vector over the input vector
1123      */
1124     public abstract FloatVector atan2(float s);
1125 
1126     /**
1127      * Calculates the arc tangent of this vector divided by an input vector,
1128      * selecting lane elements controlled by a mask.
1129      * <p>
1130      * Semantics for rounding, monotonicity, and special cases are
1131      * described in {@link FloatVector#atan2}
1132      *
1133      * @param v the input vector
1134      * @param m the mask controlling lane selection


1137     public FloatVector atan2(Vector<Float> v, VectorMask<Float> m) {
1138         return bOp(v, m, (i, a, b) -> (float) Math.atan2((double) a, (double) b));
1139     }
1140 
1141     /**
1142      * Calculates the arc tangent of this vector divided by the broadcast of an
1143      * an input scalar, selecting lane elements controlled by a mask.
1144      * <p>
1145      * Semantics for rounding, monotonicity, and special cases are
1146      * described in {@link FloatVector#atan2}
1147      *
1148      * @param s the input scalar
1149      * @param m the mask controlling lane selection
1150      * @return the arc tangent of this vector over the input vector
1151      */
1152     public abstract FloatVector atan2(float s, VectorMask<Float> m);
1153 
1154     /**
1155      * Calculates the cube root of this vector.
1156      * <p>
1157      * This is a lane-wise unary operation with same semantic definition as
1158      * {@link Math#cbrt} operation applied to each lane.
1159      * The implementation is not required to return same
1160      * results as {@link Math#cbrt}, but adheres to rounding, monotonicity,
1161      * and special case semantics as defined in the {@link Math#cbrt}
1162      * specifications. The computed result will be within 1 ulp of the
1163      * exact result.
1164      *
1165      * @return the cube root of this vector
1166      */
1167     public FloatVector cbrt() {
1168         return uOp((i, a) -> (float) Math.cbrt((double) a));
1169     }
1170 
1171     /**
1172      * Calculates the cube root of this vector, selecting lane elements
1173      * controlled by a mask.
1174      * <p>
1175      * Semantics for rounding, monotonicity, and special cases are
1176      * described in {@link FloatVector#cbrt}
1177      *
1178      * @param m the mask controlling lane selection
1179      * @return the cube root of this vector
1180      */
1181     public FloatVector cbrt(VectorMask<Float> m) {
1182         return uOp(m, (i, a) -> (float) Math.cbrt((double) a));
1183     }
1184 
1185     /**
1186      * Calculates the natural logarithm of this vector.
1187      * <p>
1188      * This is a lane-wise unary operation with same semantic definition as
1189      * {@link Math#log} operation applied to each lane.
1190      * The implementation is not required to return same
1191      * results as {@link Math#log}, but adheres to rounding, monotonicity,
1192      * and special case semantics as defined in the {@link Math#log}
1193      * specifications. The computed result will be within 1 ulp of the
1194      * exact result.
1195      *
1196      * @return the natural logarithm of this vector
1197      */
1198     public FloatVector log() {
1199         return uOp((i, a) -> (float) Math.log((double) a));
1200     }
1201 
1202     /**
1203      * Calculates the natural logarithm of this vector, selecting lane elements
1204      * controlled by a mask.
1205      * <p>
1206      * Semantics for rounding, monotonicity, and special cases are
1207      * described in {@link FloatVector#log}
1208      *
1209      * @param m the mask controlling lane selection
1210      * @return the natural logarithm of this vector
1211      */
1212     public FloatVector log(VectorMask<Float> m) {
1213         return uOp(m, (i, a) -> (float) Math.log((double) a));
1214     }
1215 
1216     /**
1217      * Calculates the base 10 logarithm of this vector.
1218      * <p>
1219      * This is a lane-wise unary operation with same semantic definition as
1220      * {@link Math#log10} operation applied to each lane.
1221      * The implementation is not required to return same
1222      * results as {@link Math#log10}, but adheres to rounding, monotonicity,
1223      * and special case semantics as defined in the {@link Math#log10}
1224      * specifications. The computed result will be within 1 ulp of the
1225      * exact result.
1226      *
1227      * @return the base 10 logarithm of this vector
1228      */
1229     public FloatVector log10() {
1230         return uOp((i, a) -> (float) Math.log10((double) a));
1231     }
1232 
1233     /**
1234      * Calculates the base 10 logarithm of this vector, selecting lane elements
1235      * controlled by a mask.
1236      * <p>
1237      * Semantics for rounding, monotonicity, and special cases are
1238      * described in {@link FloatVector#log10}
1239      *
1240      * @param m the mask controlling lane selection
1241      * @return the base 10 logarithm of this vector
1242      */
1243     public FloatVector log10(VectorMask<Float> m) {
1244         return uOp(m, (i, a) -> (float) Math.log10((double) a));
1245     }
1246 
1247     /**
1248      * Calculates the natural logarithm of the sum of this vector and the
1249      * broadcast of {@code 1}.
1250      * <p>
1251      * This is a lane-wise unary operation with same semantic definition as
1252      * {@link Math#log1p} operation applied to each lane.
1253      * The implementation is not required to return same
1254      * results as  {@link Math#log1p}, but adheres to rounding, monotonicity,
1255      * and special case semantics as defined in the {@link Math#log1p}
1256      * specifications. The computed result will be within 1 ulp of the
1257      * exact result.
1258      *
1259      * @return the natural logarithm of the sum of this vector and the broadcast
1260      * of {@code 1}
1261      */
1262     public FloatVector log1p() {
1263         return uOp((i, a) -> (float) Math.log1p((double) a));
1264     }
1265 
1266     /**
1267      * Calculates the natural logarithm of the sum of this vector and the
1268      * broadcast of {@code 1}, selecting lane elements controlled by a mask.
1269      * <p>
1270      * Semantics for rounding, monotonicity, and special cases are
1271      * described in {@link FloatVector#log1p}
1272      *
1273      * @param m the mask controlling lane selection
1274      * @return the natural logarithm of the sum of this vector and the broadcast
1275      * of {@code 1}
1276      */
1277     public FloatVector log1p(VectorMask<Float> m) {
1278         return uOp(m, (i, a) -> (float) Math.log1p((double) a));
1279     }
1280 
1281     /**
1282      * Calculates this vector raised to the power of an input vector.
1283      * <p>
1284      * This is a lane-wise binary operation with same semantic definition as
1285      * {@link Math#pow} operation applied to each lane.
1286      * The implementation is not required to return same
1287      * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1288      * and special case semantics as defined in the {@link Math#pow}
1289      * specifications. The computed result will be within 1 ulp of the
1290      * exact result.
1291      *
1292      * @param v the input vector
1293      * @return this vector raised to the power of an input vector
1294      */
1295     public FloatVector pow(Vector<Float> v) {
1296         return bOp(v, (i, a, b) -> (float) Math.pow((double) a, (double) b));
1297     }
1298 
1299     /**
1300      * Calculates this vector raised to the power of the broadcast of an input
1301      * scalar.
1302      * <p>
1303      * This is a lane-wise binary operation with same semantic definition as
1304      * {@link Math#pow} operation applied to each lane.
1305      * The implementation is not required to return same
1306      * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1307      * and special case semantics as defined in the {@link Math#pow}
1308      * specifications. The computed result will be within 1 ulp of the
1309      * exact result.
1310      *
1311      * @param s the input scalar
1312      * @return this vector raised to the power of the broadcast of an input
1313      * scalar.
1314      */
1315     public abstract FloatVector pow(float s);
1316 
1317     /**
1318      * Calculates this vector raised to the power of an input vector, selecting
1319      * lane elements controlled by a mask.
1320      * <p>
1321      * Semantics for rounding, monotonicity, and special cases are
1322      * described in {@link FloatVector#pow}
1323      *
1324      * @param v the input vector


1330     }
1331 
1332     /**
1333      * Calculates this vector raised to the power of the broadcast of an input
1334      * scalar, selecting lane elements controlled by a mask.
1335      * <p>
1336      * Semantics for rounding, monotonicity, and special cases are
1337      * described in {@link FloatVector#pow}
1338      *
1339      * @param s the input scalar
1340      * @param m the mask controlling lane selection
1341      * @return this vector raised to the power of the broadcast of an input
1342      * scalar.
1343      */
1344     public abstract FloatVector pow(float s, VectorMask<Float> m);
1345 
1346     /**
1347      * Calculates the broadcast of Euler's number {@code e} raised to the power
1348      * of this vector.
1349      * <p>
1350      * This is a lane-wise unary operation with same semantic definition as
1351      * {@link Math#exp} operation applied to each lane.
1352      * The implementation is not required to return same
1353      * results as {@link Math#exp}, but adheres to rounding, monotonicity,
1354      * and special case semantics as defined in the {@link Math#exp}
1355      * specifications. The computed result will be within 1 ulp of the
1356      * exact result.
1357      *
1358      * @return the broadcast of Euler's number {@code e} raised to the power of
1359      * this vector
1360      */
1361     public FloatVector exp() {
1362         return uOp((i, a) -> (float) Math.exp((double) a));
1363     }
1364 
1365     /**
1366      * Calculates the broadcast of Euler's number {@code e} raised to the power
1367      * of this vector, selecting lane elements controlled by a mask.
1368      * <p>
1369      * Semantics for rounding, monotonicity, and special cases are
1370      * described in {@link FloatVector#exp}
1371      *
1372      * @param m the mask controlling lane selection
1373      * @return the broadcast of Euler's number {@code e} raised to the power of
1374      * this vector
1375      */
1376     public FloatVector exp(VectorMask<Float> m) {
1377         return uOp(m, (i, a) -> (float) Math.exp((double) a));
1378     }
1379 
1380     /**
1381      * Calculates the broadcast of Euler's number {@code e} raised to the power
1382      * of this vector minus the broadcast of {@code -1}.
1383      * More specifically as if the following (ignoring any differences in
1384      * numerical accuracy):
1385      * <pre>{@code
1386      *   this.exp().sub(EVector.broadcast(this.species(), 1))
1387      * }</pre>
1388      * <p>
1389      * This is a lane-wise unary operation with same semantic definition as
1390      * {@link Math#expm1} operation applied to each lane.
1391      * The implementation is not required to return same
1392      * results as {@link Math#expm1}, but adheres to rounding, monotonicity,
1393      * and special case semantics as defined in the {@link Math#expm1}
1394      * specifications. The computed result will be within 1 ulp of the
1395      * exact result.
1396      *
1397      * @return the broadcast of Euler's number {@code e} raised to the power of
1398      * this vector minus the broadcast of {@code -1}
1399      */
1400     public FloatVector expm1() {
1401         return uOp((i, a) -> (float) Math.expm1((double) a));
1402     }
1403 
1404     /**
1405      * Calculates the broadcast of Euler's number {@code e} raised to the power
1406      * of this vector minus the broadcast of {@code -1}, selecting lane elements
1407      * controlled by a mask
1408      * More specifically as if the following (ignoring any differences in
1409      * numerical accuracy):
1410      * <pre>{@code
1411      *   this.exp(m).sub(EVector.broadcast(this.species(), 1), m)
1412      * }</pre>
1413      * <p>
1414      * Semantics for rounding, monotonicity, and special cases are
1415      * described in {@link FloatVector#expm1}
1416      *
1417      * @param m the mask controlling lane selection
1418      * @return the broadcast of Euler's number {@code e} raised to the power of
1419      * this vector minus the broadcast of {@code -1}
1420      */
1421     public FloatVector expm1(VectorMask<Float> m) {
1422         return uOp(m, (i, a) -> (float) Math.expm1((double) a));
1423     }
1424 
1425     /**
1426      * Calculates the product of this vector and a first input vector summed
1427      * with a second input vector.
1428      * More specifically as if the following (ignoring any differences in
1429      * numerical accuracy):
1430      * <pre>{@code
1431      *   this.mul(v1).add(v2)
1432      * }</pre>
1433      * <p>
1434      * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1435      * to each lane.
1436      *
1437      * @param v1 the first input vector
1438      * @param v2 the second input vector
1439      * @return the product of this vector and the first input vector summed with
1440      * the second input vector
1441      */
1442     public abstract FloatVector fma(Vector<Float> v1, Vector<Float> v2);
1443 
1444     /**
1445      * Calculates the product of this vector and the broadcast of a first input
1446      * scalar summed with the broadcast of a second input scalar.
1447      * More specifically as if the following:
1448      * <pre>{@code
1449      *   this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2))
1450      * }</pre>
1451      * <p>
1452      * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1453      * to each lane.
1454      *
1455      * @param s1 the first input scalar
1456      * @param s2 the second input scalar
1457      * @return the product of this vector and the broadcast of a first input
1458      * scalar summed with the broadcast of a second input scalar
1459      */
1460     public abstract FloatVector fma(float s1, float s2);
1461 
1462     /**
1463      * Calculates the product of this vector and a first input vector summed
1464      * with a second input vector, selecting lane elements controlled by a mask.
1465      * More specifically as if the following (ignoring any differences in
1466      * numerical accuracy):
1467      * <pre>{@code
1468      *   this.mul(v1, m).add(v2, m)
1469      * }</pre>
1470      * <p>
1471      * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1472      * to each lane.
1473      *
1474      * @param v1 the first input vector
1475      * @param v2 the second input vector
1476      * @param m the mask controlling lane selection
1477      * @return the product of this vector and the first input vector summed with
1478      * the second input vector
1479      */
1480     public FloatVector fma(Vector<Float> v1, Vector<Float> v2, VectorMask<Float> m) {
1481         return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
1482     }
1483 
1484     /**
1485      * Calculates the product of this vector and the broadcast of a first input
1486      * scalar summed with the broadcast of a second input scalar, selecting lane
1487      * elements controlled by a mask
1488      * More specifically as if the following:
1489      * <pre>{@code
1490      *   this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2), m)
1491      * }</pre>
1492      * <p>
1493      * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1494      * to each lane.
1495      *
1496      * @param s1 the first input scalar
1497      * @param s2 the second input scalar
1498      * @param m the mask controlling lane selection
1499      * @return the product of this vector and the broadcast of a first input
1500      * scalar summed with the broadcast of a second input scalar
1501      */
1502     public abstract FloatVector fma(float s1, float s2, VectorMask<Float> m);
1503 
1504     /**
1505      * Calculates square root of the sum of the squares of this vector and an
1506      * input vector.
1507      * More specifically as if the following (ignoring any differences in
1508      * numerical accuracy):
1509      * <pre>{@code
1510      *   this.mul(this).add(v.mul(v)).sqrt()
1511      * }</pre>
1512      * <p>
1513      * This is a lane-wise binary operation with same semantic definition as
1514      * {@link Math#hypot} operation applied to each lane.
1515      * The implementation is not required to return same
1516      * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1517      * and special case semantics as defined in the {@link Math#hypot}
1518      * specifications. The computed result will be within 1 ulp of the
1519      * exact result.
1520      *
1521      * @param v the input vector
1522      * @return square root of the sum of the squares of this vector and an input
1523      * vector
1524      */
1525     public FloatVector hypot(Vector<Float> v) {
1526         return bOp(v, (i, a, b) -> (float) Math.hypot((double) a, (double) b));
1527     }
1528 
1529     /**
1530      * Calculates square root of the sum of the squares of this vector and the
1531      * broadcast of an input scalar.
1532      * More specifically as if the following (ignoring any differences in
1533      * numerical accuracy):
1534      * <pre>{@code
1535      *   this.mul(this).add(EVector.broadcast(this.species(), s * s)).sqrt()
1536      * }</pre>
1537      * <p>
1538      * This is a lane-wise binary operation with same semantic definition as
1539      * {@link Math#hypot} operation applied to each.
1540      * The implementation is not required to return same
1541      * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1542      * and special case semantics as defined in the {@link Math#hypot}
1543      * specifications. The computed result will be within 1 ulp of the
1544      * exact result.
1545      *
1546      * @param s the input scalar
1547      * @return square root of the sum of the squares of this vector and the
1548      * broadcast of an input scalar
1549      */
1550     public abstract FloatVector hypot(float s);
1551 
1552     /**
1553      * Calculates square root of the sum of the squares of this vector and an
1554      * input vector, selecting lane elements controlled by a mask.
1555      * More specifically as if the following (ignoring any differences in
1556      * numerical accuracy):
1557      * <pre>{@code
1558      *   this.mul(this, m).add(v.mul(v), m).sqrt(m)
1559      * }</pre>
1560      * <p>
1561      * Semantics for rounding, monotonicity, and special cases are
1562      * described in {@link FloatVector#hypot}
1563      *
1564      * @param v the input vector
1565      * @param m the mask controlling lane selection
1566      * @return square root of the sum of the squares of this vector and an input
1567      * vector
1568      */
1569     public FloatVector hypot(Vector<Float> v, VectorMask<Float> m) {
1570         return bOp(v, m, (i, a, b) -> (float) Math.hypot((double) a, (double) b));
1571     }
1572 
1573     /**
1574      * Calculates square root of the sum of the squares of this vector and the
1575      * broadcast of an input scalar, selecting lane elements controlled by a
1576      * mask.
1577      * More specifically as if the following (ignoring any differences in
1578      * numerical accuracy):
1579      * <pre>{@code
1580      *   this.mul(this, m).add(EVector.broadcast(this.species(), s * s), m).sqrt(m)
1581      * }</pre>
1582      * <p>
1583      * Semantics for rounding, monotonicity, and special cases are
1584      * described in {@link FloatVector#hypot}
1585      *
1586      * @param s the input scalar
1587      * @param m the mask controlling lane selection
1588      * @return square root of the sum of the squares of this vector and the
1589      * broadcast of an input scalar
1590      */
1591     public abstract FloatVector hypot(float s, VectorMask<Float> m);
1592 
1593 
1594     @Override
1595     public abstract void intoByteArray(byte[] a, int ix);
1596 
1597     @Override
1598     public abstract void intoByteArray(byte[] a, int ix, VectorMask<Float> m);
1599 
1600     @Override
1601     public abstract void intoByteBuffer(ByteBuffer bb, int ix);
1602 
1603     @Override
1604     public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<Float> m);
1605 
1606 
1607     // Type specific horizontal reductions
1608     /**
1609      * Adds all lane elements of this vector.
1610      * <p>
1611      * This is a cross-lane reduction operation which applies the addition
1612      * operation ({@code +}) to lane elements,
1613      * and the identity value is {@code 0.0}.
1614      *
1615      * <p>The value of a floating-point sum is a function both of the input values as well
1616      * as the order of addition operations. The order of addition operations of this method
1617      * is intentionally not defined to allow for JVM to generate optimal machine
1618      * code for the underlying platform at runtime. If the platform supports a vector
1619      * instruction to add all values in the vector, or if there is some other efficient machine
1620      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1621      * the default implementation of adding vectors sequentially from left to right is used.
1622      * For this reason, the output of this method may vary for the same input values.
1623      *
1624      * @return the addition of all the lane elements of this vector
1625      */
1626     public abstract float addAll();
1627 
1628     /**
1629      * Adds all lane elements of this vector, selecting lane elements
1630      * controlled by a mask.
1631      * <p>
1632      * This is a cross-lane reduction operation which applies the addition
1633      * operation ({@code +}) to lane elements,
1634      * and the identity value is {@code 0.0}.
1635      *
1636      * <p>The value of a floating-point sum is a function both of the input values as well
1637      * as the order of addition operations. The order of addition operations of this method
1638      * is intentionally not defined to allow for JVM to generate optimal machine
1639      * code for the underlying platform at runtime. If the platform supports a vector
1640      * instruction to add all values in the vector, or if there is some other efficient machine
1641      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1642      * the default implementation of adding vectors sequentially from left to right is used.
1643      * For this reason, the output of this method may vary on the same input values.
1644      *
1645      * @param m the mask controlling lane selection
1646      * @return the addition of the selected lane elements of this vector
1647      */
1648     public abstract float addAll(VectorMask<Float> m);
1649 
1650     /**
1651      * Multiplies all lane elements of this vector.
1652      * <p>
1653      * This is a cross-lane reduction operation which applies the
1654      * multiplication operation ({@code *}) to lane elements,
1655      * and the identity value is {@code 1.0}.
1656      *
1657      * <p>The order of multiplication operations of this method
1658      * is intentionally not defined to allow for JVM to generate optimal machine
1659      * code for the underlying platform at runtime. If the platform supports a vector
1660      * instruction to multiply all values in the vector, or if there is some other efficient machine
1661      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1662      * the default implementation of multiplying vectors sequentially from left to right is used.
1663      * For this reason, the output of this method may vary on the same input values.
1664      *
1665      * @return the multiplication of all the lane elements of this vector
1666      */
1667     public abstract float mulAll();
1668 
1669     /**
1670      * Multiplies all lane elements of this vector, selecting lane elements
1671      * controlled by a mask.
1672      * <p>
1673      * This is a cross-lane reduction operation which applies the
1674      * multiplication operation ({@code *}) to lane elements,
1675      * and the identity value is {@code 1.0}.
1676      *
1677      * <p>The order of multiplication operations of this method
1678      * is intentionally not defined to allow for JVM to generate optimal machine
1679      * code for the underlying platform at runtime. If the platform supports a vector
1680      * instruction to multiply all values in the vector, or if there is some other efficient machine
1681      * code sequence, then the JVM has the option of generating this machine code. Otherwise,
1682      * the default implementation of multiplying vectors sequentially from left to right is used.
1683      * For this reason, the output of this method may vary on the same input values.
1684      *
1685      * @param m the mask controlling lane selection
1686      * @return the multiplication of all the lane elements of this vector
1687      */
1688     public abstract float mulAll(VectorMask<Float> m);
1689 
1690     /**
1691      * Returns the minimum lane element of this vector.
1692      * <p>
1693      * This is an associative cross-lane reduction operation which applies the operation
1694      * {@code (a, b) -> Math.min(a, b)} to lane elements,
1695      * and the identity value is
1696      * {@link Float#POSITIVE_INFINITY}.
1697      *
1698      * @return the minimum lane element of this vector
1699      */
1700     public abstract float minAll();
1701 
1702     /**
1703      * Returns the minimum lane element of this vector, selecting lane elements
1704      * controlled by a mask.
1705      * <p>
1706      * This is an associative cross-lane reduction operation which applies the operation
1707      * {@code (a, b) -> Math.min(a, b)} to lane elements,
1708      * and the identity value is
1709      * {@link Float#POSITIVE_INFINITY}.
1710      *
1711      * @param m the mask controlling lane selection
1712      * @return the minimum lane element of this vector
1713      */
1714     public abstract float minAll(VectorMask<Float> m);
1715 
1716     /**
1717      * Returns the maximum lane element of this vector.
1718      * <p>
1719      * This is an associative cross-lane reduction operation which applies the operation
1720      * {@code (a, b) -> Math.max(a, b)} to lane elements,
1721      * and the identity value is
1722      * {@link Float#NEGATIVE_INFINITY}.
1723      *
1724      * @return the maximum lane element of this vector
1725      */
1726     public abstract float maxAll();
1727 
1728     /**
1729      * Returns the maximum lane element of this vector, selecting lane elements
1730      * controlled by a mask.
1731      * <p>
1732      * This is an associative cross-lane reduction operation which applies the operation
1733      * {@code (a, b) -> Math.max(a, b)} to lane elements,
1734      * and the identity value is
1735      * {@link Float#NEGATIVE_INFINITY}.
1736      *
1737      * @param m the mask controlling lane selection
1738      * @return the maximum lane element of this vector
1739      */
1740     public abstract float maxAll(VectorMask<Float> m);
1741 
1742 
1743     // Type specific accessors
1744 
1745     /**
1746      * Gets the lane element at lane index {@code i}
1747      *
1748      * @param i the lane index
1749      * @return the lane element at lane index {@code i}
1750      * @throws IllegalArgumentException if the index is is out of range
1751      * ({@code < 0 || >= length()})
1752      */
1753     public abstract float lane(int i);
1754 
1755     /**
1756      * Replaces the lane element of this vector at lane index {@code i} with
1757      * value {@code e}.
1758      * <p>
1759      * This is a cross-lane operation and behaves as if it returns the result
1760      * of blending this vector with an input vector that is the result of
1761      * broadcasting {@code e} and a mask that has only one lane set at lane
1762      * index {@code i}.
1763      *
1764      * @param i the lane index of the lane element to be replaced
1765      * @param e the value to be placed
1766      * @return the result of replacing the lane element of this vector at lane
1767      * index {@code i} with value {@code e}.
1768      * @throws IllegalArgumentException if the index is is out of range
1769      * ({@code < 0 || >= length()})
1770      */
1771     public abstract FloatVector with(int i, float e);
1772 
1773     // Type specific extractors


1780      * <pre>{@code
1781      *   float[] a = new float[this.length()];
1782      *   this.intoArray(a, 0);
1783      *   return a;
1784      * }</pre>
1785      *
1786      * @return an array containing the the lane elements of this vector
1787      */
1788     @ForceInline
1789     public final float[] toArray() {
1790         float[] a = new float[species().length()];
1791         intoArray(a, 0);
1792         return a;
1793     }
1794 
1795     /**
1796      * Stores this vector into an array starting at offset.
1797      * <p>
1798      * For each vector lane, where {@code N} is the vector lane index,
1799      * the lane element at index {@code N} is stored into the array at index
1800      * {@code offset + N}.
1801      *
1802      * @param a the array
1803      * @param offset the offset into the array
1804      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
1805      * {@code offset > a.length - this.length()}
1806      */
1807     public abstract void intoArray(float[] a, int offset);
1808 
1809     /**
1810      * Stores this vector into an array starting at offset and using a mask.
1811      * <p>
1812      * For each vector lane, where {@code N} is the vector lane index,
1813      * if the mask lane at index {@code N} is set then the lane element at
1814      * index {@code N} is stored into the array index {@code offset + N}.
1815      *
1816      * @param a the array
1817      * @param offset the offset into the array
1818      * @param m the mask
1819      * @throws IndexOutOfBoundsException if {@code offset < 0}, or
1820      * for any vector lane index {@code N} where the mask at lane {@code N}
1821      * is set {@code offset >= a.length - N}
1822      */
1823     public abstract void intoArray(float[] a, int offset, VectorMask<Float> m);
1824 
1825     /**
1826      * Stores this vector into an array using indexes obtained from an index
1827      * map.
1828      * <p>
1829      * For each vector lane, where {@code N} is the vector lane index, the
1830      * lane element at index {@code N} is stored into the array at index
1831      * {@code a_offset + indexMap[i_offset + N]}.
1832      *
1833      * @param a the array
1834      * @param a_offset the offset into the array, may be negative if relative
1835      * indexes in the index map compensate to produce a value within the
1836      * array bounds
1837      * @param indexMap the index map
1838      * @param i_offset the offset into the index map
1839      * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
1840      * {@code i_offset > indexMap.length - this.length()},
1841      * or for any vector lane index {@code N} the result of
1842      * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
1843      */
1844     public abstract void intoArray(float[] a, int a_offset, int[] indexMap, int i_offset);
1845 
1846     /**
1847      * Stores this vector into an array using indexes obtained from an index
1848      * map and using a mask.
1849      * <p>
1850      * For each vector lane, where {@code N} is the vector lane index,
1851      * if the mask lane at index {@code N} is set then the lane element at
1852      * index {@code N} is stored into the array at index
1853      * {@code a_offset + indexMap[i_offset + N]}.
1854      *
1855      * @param a the array
1856      * @param a_offset the offset into the array, may be negative if relative
1857      * indexes in the index map compensate to produce a value within the
1858      * array bounds
1859      * @param m the mask
1860      * @param indexMap the index map
1861      * @param i_offset the offset into the index map
1862      * @throws IndexOutOfBoundsException if {@code j < 0}, or
1863      * {@code i_offset > indexMap.length - this.length()},
1864      * or for any vector lane index {@code N} where the mask at lane
1865      * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
1866      * {@code < 0} or {@code >= a.length}
1867      */
1868     public abstract void intoArray(float[] a, int a_offset, VectorMask<Float> m, int[] indexMap, int i_offset);
1869     // Species
1870 
1871     @Override
1872     public abstract VectorSpecies<Float> species();
1873 
1874     /**
1875      * Class representing {@link FloatVector}'s of the same {@link VectorShape VectorShape}.
1876      */
1877     static final class FloatSpecies extends AbstractSpecies<Float> {
1878         final Function<float[], FloatVector> vectorFactory;
1879 
1880         private FloatSpecies(VectorShape shape,
1881                           Class<?> boxType,
1882                           Class<?> maskType,
1883                           Function<float[], FloatVector> vectorFactory,
1884                           Function<boolean[], VectorMask<Float>> maskFactory,
1885                           Function<IntUnaryOperator, VectorShuffle<Float>> shuffleFromArrayFactory,
1886                           fShuffleFromArray<Float> shuffleFromOpFactory) {
1887             super(shape, float.class, Float.SIZE, boxType, maskType, maskFactory,
1888                   shuffleFromArrayFactory, shuffleFromOpFactory);


< prev index next >