116 public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
117 #if[FP]
118 return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
119 $Type$.$type$To$Bitstype$Bits(0.0f), species,
120 ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
121 #else[FP]
122 return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
123 0, species,
124 ((bits, s) -> (($Type$Species)s).op(i -> ($type$)bits)));
125 #end[FP]
126 }
127
128 /**
129 * Loads a vector from a byte array starting at an offset.
130 * <p>
131 * Bytes are composed into primitive lane elements according to the
132 * native byte order of the underlying platform
133 * <p>
134 * This method behaves as if it returns the result of calling the
135 * byte buffer, offset, and mask accepting
136 * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
137 * <pre>{@code
138 * return this.fromByteBuffer(ByteBuffer.wrap(a), i, this.maskAllTrue());
139 * }</pre>
140 *
141 * @param species species of desired vector
142 * @param a the byte array
143 * @param ix the offset into the array
144 * @return a vector loaded from a byte array
145 * @throws IndexOutOfBoundsException if {@code i < 0} or
146 * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
147 */
148 @ForceInline
149 @SuppressWarnings("unchecked")
150 public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix) {
151 Objects.requireNonNull(a);
152 ix = VectorIntrinsics.checkIndex(ix, a.length, species.bitSize() / Byte.SIZE);
153 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
154 a, ((long) ix) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
155 a, ix, species,
156 (c, idx, s) -> {
157 ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
158 $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
159 return (($Type$Species)s).op(i -> tb.get());
160 });
161 }
162
163 /**
164 * Loads a vector from a byte array starting at an offset and using a
165 * mask.
166 * <p>
167 * Bytes are composed into primitive lane elements according to the
168 * native byte order of the underlying platform.
169 * <p>
170 * This method behaves as if it returns the result of calling the
171 * byte buffer, offset, and mask accepting
172 * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask) method} as follows:
173 * <pre>{@code
174 * return this.fromByteBuffer(ByteBuffer.wrap(a), i, m);
175 * }</pre>
176 *
177 * @param species species of desired vector
178 * @param a the byte array
179 * @param ix the offset into the array
180 * @param m the mask
181 * @return a vector loaded from a byte array
182 * @throws IndexOutOfBoundsException if {@code i < 0} or
183 * {@code i > a.length - (this.length() * this.elementSize() / Byte.SIZE)}
184 * @throws IndexOutOfBoundsException if the offset is {@code < 0},
185 * or {@code > a.length},
186 * for any vector lane index {@code N} where the mask at lane {@code N}
187 * is set
188 * {@code i >= a.length - (N * this.elementSize() / Byte.SIZE)}
189 */
190 @ForceInline
191 public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int ix, VectorMask<$Boxtype$> m) {
192 return zero(species).blend(fromByteArray(species, a, ix), m);
193 }
194
195 /**
196 * Loads a vector from an array starting at offset.
197 * <p>
198 * For each vector lane, where {@code N} is the vector lane index, the
199 * array element at index {@code i + N} is placed into the
200 * resulting vector at lane index {@code N}.
201 *
202 * @param species species of desired vector
203 * @param a the array
204 * @param i the offset into the array
205 * @return the vector loaded from an array
206 * @throws IndexOutOfBoundsException if {@code i < 0}, or
207 * {@code i > a.length - this.length()}
208 */
209 @ForceInline
210 @SuppressWarnings("unchecked")
211 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i){
212 Objects.requireNonNull(a);
213 i = VectorIntrinsics.checkIndex(i, a.length, species.length());
214 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
215 a, (((long) i) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
216 a, i, species,
217 (c, idx, s) -> (($Type$Species)s).op(n -> c[idx + n]));
218 }
219
220
221 /**
222 * Loads a vector from an array starting at offset and using a mask.
223 * <p>
224 * For each vector lane, where {@code N} is the vector lane index,
225 * if the mask lane at index {@code N} is set then the array element at
226 * index {@code i + N} is placed into the resulting vector at lane index
227 * {@code N}, otherwise the default element value is placed into the
228 * resulting vector at lane index {@code N}.
229 *
230 * @param species species of desired vector
231 * @param a the array
232 * @param i the offset into the array
233 * @param m the mask
234 * @return the vector loaded from an array
235 * @throws IndexOutOfBoundsException if {@code i < 0}, or
236 * for any vector lane index {@code N} where the mask at lane {@code N}
237 * is set {@code i > a.length - N}
238 */
239 @ForceInline
240 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m) {
241 return zero(species).blend(fromArray(species, a, i), m);
242 }
243
244 /**
245 * Loads a vector from an array using indexes obtained from an index
246 * map.
247 * <p>
248 * For each vector lane, where {@code N} is the vector lane index, the
249 * array element at index {@code i + indexMap[j + N]} is placed into the
250 * resulting vector at lane index {@code N}.
251 *
252 * @param species species of desired vector
253 * @param a the array
254 * @param i the offset into the array, may be negative if relative
255 * indexes in the index map compensate to produce a value within the
256 * array bounds
257 * @param indexMap the index map
258 * @param j the offset into the index map
259 * @return the vector loaded from an array
260 * @throws IndexOutOfBoundsException if {@code j < 0}, or
261 * {@code j > indexMap.length - this.length()},
262 * or for any vector lane index {@code N} the result of
263 * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
264 */
265 #if[byteOrShort]
266 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
267 return (($Type$Species)species).op(n -> a[i + indexMap[j + n]]);
268 }
269 #else[byteOrShort]
270 @ForceInline
271 @SuppressWarnings("unchecked")
272 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, int[] indexMap, int j) {
273 Objects.requireNonNull(a);
274 Objects.requireNonNull(indexMap);
275
276 #if[longOrDouble]
277 if (species.length() == 1) {
278 return $abstractvectortype$.fromArray(species, a, i + indexMap[j]);
279 }
280 #end[longOrDouble]
281
282 // Index vector: vix[0:n] = k -> i + indexMap[j + k]
283 IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, j).add(i);
284
285 vix = VectorIntrinsics.checkIndex(vix, a.length);
286
287 return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
288 IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
289 a, i, indexMap, j, species,
290 ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
291 (($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
292 }
293
294 #end[byteOrShort]
295 /**
296 * Loads a vector from an array using indexes obtained from an index
297 * map and using a mask.
298 * <p>
299 * For each vector lane, where {@code N} is the vector lane index,
300 * if the mask lane at index {@code N} is set then the array element at
301 * index {@code i + indexMap[j + N]} is placed into the resulting vector
302 * at lane index {@code N}.
303 *
304 * @param species species of desired vector
305 * @param a the array
306 * @param i the offset into the array, may be negative if relative
307 * indexes in the index map compensate to produce a value within the
308 * array bounds
309 * @param m the mask
310 * @param indexMap the index map
311 * @param j the offset into the index map
312 * @return the vector loaded from an array
313 * @throws IndexOutOfBoundsException if {@code j < 0}, or
314 * {@code j > indexMap.length - this.length()},
315 * or for any vector lane index {@code N} where the mask at lane
316 * {@code N} is set the result of {@code i + indexMap[j + N]} is
317 * {@code < 0} or {@code >= a.length}
318 */
319 #if[byteOrShort]
320 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
321 return (($Type$Species)species).op(m, n -> a[i + indexMap[j + n]]);
322 }
323 #else[byteOrShort]
324 @ForceInline
325 @SuppressWarnings("unchecked")
326 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
327 // @@@ This can result in out of bounds errors for unset mask lanes
328 return zero(species).blend(fromArray(species, a, i, indexMap, j), m);
329 }
330
331 #end[byteOrShort]
332
333 /**
334 * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
335 * offset into the byte buffer.
336 * <p>
337 * Bytes are composed into primitive lane elements according to the
338 * native byte order of the underlying platform.
339 * <p>
340 * This method behaves as if it returns the result of calling the
341 * byte buffer, offset, and mask accepting
342 * {@link #fromByteBuffer(VectorSpecies<$Boxtype$>, ByteBuffer, int, VectorMask)} method} as follows:
343 * <pre>{@code
344 * return this.fromByteBuffer(b, i, this.maskAllTrue())
345 * }</pre>
346 *
347 * @param species species of desired vector
348 * @param bb the byte buffer
349 * @param ix the offset into the byte buffer
350 * @return a vector loaded from a byte buffer
351 * @throws IndexOutOfBoundsException if the offset is {@code < 0},
352 * or {@code > b.limit()},
353 * or if there are fewer than
354 * {@code this.length() * this.elementSize() / Byte.SIZE} bytes
355 * remaining in the byte buffer from the given offset
356 */
357 @ForceInline
358 @SuppressWarnings("unchecked")
359 public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix) {
360 if (bb.order() != ByteOrder.nativeOrder()) {
361 throw new IllegalArgumentException();
362 }
363 ix = VectorIntrinsics.checkIndex(ix, bb.limit(), species.bitSize() / Byte.SIZE);
364 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
365 U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + ix,
366 bb, ix, species,
367 (c, idx, s) -> {
368 ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
369 $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
370 return (($Type$Species)s).op(i -> tb.get());
371 });
372 }
373
374 /**
375 * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
376 * offset into the byte buffer and using a mask.
377 * <p>
378 * This method behaves as if the byte buffer is viewed as a primitive
379 * {@link java.nio.Buffer buffer} for the primitive element type,
380 * according to the native byte order of the underlying platform, and
381 * the returned vector is loaded with a mask from a primitive array
382 * obtained from the primitive buffer.
383 * The following pseudocode expresses the behaviour, where
384 * {@coce EBuffer} is the primitive buffer type, {@code e} is the
385 * primitive element type, and {@code ESpecies<S>} is the primitive
386 * species for {@code e}:
387 * <pre>{@code
388 * EBuffer eb = b.duplicate().
389 * order(ByteOrder.nativeOrder()).position(i).
390 * asEBuffer();
391 * e[] es = new e[this.length()];
392 * for (int n = 0; n < t.length; n++) {
393 * if (m.isSet(n))
394 * es[n] = eb.get(n);
395 * }
396 * Vector<E> r = ((ESpecies<S>)this).fromArray(es, 0, m);
397 * }</pre>
398 *
399 * @param species species of desired vector
400 * @param bb the byte buffer
401 * @param ix the offset into the byte buffer
402 * @param m the mask
403 * @return a vector loaded from a byte buffer
404 * @throws IndexOutOfBoundsException if the offset is {@code < 0},
405 * or {@code > b.limit()},
406 * for any vector lane index {@code N} where the mask at lane {@code N}
407 * is set
408 * {@code i >= b.limit() - (N * this.elementSize() / Byte.SIZE)}
409 */
410 @ForceInline
411 public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int ix, VectorMask<$Boxtype$> m) {
412 return zero(species).blend(fromByteBuffer(species, bb, ix), m);
413 }
414
415 /**
416 * Returns a vector where all lane elements are set to the primitive
417 * value {@code e}.
418 *
419 * @param s species of the desired vector
420 * @param e the value
421 * @return a vector of vector where all lane elements are set to
422 * the primitive value {@code e}
423 */
424 #if[FP]
425 @ForceInline
426 @SuppressWarnings("unchecked")
427 public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
428 return VectorIntrinsics.broadcastCoerced(
429 (Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
430 $Type$.$type$To$Bitstype$Bits(e), s,
431 ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
432 }
433 #else[FP]
434 @ForceInline
435 @SuppressWarnings("unchecked")
436 public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> s, $type$ e) {
437 return VectorIntrinsics.broadcastCoerced(
438 (Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
439 e, s,
440 ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
441 }
442 #end[FP]
443
444 /**
445 * Returns a vector where each lane element is set to a given
446 * primitive value.
447 * <p>
448 * For each vector lane, where {@code N} is the vector lane index, the
449 * the primitive value at index {@code N} is placed into the resulting
450 * vector at lane index {@code N}.
451 *
452 * @param s species of the desired vector
453 * @param es the given primitive values
454 * @return a vector where each lane element is set to a given primitive
455 * value
456 * @throws IndexOutOfBoundsException if {@code es.length < this.length()}
457 */
458 @ForceInline
459 @SuppressWarnings("unchecked")
460 public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> s, $type$... es) {
461 Objects.requireNonNull(es);
462 int ix = VectorIntrinsics.checkIndex(0, es.length, s.length());
463 return VectorIntrinsics.load((Class<$abstractvectortype$>) s.boxType(), $type$.class, s.length(),
464 es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
465 es, ix, s,
466 (c, idx, sp) -> (($Type$Species)sp).op(n -> c[idx + n]));
467 }
468
469 /**
470 * Returns a vector where the first lane element is set to the primtive
471 * value {@code e}, all other lane elements are set to the default
472 * value.
473 *
474 * @param s species of the desired vector
475 * @param e the value
476 * @return a vector where the first lane element is set to the primitive
477 * value {@code e}
478 */
479 @ForceInline
480 public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> s, $type$ e) {
481 return zero(s).with(0, e);
482 }
483
484 /**
485 * Returns a vector where each lane element is set to a randomly
486 * generated primitive value.
487 *
488 * The semantics are equivalent to calling
489 #if[byteOrShort]
490 * ($type$){@link ThreadLocalRandom#nextInt()}
491 #else[byteOrShort]
492 * {@link ThreadLocalRandom#next$Type$()}
493 #end[byteOrShort]
494 *
495 * @param s species of the desired vector
496 * @return a vector where each lane elements is set to a randomly
497 * generated primitive value
498 */
499 #if[intOrLong]
500 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
501 ThreadLocalRandom r = ThreadLocalRandom.current();
502 return (($Type$Species)s).op(i -> r.next$Type$());
503 }
504 #else[intOrLong]
505 #if[FP]
506 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
507 ThreadLocalRandom r = ThreadLocalRandom.current();
508 return (($Type$Species)s).op(i -> r.next$Type$());
509 }
510 #else[FP]
511 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> s) {
512 ThreadLocalRandom r = ThreadLocalRandom.current();
513 return (($Type$Species)s).op(i -> ($type$) r.nextInt());
514 }
515 #end[FP]
516 #end[intOrLong]
517
518 // Ops
519
520 @Override
521 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
522
523 /**
524 * Adds this vector to the broadcast of an input scalar.
525 * <p>
526 * This is a vector binary operation where the primitive addition operation
527 * ({@code +}) is applied to lane elements.
528 *
529 * @param s the input scalar
530 * @return the result of adding this vector to the broadcast of an input
531 * scalar
532 */
533 public abstract $abstractvectortype$ add($type$ s);
534
535 @Override
536 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
537
538 /**
539 * Adds this vector to broadcast of an input scalar,
540 * selecting lane elements controlled by a mask.
541 * <p>
542 * This is a vector binary operation where the primitive addition operation
543 * ({@code +}) is applied to lane elements.
544 *
545 * @param s the input scalar
546 * @param m the mask controlling lane selection
547 * @return the result of adding this vector to the broadcast of an input
548 * scalar
549 */
550 public abstract $abstractvectortype$ add($type$ s, VectorMask<$Boxtype$> m);
551
552 @Override
553 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
554
555 /**
556 * Subtracts the broadcast of an input scalar from this vector.
557 * <p>
558 * This is a vector binary operation where the primitive subtraction
559 * operation ({@code -}) is applied to lane elements.
560 *
561 * @param s the input scalar
562 * @return the result of subtracting the broadcast of an input
563 * scalar from this vector
564 */
565 public abstract $abstractvectortype$ sub($type$ s);
566
567 @Override
568 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
569
570 /**
571 * Subtracts the broadcast of an input scalar from this vector, selecting
572 * lane elements controlled by a mask.
573 * <p>
574 * This is a vector binary operation where the primitive subtraction
575 * operation ({@code -}) is applied to lane elements.
576 *
577 * @param s the input scalar
578 * @param m the mask controlling lane selection
579 * @return the result of subtracting the broadcast of an input
580 * scalar from this vector
581 */
582 public abstract $abstractvectortype$ sub($type$ s, VectorMask<$Boxtype$> m);
583
584 @Override
585 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
586
587 /**
588 * Multiplies this vector with the broadcast of an input scalar.
589 * <p>
590 * This is a vector binary operation where the primitive multiplication
591 * operation ({@code *}) is applied to lane elements.
592 *
593 * @param s the input scalar
594 * @return the result of multiplying this vector with the broadcast of an
595 * input scalar
596 */
597 public abstract $abstractvectortype$ mul($type$ s);
598
599 @Override
600 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
601
602 /**
603 * Multiplies this vector with the broadcast of an input scalar, selecting
604 * lane elements controlled by a mask.
605 * <p>
606 * This is a vector binary operation where the primitive multiplication
607 * operation ({@code *}) is applied to lane elements.
608 *
609 * @param s the input scalar
610 * @param m the mask controlling lane selection
611 * @return the result of multiplying this vector with the broadcast of an
612 * input scalar
613 */
614 public abstract $abstractvectortype$ mul($type$ s, VectorMask<$Boxtype$> m);
615
616 @Override
617 public abstract $abstractvectortype$ neg();
618
619 @Override
620 public abstract $abstractvectortype$ neg(VectorMask<$Boxtype$> m);
621
622 @Override
623 public abstract $abstractvectortype$ abs();
624
625 @Override
626 public abstract $abstractvectortype$ abs(VectorMask<$Boxtype$> m);
627
628 @Override
629 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
630
631 @Override
632 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
633
634 /**
635 * Returns the minimum of this vector and the broadcast of an input scalar.
636 * <p>
637 * This is a vector binary operation where the operation
638 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements.
639 *
640 * @param s the input scalar
641 * @return the minimum of this vector and the broadcast of an input scalar
642 */
643 public abstract $abstractvectortype$ min($type$ s);
644
645 @Override
646 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
647
648 @Override
649 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
650
651 /**
652 * Returns the maximum of this vector and the broadcast of an input scalar.
653 * <p>
654 * This is a vector binary operation where the operation
655 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements.
656 *
657 * @param s the input scalar
658 * @return the maximum of this vector and the broadcast of an input scalar
659 */
660 public abstract $abstractvectortype$ max($type$ s);
661
662 @Override
663 public abstract VectorMask<$Boxtype$> equal(Vector<$Boxtype$> v);
664
665 /**
666 * Tests if this vector is equal to the broadcast of an input scalar.
667 * <p>
668 * This is a vector binary test operation where the primitive equals
669 * operation ({@code ==}) is applied to lane elements.
670 *
671 * @param s the input scalar
672 * @return the result mask of testing if this vector is equal to the
673 * broadcast of an input scalar
674 */
675 public abstract VectorMask<$Boxtype$> equal($type$ s);
676
677 @Override
678 public abstract VectorMask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
679
680 /**
681 * Tests if this vector is not equal to the broadcast of an input scalar.
682 * <p>
683 * This is a vector binary test operation where the primitive not equals
684 * operation ({@code !=}) is applied to lane elements.
685 *
686 * @param s the input scalar
687 * @return the result mask of testing if this vector is not equal to the
688 * broadcast of an input scalar
689 */
690 public abstract VectorMask<$Boxtype$> notEqual($type$ s);
691
692 @Override
693 public abstract VectorMask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
694
695 /**
696 * Tests if this vector is less than the broadcast of an input scalar.
697 * <p>
698 * This is a vector binary test operation where the primitive less than
699 * operation ({@code <}) is applied to lane elements.
700 *
701 * @param s the input scalar
702 * @return the mask result of testing if this vector is less than the
703 * broadcast of an input scalar
704 */
705 public abstract VectorMask<$Boxtype$> lessThan($type$ s);
706
707 @Override
708 public abstract VectorMask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
709
710 /**
711 * Tests if this vector is less or equal to the broadcast of an input scalar.
712 * <p>
713 * This is a vector binary test operation where the primitive less than
714 * or equal to operation ({@code <=}) is applied to lane elements.
715 *
716 * @param s the input scalar
717 * @return the mask result of testing if this vector is less than or equal
718 * to the broadcast of an input scalar
719 */
720 public abstract VectorMask<$Boxtype$> lessThanEq($type$ s);
721
722 @Override
723 public abstract VectorMask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
724
725 /**
726 * Tests if this vector is greater than the broadcast of an input scalar.
727 * <p>
728 * This is a vector binary test operation where the primitive greater than
729 * operation ({@code >}) is applied to lane elements.
730 *
731 * @param s the input scalar
732 * @return the mask result of testing if this vector is greater than the
733 * broadcast of an input scalar
734 */
735 public abstract VectorMask<$Boxtype$> greaterThan($type$ s);
736
737 @Override
738 public abstract VectorMask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
739
740 /**
741 * Tests if this vector is greater than or equal to the broadcast of an
742 * input scalar.
743 * <p>
744 * This is a vector binary test operation where the primitive greater than
745 * or equal to operation ({@code >=}) is applied to lane elements.
746 *
747 * @param s the input scalar
748 * @return the mask result of testing if this vector is greater than or
749 * equal to the broadcast of an input scalar
750 */
751 public abstract VectorMask<$Boxtype$> greaterThanEq($type$ s);
752
753 @Override
754 public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
755
756 /**
757 * Blends the lane elements of this vector with those of the broadcast of an
758 * input scalar, selecting lanes controlled by a mask.
759 * <p>
760 * For each lane of the mask, at lane index {@code N}, if the mask lane
761 * is set then the lane element at {@code N} from the input vector is
762 * selected and placed into the resulting vector at {@code N},
763 * otherwise the the lane element at {@code N} from this input vector is
764 * selected and placed into the resulting vector at {@code N}.
765 *
779
780 @Override
781 public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
782
783 @Override
784 public abstract $abstractvectortype$ rotateEL(int i);
785
786 @Override
787 public abstract $abstractvectortype$ rotateER(int i);
788
789 @Override
790 public abstract $abstractvectortype$ shiftEL(int i);
791
792 @Override
793 public abstract $abstractvectortype$ shiftER(int i);
794
795 #if[FP]
796 /**
797 * Divides this vector by an input vector.
798 * <p>
799 * This is a vector binary operation where the primitive division
800 * operation ({@code /}) is applied to lane elements.
801 *
802 * @param v the input vector
803 * @return the result of dividing this vector by the input vector
804 */
805 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v);
806
807 /**
808 * Divides this vector by the broadcast of an input scalar.
809 * <p>
810 * This is a vector binary operation where the primitive division
811 * operation ({@code /}) is applied to lane elements.
812 *
813 * @param s the input scalar
814 * @return the result of dividing this vector by the broadcast of an input
815 * scalar
816 */
817 public abstract $abstractvectortype$ div($type$ s);
818
819 /**
820 * Divides this vector by an input vector, selecting lane elements
821 * controlled by a mask.
822 * <p>
823 * This is a vector binary operation where the primitive division
824 * operation ({@code /}) is applied to lane elements.
825 *
826 * @param v the input vector
827 * @param m the mask controlling lane selection
828 * @return the result of dividing this vector by the input vector
829 */
830 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
831
832 /**
833 * Divides this vector by the broadcast of an input scalar, selecting lane
834 * elements controlled by a mask.
835 * <p>
836 * This is a vector binary operation where the primitive division
837 * operation ({@code /}) is applied to lane elements.
838 *
839 * @param s the input scalar
840 * @param m the mask controlling lane selection
841 * @return the result of dividing this vector by the broadcast of an input
842 * scalar
843 */
844 public abstract $abstractvectortype$ div($type$ s, VectorMask<$Boxtype$> m);
845
846 /**
847 * Calculates the square root of this vector.
848 * <p>
849 * This is a vector unary operation where the {@link Math#sqrt} operation
850 * is applied to lane elements.
851 *
852 * @return the square root of this vector
853 */
854 public abstract $abstractvectortype$ sqrt();
855
856 /**
857 * Calculates the square root of this vector, selecting lane elements
858 * controlled by a mask.
859 * <p>
860 * This is a vector unary operation where the {@link Math#sqrt} operation
861 * is applied to lane elements.
862 *
863 * @param m the mask controlling lane selection
864 * @return the square root of this vector
865 */
866 public $abstractvectortype$ sqrt(VectorMask<$Boxtype$> m) {
867 return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
868 }
869
870 /**
871 * Calculates the trigonometric tangent of this vector.
872 * <p>
873 * This is a vector unary operation with same semantic definition as
874 * {@link Math#tan} operation applied to lane elements.
875 * The implementation is not required to return same
876 * results as {@link Math#tan}, but adheres to rounding, monotonicity,
877 * and special case semantics as defined in the {@link Math#tan}
878 * specifications. The computed result will be within 1 ulp of the
879 * exact result.
880 *
881 * @return the tangent of this vector
882 */
883 public $abstractvectortype$ tan() {
884 return uOp((i, a) -> ($type$) Math.tan((double) a));
885 }
886
887 /**
888 * Calculates the trigonometric tangent of this vector, selecting lane
889 * elements controlled by a mask.
890 * <p>
891 * Semantics for rounding, monotonicity, and special cases are
892 * described in {@link $abstractvectortype$#tan}
893 *
894 * @param m the mask controlling lane selection
895 * @return the tangent of this vector
896 */
897 public $abstractvectortype$ tan(VectorMask<$Boxtype$> m) {
898 return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
899 }
900
901 /**
902 * Calculates the hyperbolic tangent of this vector.
903 * <p>
904 * This is a vector unary operation with same semantic definition as
905 * {@link Math#tanh} operation applied to lane elements.
906 * The implementation is not required to return same
907 * results as {@link Math#tanh}, but adheres to rounding, monotonicity,
908 * and special case semantics as defined in the {@link Math#tanh}
909 * specifications. The computed result will be within 2.5 ulps of the
910 * exact result.
911 *
912 * @return the hyperbolic tangent of this vector
913 */
914 public $abstractvectortype$ tanh() {
915 return uOp((i, a) -> ($type$) Math.tanh((double) a));
916 }
917
918 /**
919 * Calculates the hyperbolic tangent of this vector, selecting lane elements
920 * controlled by a mask.
921 * <p>
922 * Semantics for rounding, monotonicity, and special cases are
923 * described in {@link $abstractvectortype$#tanh}
924 *
925 * @param m the mask controlling lane selection
926 * @return the hyperbolic tangent of this vector
927 */
928 public $abstractvectortype$ tanh(VectorMask<$Boxtype$> m) {
929 return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
930 }
931
932 /**
933 * Calculates the trigonometric sine of this vector.
934 * <p>
935 * This is a vector unary operation with same semantic definition as
936 * {@link Math#sin} operation applied to lane elements.
937 * The implementation is not required to return same
938 * results as {@link Math#sin}, but adheres to rounding, monotonicity,
939 * and special case semantics as defined in the {@link Math#sin}
940 * specifications. The computed result will be within 1 ulp of the
941 * exact result.
942 *
943 * @return the sine of this vector
944 */
945 public $abstractvectortype$ sin() {
946 return uOp((i, a) -> ($type$) Math.sin((double) a));
947 }
948
949 /**
950 * Calculates the trigonometric sine of this vector, selecting lane elements
951 * controlled by a mask.
952 * <p>
953 * Semantics for rounding, monotonicity, and special cases are
954 * described in {@link $abstractvectortype$#sin}
955 *
956 * @param m the mask controlling lane selection
957 * @return the sine of this vector
958 */
959 public $abstractvectortype$ sin(VectorMask<$Boxtype$> m) {
960 return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
961 }
962
963 /**
964 * Calculates the hyperbolic sine of this vector.
965 * <p>
966 * This is a vector unary operation with same semantic definition as
967 * {@link Math#sinh} operation applied to lane elements.
968 * The implementation is not required to return same
969 * results as {@link Math#sinh}, but adheres to rounding, monotonicity,
970 * and special case semantics as defined in the {@link Math#sinh}
971 * specifications. The computed result will be within 2.5 ulps of the
972 * exact result.
973 *
974 * @return the hyperbolic sine of this vector
975 */
976 public $abstractvectortype$ sinh() {
977 return uOp((i, a) -> ($type$) Math.sinh((double) a));
978 }
979
980 /**
981 * Calculates the hyperbolic sine of this vector, selecting lane elements
982 * controlled by a mask.
983 * <p>
984 * Semantics for rounding, monotonicity, and special cases are
985 * described in {@link $abstractvectortype$#sinh}
986 *
987 * @param m the mask controlling lane selection
988 * @return the hyperbolic sine of this vector
989 */
990 public $abstractvectortype$ sinh(VectorMask<$Boxtype$> m) {
991 return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
992 }
993
994 /**
995 * Calculates the trigonometric cosine of this vector.
996 * <p>
997 * This is a vector unary operation with same semantic definition as
998 * {@link Math#cos} operation applied to lane elements.
999 * The implementation is not required to return same
1000 * results as {@link Math#cos}, but adheres to rounding, monotonicity,
1001 * and special case semantics as defined in the {@link Math#cos}
1002 * specifications. The computed result will be within 1 ulp of the
1003 * exact result.
1004 *
1005 * @return the cosine of this vector
1006 */
1007 public $abstractvectortype$ cos() {
1008 return uOp((i, a) -> ($type$) Math.cos((double) a));
1009 }
1010
1011 /**
1012 * Calculates the trigonometric cosine of this vector, selecting lane
1013 * elements controlled by a mask.
1014 * <p>
1015 * Semantics for rounding, monotonicity, and special cases are
1016 * described in {@link $abstractvectortype$#cos}
1017 *
1018 * @param m the mask controlling lane selection
1019 * @return the cosine of this vector
1020 */
1021 public $abstractvectortype$ cos(VectorMask<$Boxtype$> m) {
1022 return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
1023 }
1024
1025 /**
1026 * Calculates the hyperbolic cosine of this vector.
1027 * <p>
1028 * This is a vector unary operation with same semantic definition as
1029 * {@link Math#cosh} operation applied to lane elements.
1030 * The implementation is not required to return same
1031 * results as {@link Math#cosh}, but adheres to rounding, monotonicity,
1032 * and special case semantics as defined in the {@link Math#cosh}
1033 * specifications. The computed result will be within 2.5 ulps of the
1034 * exact result.
1035 *
1036 * @return the hyperbolic cosine of this vector
1037 */
1038 public $abstractvectortype$ cosh() {
1039 return uOp((i, a) -> ($type$) Math.cosh((double) a));
1040 }
1041
1042 /**
1043 * Calculates the hyperbolic cosine of this vector, selecting lane elements
1044 * controlled by a mask.
1045 * <p>
1046 * Semantics for rounding, monotonicity, and special cases are
1047 * described in {@link $abstractvectortype$#cosh}
1048 *
1049 * @param m the mask controlling lane selection
1050 * @return the hyperbolic cosine of this vector
1051 */
1052 public $abstractvectortype$ cosh(VectorMask<$Boxtype$> m) {
1053 return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
1054 }
1055
1056 /**
1057 * Calculates the arc sine of this vector.
1058 * <p>
1059 * This is a vector unary operation with same semantic definition as
1060 * {@link Math#asin} operation applied to lane elements.
1061 * The implementation is not required to return same
1062 * results as {@link Math#asin}, but adheres to rounding, monotonicity,
1063 * and special case semantics as defined in the {@link Math#asin}
1064 * specifications. The computed result will be within 1 ulp of the
1065 * exact result.
1066 *
1067 * @return the arc sine of this vector
1068 */
1069 public $abstractvectortype$ asin() {
1070 return uOp((i, a) -> ($type$) Math.asin((double) a));
1071 }
1072
1073 /**
1074 * Calculates the arc sine of this vector, selecting lane elements
1075 * controlled by a mask.
1076 * <p>
1077 * Semantics for rounding, monotonicity, and special cases are
1078 * described in {@link $abstractvectortype$#asin}
1079 *
1080 * @param m the mask controlling lane selection
1081 * @return the arc sine of this vector
1082 */
1083 public $abstractvectortype$ asin(VectorMask<$Boxtype$> m) {
1084 return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
1085 }
1086
1087 /**
1088 * Calculates the arc cosine of this vector.
1089 * <p>
1090 * This is a vector unary operation with same semantic definition as
1091 * {@link Math#acos} operation applied to lane elements.
1092 * The implementation is not required to return same
1093 * results as {@link Math#acos}, but adheres to rounding, monotonicity,
1094 * and special case semantics as defined in the {@link Math#acos}
1095 * specifications. The computed result will be within 1 ulp of the
1096 * exact result.
1097 *
1098 * @return the arc cosine of this vector
1099 */
1100 public $abstractvectortype$ acos() {
1101 return uOp((i, a) -> ($type$) Math.acos((double) a));
1102 }
1103
1104 /**
1105 * Calculates the arc cosine of this vector, selecting lane elements
1106 * controlled by a mask.
1107 * <p>
1108 * Semantics for rounding, monotonicity, and special cases are
1109 * described in {@link $abstractvectortype$#acos}
1110 *
1111 * @param m the mask controlling lane selection
1112 * @return the arc cosine of this vector
1113 */
1114 public $abstractvectortype$ acos(VectorMask<$Boxtype$> m) {
1115 return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
1116 }
1117
1118 /**
1119 * Calculates the arc tangent of this vector.
1120 * <p>
1121 * This is a vector unary operation with same semantic definition as
1122 * {@link Math#atan} operation applied to lane elements.
1123 * The implementation is not required to return same
1124 * results as {@link Math#atan}, but adheres to rounding, monotonicity,
1125 * and special case semantics as defined in the {@link Math#atan}
1126 * specifications. The computed result will be within 1 ulp of the
1127 * exact result.
1128 *
1129 * @return the arc tangent of this vector
1130 */
1131 public $abstractvectortype$ atan() {
1132 return uOp((i, a) -> ($type$) Math.atan((double) a));
1133 }
1134
1135 /**
1136 * Calculates the arc tangent of this vector, selecting lane elements
1137 * controlled by a mask.
1138 * <p>
1139 * Semantics for rounding, monotonicity, and special cases are
1140 * described in {@link $abstractvectortype$#atan}
1141 *
1142 * @param m the mask controlling lane selection
1143 * @return the arc tangent of this vector
1144 */
1145 public $abstractvectortype$ atan(VectorMask<$Boxtype$> m) {
1146 return uOp(m, (i, a) -> ($type$) Math.atan((double) a));
1147 }
1148
1149 /**
1150 * Calculates the arc tangent of this vector divided by an input vector.
1151 * <p>
1152 * This is a vector binary operation with same semantic definition as
1153 * {@link Math#atan2} operation applied to lane elements.
1154 * The implementation is not required to return same
1155 * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1156 * and special case semantics as defined in the {@link Math#atan2}
1157 * specifications. The computed result will be within 2 ulps of the
1158 * exact result.
1159 *
1160 * @param v the input vector
1161 * @return the arc tangent of this vector divided by the input vector
1162 */
1163 public $abstractvectortype$ atan2(Vector<$Boxtype$> v) {
1164 return bOp(v, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
1165 }
1166
1167 /**
1168 * Calculates the arc tangent of this vector divided by the broadcast of an
1169 * an input scalar.
1170 * <p>
1171 * This is a vector binary operation with same semantic definition as
1172 * {@link Math#atan2} operation applied to lane elements.
1173 * The implementation is not required to return same
1174 * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1175 * and special case semantics as defined in the {@link Math#atan2}
1176 * specifications. The computed result will be within 1 ulp of the
1177 * exact result.
1178 *
1179 * @param s the input scalar
1180 * @return the arc tangent of this vector over the input vector
1181 */
1182 public abstract $abstractvectortype$ atan2($type$ s);
1183
1184 /**
1185 * Calculates the arc tangent of this vector divided by an input vector,
1186 * selecting lane elements controlled by a mask.
1187 * <p>
1188 * Semantics for rounding, monotonicity, and special cases are
1189 * described in {@link $abstractvectortype$#atan2}
1190 *
1191 * @param v the input vector
1192 * @param m the mask controlling lane selection
1195 public $abstractvectortype$ atan2(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1196 return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
1197 }
1198
1199 /**
1200 * Calculates the arc tangent of this vector divided by the broadcast of an
1201 * an input scalar, selecting lane elements controlled by a mask.
1202 * <p>
1203 * Semantics for rounding, monotonicity, and special cases are
1204 * described in {@link $abstractvectortype$#atan2}
1205 *
1206 * @param s the input scalar
1207 * @param m the mask controlling lane selection
1208 * @return the arc tangent of this vector over the input vector
1209 */
1210 public abstract $abstractvectortype$ atan2($type$ s, VectorMask<$Boxtype$> m);
1211
1212 /**
1213 * Calculates the cube root of this vector.
1214 * <p>
1215 * This is a vector unary operation with same semantic definition as
1216 * {@link Math#cbrt} operation applied to lane elements.
1217 * The implementation is not required to return same
1218 * results as {@link Math#cbrt}, but adheres to rounding, monotonicity,
1219 * and special case semantics as defined in the {@link Math#cbrt}
1220 * specifications. The computed result will be within 1 ulp of the
1221 * exact result.
1222 *
1223 * @return the cube root of this vector
1224 */
1225 public $abstractvectortype$ cbrt() {
1226 return uOp((i, a) -> ($type$) Math.cbrt((double) a));
1227 }
1228
1229 /**
1230 * Calculates the cube root of this vector, selecting lane elements
1231 * controlled by a mask.
1232 * <p>
1233 * Semantics for rounding, monotonicity, and special cases are
1234 * described in {@link $abstractvectortype$#cbrt}
1235 *
1236 * @param m the mask controlling lane selection
1237 * @return the cube root of this vector
1238 */
1239 public $abstractvectortype$ cbrt(VectorMask<$Boxtype$> m) {
1240 return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
1241 }
1242
1243 /**
1244 * Calculates the natural logarithm of this vector.
1245 * <p>
1246 * This is a vector unary operation with same semantic definition as
1247 * {@link Math#log} operation applied to lane elements.
1248 * The implementation is not required to return same
1249 * results as {@link Math#log}, but adheres to rounding, monotonicity,
1250 * and special case semantics as defined in the {@link Math#log}
1251 * specifications. The computed result will be within 1 ulp of the
1252 * exact result.
1253 *
1254 * @return the natural logarithm of this vector
1255 */
1256 public $abstractvectortype$ log() {
1257 return uOp((i, a) -> ($type$) Math.log((double) a));
1258 }
1259
1260 /**
1261 * Calculates the natural logarithm of this vector, selecting lane elements
1262 * controlled by a mask.
1263 * <p>
1264 * Semantics for rounding, monotonicity, and special cases are
1265 * described in {@link $abstractvectortype$#log}
1266 *
1267 * @param m the mask controlling lane selection
1268 * @return the natural logarithm of this vector
1269 */
1270 public $abstractvectortype$ log(VectorMask<$Boxtype$> m) {
1271 return uOp(m, (i, a) -> ($type$) Math.log((double) a));
1272 }
1273
1274 /**
1275 * Calculates the base 10 logarithm of this vector.
1276 * <p>
1277 * This is a vector unary operation with same semantic definition as
1278 * {@link Math#log10} operation applied to lane elements.
1279 * The implementation is not required to return same
1280 * results as {@link Math#log10}, but adheres to rounding, monotonicity,
1281 * and special case semantics as defined in the {@link Math#log10}
1282 * specifications. The computed result will be within 1 ulp of the
1283 * exact result.
1284 *
1285 * @return the base 10 logarithm of this vector
1286 */
1287 public $abstractvectortype$ log10() {
1288 return uOp((i, a) -> ($type$) Math.log10((double) a));
1289 }
1290
1291 /**
1292 * Calculates the base 10 logarithm of this vector, selecting lane elements
1293 * controlled by a mask.
1294 * <p>
1295 * Semantics for rounding, monotonicity, and special cases are
1296 * described in {@link $abstractvectortype$#log10}
1297 *
1298 * @param m the mask controlling lane selection
1299 * @return the base 10 logarithm of this vector
1300 */
1301 public $abstractvectortype$ log10(VectorMask<$Boxtype$> m) {
1302 return uOp(m, (i, a) -> ($type$) Math.log10((double) a));
1303 }
1304
1305 /**
1306 * Calculates the natural logarithm of the sum of this vector and the
1307 * broadcast of {@code 1}.
1308 * <p>
1309 * This is a vector unary operation with same semantic definition as
1310 * {@link Math#log1p} operation applied to lane elements.
1311 * The implementation is not required to return same
1312 * results as {@link Math#log1p}, but adheres to rounding, monotonicity,
1313 * and special case semantics as defined in the {@link Math#log1p}
1314 * specifications. The computed result will be within 1 ulp of the
1315 * exact result.
1316 *
1317 * @return the natural logarithm of the sum of this vector and the broadcast
1318 * of {@code 1}
1319 */
1320 public $abstractvectortype$ log1p() {
1321 return uOp((i, a) -> ($type$) Math.log1p((double) a));
1322 }
1323
1324 /**
1325 * Calculates the natural logarithm of the sum of this vector and the
1326 * broadcast of {@code 1}, selecting lane elements controlled by a mask.
1327 * <p>
1328 * Semantics for rounding, monotonicity, and special cases are
1329 * described in {@link $abstractvectortype$#log1p}
1330 *
1331 * @param m the mask controlling lane selection
1332 * @return the natural logarithm of the sum of this vector and the broadcast
1333 * of {@code 1}
1334 */
1335 public $abstractvectortype$ log1p(VectorMask<$Boxtype$> m) {
1336 return uOp(m, (i, a) -> ($type$) Math.log1p((double) a));
1337 }
1338
1339 /**
1340 * Calculates this vector raised to the power of an input vector.
1341 * <p>
1342 * This is a vector binary operation with same semantic definition as
1343 * {@link Math#pow} operation applied to lane elements.
1344 * The implementation is not required to return same
1345 * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1346 * and special case semantics as defined in the {@link Math#pow}
1347 * specifications. The computed result will be within 1 ulp of the
1348 * exact result.
1349 *
1350 * @param v the input vector
1351 * @return this vector raised to the power of an input vector
1352 */
1353 public $abstractvectortype$ pow(Vector<$Boxtype$> v) {
1354 return bOp(v, (i, a, b) -> ($type$) Math.pow((double) a, (double) b));
1355 }
1356
1357 /**
1358 * Calculates this vector raised to the power of the broadcast of an input
1359 * scalar.
1360 * <p>
1361 * This is a vector binary operation with same semantic definition as
1362 * {@link Math#pow} operation applied to lane elements.
1363 * The implementation is not required to return same
1364 * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1365 * and special case semantics as defined in the {@link Math#pow}
1366 * specifications. The computed result will be within 1 ulp of the
1367 * exact result.
1368 *
1369 * @param s the input scalar
1370 * @return this vector raised to the power of the broadcast of an input
1371 * scalar.
1372 */
1373 public abstract $abstractvectortype$ pow($type$ s);
1374
1375 /**
1376 * Calculates this vector raised to the power of an input vector, selecting
1377 * lane elements controlled by a mask.
1378 * <p>
1379 * Semantics for rounding, monotonicity, and special cases are
1380 * described in {@link $abstractvectortype$#pow}
1381 *
1382 * @param v the input vector
1388 }
1389
1390 /**
1391 * Calculates this vector raised to the power of the broadcast of an input
1392 * scalar, selecting lane elements controlled by a mask.
1393 * <p>
1394 * Semantics for rounding, monotonicity, and special cases are
1395 * described in {@link $abstractvectortype$#pow}
1396 *
1397 * @param s the input scalar
1398 * @param m the mask controlling lane selection
1399 * @return this vector raised to the power of the broadcast of an input
1400 * scalar.
1401 */
1402 public abstract $abstractvectortype$ pow($type$ s, VectorMask<$Boxtype$> m);
1403
1404 /**
1405 * Calculates the broadcast of Euler's number {@code e} raised to the power
1406 * of this vector.
1407 * <p>
1408 * This is a vector unary operation with same semantic definition as
1409 * {@link Math#exp} operation applied to lane elements.
1410 * The implementation is not required to return same
1411 * results as {@link Math#exp}, but adheres to rounding, monotonicity,
1412 * and special case semantics as defined in the {@link Math#exp}
1413 * specifications. The computed result will be within 1 ulp of the
1414 * exact result.
1415 *
1416 * @return the broadcast of Euler's number {@code e} raised to the power of
1417 * this vector
1418 */
1419 public $abstractvectortype$ exp() {
1420 return uOp((i, a) -> ($type$) Math.exp((double) a));
1421 }
1422
1423 /**
1424 * Calculates the broadcast of Euler's number {@code e} raised to the power
1425 * of this vector, selecting lane elements controlled by a mask.
1426 * <p>
1427 * Semantics for rounding, monotonicity, and special cases are
1428 * described in {@link $abstractvectortype$#exp}
1429 *
1430 * @param m the mask controlling lane selection
1431 * @return the broadcast of Euler's number {@code e} raised to the power of
1432 * this vector
1433 */
1434 public $abstractvectortype$ exp(VectorMask<$Boxtype$> m) {
1435 return uOp(m, (i, a) -> ($type$) Math.exp((double) a));
1436 }
1437
1438 /**
1439 * Calculates the broadcast of Euler's number {@code e} raised to the power
1440 * of this vector minus the broadcast of {@code -1}.
1441 * More specifically as if the following (ignoring any differences in
1442 * numerical accuracy):
1443 * <pre>{@code
1444 * this.exp().sub(this.species().broadcast(1))
1445 * }</pre>
1446 * <p>
1447 * This is a vector unary operation with same semantic definition as
1448 * {@link Math#expm1} operation applied to lane elements.
1449 * The implementation is not required to return same
1450 * results as {@link Math#expm1}, but adheres to rounding, monotonicity,
1451 * and special case semantics as defined in the {@link Math#expm1}
1452 * specifications. The computed result will be within 1 ulp of the
1453 * exact result.
1454 *
1455 * @return the broadcast of Euler's number {@code e} raised to the power of
1456 * this vector minus the broadcast of {@code -1}
1457 */
1458 public $abstractvectortype$ expm1() {
1459 return uOp((i, a) -> ($type$) Math.expm1((double) a));
1460 }
1461
1462 /**
1463 * Calculates the broadcast of Euler's number {@code e} raised to the power
1464 * of this vector minus the broadcast of {@code -1}, selecting lane elements
1465 * controlled by a mask
1466 * More specifically as if the following (ignoring any differences in
1467 * numerical accuracy):
1468 * <pre>{@code
1469 * this.exp(m).sub(this.species().broadcast(1), m)
1470 * }</pre>
1471 * <p>
1472 * Semantics for rounding, monotonicity, and special cases are
1473 * described in {@link $abstractvectortype$#expm1}
1474 *
1475 * @param m the mask controlling lane selection
1476 * @return the broadcast of Euler's number {@code e} raised to the power of
1477 * this vector minus the broadcast of {@code -1}
1478 */
1479 public $abstractvectortype$ expm1(VectorMask<$Boxtype$> m) {
1480 return uOp(m, (i, a) -> ($type$) Math.expm1((double) a));
1481 }
1482
1483 /**
1484 * Calculates the product of this vector and a first input vector summed
1485 * with a second input vector.
1486 * More specifically as if the following (ignoring any differences in
1487 * numerical accuracy):
1488 * <pre>{@code
1489 * this.mul(v1).add(v2)
1490 * }</pre>
1491 * <p>
1492 * This is a vector ternary operation where the {@link Math#fma} operation
1493 * is applied to lane elements.
1494 *
1495 * @param v1 the first input vector
1496 * @param v2 the second input vector
1497 * @return the product of this vector and the first input vector summed with
1498 * the second input vector
1499 */
1500 public abstract $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2);
1501
1502 /**
1503 * Calculates the product of this vector and the broadcast of a first input
1504 * scalar summed with the broadcast of a second input scalar.
1505 * More specifically as if the following:
1506 * <pre>{@code
1507 * this.fma(this.species().broadcast(s1), this.species().broadcast(s2))
1508 * }</pre>
1509 * <p>
1510 * This is a vector ternary operation where the {@link Math#fma} operation
1511 * is applied to lane elements.
1512 *
1513 * @param s1 the first input scalar
1514 * @param s2 the second input scalar
1515 * @return the product of this vector and the broadcast of a first input
1516 * scalar summed with the broadcast of a second input scalar
1517 */
1518 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2);
1519
1520 /**
1521 * Calculates the product of this vector and a first input vector summed
1522 * with a second input vector, selecting lane elements controlled by a mask.
1523 * More specifically as if the following (ignoring any differences in
1524 * numerical accuracy):
1525 * <pre>{@code
1526 * this.mul(v1, m).add(v2, m)
1527 * }</pre>
1528 * <p>
1529 * This is a vector ternary operation where the {@link Math#fma} operation
1530 * is applied to lane elements.
1531 *
1532 * @param v1 the first input vector
1533 * @param v2 the second input vector
1534 * @param m the mask controlling lane selection
1535 * @return the product of this vector and the first input vector summed with
1536 * the second input vector
1537 */
1538 public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
1539 return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
1540 }
1541
1542 /**
1543 * Calculates the product of this vector and the broadcast of a first input
1544 * scalar summed with the broadcast of a second input scalar, selecting lane
1545 * elements controlled by a mask
1546 * More specifically as if the following:
1547 * <pre>{@code
1548 * this.fma(this.species().broadcast(s1), this.species().broadcast(s2), m)
1549 * }</pre>
1550 * <p>
1551 * This is a vector ternary operation where the {@link Math#fma} operation
1552 * is applied to lane elements.
1553 *
1554 * @param s1 the first input scalar
1555 * @param s2 the second input scalar
1556 * @param m the mask controlling lane selection
1557 * @return the product of this vector and the broadcast of a first input
1558 * scalar summed with the broadcast of a second input scalar
1559 */
1560 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, VectorMask<$Boxtype$> m);
1561
1562 /**
1563 * Calculates square root of the sum of the squares of this vector and an
1564 * input vector.
1565 * More specifically as if the following (ignoring any differences in
1566 * numerical accuracy):
1567 * <pre>{@code
1568 * this.mul(this).add(v.mul(v)).sqrt()
1569 * }</pre>
1570 * <p>
1571 * This is a vector binary operation with same semantic definition as
1572 * {@link Math#hypot} operation applied to lane elements.
1573 * The implementation is not required to return same
1574 * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1575 * and special case semantics as defined in the {@link Math#hypot}
1576 * specifications. The computed result will be within 1 ulp of the
1577 * exact result.
1578 *
1579 * @param v the input vector
1580 * @return square root of the sum of the squares of this vector and an input
1581 * vector
1582 */
1583 public $abstractvectortype$ hypot(Vector<$Boxtype$> v) {
1584 return bOp(v, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
1585 }
1586
1587 /**
1588 * Calculates square root of the sum of the squares of this vector and the
1589 * broadcast of an input scalar.
1590 * More specifically as if the following (ignoring any differences in
1591 * numerical accuracy):
1592 * <pre>{@code
1593 * this.mul(this).add(this.species().broadcast(v * v)).sqrt()
1594 * }</pre>
1595 * <p>
1596 * This is a vector binary operation with same semantic definition as
1597 * {@link Math#hypot} operation applied to lane elements.
1598 * The implementation is not required to return same
1599 * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1600 * and special case semantics as defined in the {@link Math#hypot}
1601 * specifications. The computed result will be within 1 ulp of the
1602 * exact result.
1603 *
1604 * @param s the input scalar
1605 * @return square root of the sum of the squares of this vector and the
1606 * broadcast of an input scalar
1607 */
1608 public abstract $abstractvectortype$ hypot($type$ s);
1609
1610 /**
1611 * Calculates square root of the sum of the squares of this vector and an
1612 * input vector, selecting lane elements controlled by a mask.
1613 * More specifically as if the following (ignoring any differences in
1614 * numerical accuracy):
1615 * <pre>{@code
1616 * this.mul(this, m).add(v.mul(v), m).sqrt(m)
1617 * }</pre>
1618 * <p>
1619 * Semantics for rounding, monotonicity, and special cases are
1620 * described in {@link $abstractvectortype$#hypot}
1621 *
1622 * @param v the input vector
1623 * @param m the mask controlling lane selection
1624 * @return square root of the sum of the squares of this vector and an input
1625 * vector
1626 */
1627 public $abstractvectortype$ hypot(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1628 return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
1629 }
1630
1631 /**
1632 * Calculates square root of the sum of the squares of this vector and the
1633 * broadcast of an input scalar, selecting lane elements controlled by a
1634 * mask.
1635 * More specifically as if the following (ignoring any differences in
1636 * numerical accuracy):
1637 * <pre>{@code
1638 * this.mul(this, m).add(this.species().broadcast(v * v), m).sqrt(m)
1639 * }</pre>
1640 * <p>
1641 * Semantics for rounding, monotonicity, and special cases are
1642 * described in {@link $abstractvectortype$#hypot}
1643 *
1644 * @param s the input scalar
1645 * @param m the mask controlling lane selection
1646 * @return square root of the sum of the squares of this vector and the
1647 * broadcast of an input scalar
1648 */
1649 public abstract $abstractvectortype$ hypot($type$ s, VectorMask<$Boxtype$> m);
1650 #end[FP]
1651
1652 #if[BITWISE]
1653
1654 /**
1655 * Bitwise ANDs this vector with an input vector.
1656 * <p>
1657 * This is a vector binary operation where the primitive bitwise AND
1658 * operation ({@code &}) is applied to lane elements.
1659 *
1660 * @param v the input vector
1661 * @return the bitwise AND of this vector with the input vector
1662 */
1663 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v);
1664
1665 /**
1666 * Bitwise ANDs this vector with the broadcast of an input scalar.
1667 * <p>
1668 * This is a vector binary operation where the primitive bitwise AND
1669 * operation ({@code &}) is applied to lane elements.
1670 *
1671 * @param s the input scalar
1672 * @return the bitwise AND of this vector with the broadcast of an input
1673 * scalar
1674 */
1675 public abstract $abstractvectortype$ and($type$ s);
1676
1677 /**
1678 * Bitwise ANDs this vector with an input vector, selecting lane elements
1679 * controlled by a mask.
1680 * <p>
1681 * This is a vector binary operation where the primitive bitwise AND
1682 * operation ({@code &}) is applied to lane elements.
1683 *
1684 * @param v the input vector
1685 * @param m the mask controlling lane selection
1686 * @return the bitwise AND of this vector with the input vector
1687 */
1688 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1689
1690 /**
1691 * Bitwise ANDs this vector with the broadcast of an input scalar, selecting
1692 * lane elements controlled by a mask.
1693 * <p>
1694 * This is a vector binary operation where the primitive bitwise AND
1695 * operation ({@code &}) is applied to lane elements.
1696 *
1697 * @param s the input scalar
1698 * @param m the mask controlling lane selection
1699 * @return the bitwise AND of this vector with the broadcast of an input
1700 * scalar
1701 */
1702 public abstract $abstractvectortype$ and($type$ s, VectorMask<$Boxtype$> m);
1703
1704 /**
1705 * Bitwise ORs this vector with an input vector.
1706 * <p>
1707 * This is a vector binary operation where the primitive bitwise OR
1708 * operation ({@code |}) is applied to lane elements.
1709 *
1710 * @param v the input vector
1711 * @return the bitwise OR of this vector with the input vector
1712 */
1713 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v);
1714
1715 /**
1716 * Bitwise ORs this vector with the broadcast of an input scalar.
1717 * <p>
1718 * This is a vector binary operation where the primitive bitwise OR
1719 * operation ({@code |}) is applied to lane elements.
1720 *
1721 * @param s the input scalar
1722 * @return the bitwise OR of this vector with the broadcast of an input
1723 * scalar
1724 */
1725 public abstract $abstractvectortype$ or($type$ s);
1726
1727 /**
1728 * Bitwise ORs this vector with an input vector, selecting lane elements
1729 * controlled by a mask.
1730 * <p>
1731 * This is a vector binary operation where the primitive bitwise OR
1732 * operation ({@code |}) is applied to lane elements.
1733 *
1734 * @param v the input vector
1735 * @param m the mask controlling lane selection
1736 * @return the bitwise OR of this vector with the input vector
1737 */
1738 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1739
1740 /**
1741 * Bitwise ORs this vector with the broadcast of an input scalar, selecting
1742 * lane elements controlled by a mask.
1743 * <p>
1744 * This is a vector binary operation where the primitive bitwise OR
1745 * operation ({@code |}) is applied to lane elements.
1746 *
1747 * @param s the input scalar
1748 * @param m the mask controlling lane selection
1749 * @return the bitwise OR of this vector with the broadcast of an input
1750 * scalar
1751 */
1752 public abstract $abstractvectortype$ or($type$ s, VectorMask<$Boxtype$> m);
1753
1754 /**
1755 * Bitwise XORs this vector with an input vector.
1756 * <p>
1757 * This is a vector binary operation where the primitive bitwise XOR
1758 * operation ({@code ^}) is applied to lane elements.
1759 *
1760 * @param v the input vector
1761 * @return the bitwise XOR of this vector with the input vector
1762 */
1763 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v);
1764
1765 /**
1766 * Bitwise XORs this vector with the broadcast of an input scalar.
1767 * <p>
1768 * This is a vector binary operation where the primitive bitwise XOR
1769 * operation ({@code ^}) is applied to lane elements.
1770 *
1771 * @param s the input scalar
1772 * @return the bitwise XOR of this vector with the broadcast of an input
1773 * scalar
1774 */
1775 public abstract $abstractvectortype$ xor($type$ s);
1776
1777 /**
1778 * Bitwise XORs this vector with an input vector, selecting lane elements
1779 * controlled by a mask.
1780 * <p>
1781 * This is a vector binary operation where the primitive bitwise XOR
1782 * operation ({@code ^}) is applied to lane elements.
1783 *
1784 * @param v the input vector
1785 * @param m the mask controlling lane selection
1786 * @return the bitwise XOR of this vector with the input vector
1787 */
1788 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1789
1790 /**
1791 * Bitwise XORs this vector with the broadcast of an input scalar, selecting
1792 * lane elements controlled by a mask.
1793 * <p>
1794 * This is a vector binary operation where the primitive bitwise XOR
1795 * operation ({@code ^}) is applied to lane elements.
1796 *
1797 * @param s the input scalar
1798 * @param m the mask controlling lane selection
1799 * @return the bitwise XOR of this vector with the broadcast of an input
1800 * scalar
1801 */
1802 public abstract $abstractvectortype$ xor($type$ s, VectorMask<$Boxtype$> m);
1803
1804 /**
1805 * Bitwise NOTs this vector.
1806 * <p>
1807 * This is a vector unary operation where the primitive bitwise NOT
1808 * operation ({@code ~}) is applied to lane elements.
1809 *
1810 * @return the bitwise NOT of this vector
1811 */
1812 public abstract $abstractvectortype$ not();
1813
1814 /**
1815 * Bitwise NOTs this vector, selecting lane elements controlled by a mask.
1816 * <p>
1817 * This is a vector unary operation where the primitive bitwise NOT
1818 * operation ({@code ~}) is applied to lane elements.
1819 *
1820 * @param m the mask controlling lane selection
1821 * @return the bitwise NOT of this vector
1822 */
1823 public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
1824
1825 #if[byte]
1826 /**
1827 * Logically left shifts this vector by the broadcast of an input scalar.
1828 * <p>
1829 * This is a vector binary operation where the primitive logical left shift
1830 * operation ({@code <<}) is applied to lane elements to left shift the
1831 * element by shift value as specified by the input scalar. Only the 3
1832 * lowest-order bits of shift value are used. It is as if the shift value
1833 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1834 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1835 *
1836 * @param s the input scalar; the number of the bits to left shift
1837 * @return the result of logically left shifting left this vector by the
1838 * broadcast of an input scalar
1839 */
1840 #end[byte]
1841 #if[short]
1842 /**
1843 * Logically left shifts this vector by the broadcast of an input scalar.
1844 * <p>
1845 * This is a vector binary operation where the primitive logical left shift
1846 * operation ({@code <<}) is applied to lane elements to left shift the
1847 * element by shift value as specified by the input scalar. Only the 4
1848 * lowest-order bits of shift value are used. It is as if the shift value
1849 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1850 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1851 *
1852 * @param s the input scalar; the number of the bits to left shift
1853 * @return the result of logically left shifting left this vector by the
1854 * broadcast of an input scalar
1855 */
1856 #end[short]
1857 #if[intOrLong]
1858 /**
1859 * Logically left shifts this vector by the broadcast of an input scalar.
1860 * <p>
1861 * This is a vector binary operation where the primitive logical left shift
1862 * operation ({@code <<}) is applied to lane elements.
1863 *
1864 * @param s the input scalar; the number of the bits to left shift
1865 * @return the result of logically left shifting left this vector by the
1866 * broadcast of an input scalar
1867 */
1868 #end[intOrLong]
1869 public abstract $abstractvectortype$ shiftL(int s);
1870
1871 #if[byte]
1872 /**
1873 * Logically left shifts this vector by the broadcast of an input scalar,
1874 * selecting lane elements controlled by a mask.
1875 * <p>
1876 * This is a vector binary operation where the primitive logical left shift
1877 * operation ({@code <<}) is applied to lane elements to left shift the
1878 * element by shift value as specified by the input scalar. Only the 3
1879 * lowest-order bits of shift value are used. It is as if the shift value
1880 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1881 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1882 *
1883 * @param s the input scalar; the number of the bits to left shift
1884 * @param m the mask controlling lane selection
1885 * @return the result of logically left shifting left this vector by the
1886 * broadcast of an input scalar
1887 */
1888 #end[byte]
1889 #if[short]
1890 /**
1891 * Logically left shifts this vector by the broadcast of an input scalar,
1892 * selecting lane elements controlled by a mask.
1893 * <p>
1894 * This is a vector binary operation where the primitive logical left shift
1895 * operation ({@code <<}) is applied to lane elements to left shift the
1896 * element by shift value as specified by the input scalar. Only the 4
1897 * lowest-order bits of shift value are used. It is as if the shift value
1898 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1899 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1900 *
1901 * @param s the input scalar; the number of the bits to left shift
1902 * @param m the mask controlling lane selection
1903 * @return the result of logically left shifting left this vector by the
1904 * broadcast of an input scalar
1905 */
1906 #end[short]
1907 #if[intOrLong]
1908 /**
1909 * Logically left shifts this vector by the broadcast of an input scalar,
1910 * selecting lane elements controlled by a mask.
1911 * <p>
1912 * This is a vector binary operation where the primitive logical left shift
1913 * operation ({@code <<}) is applied to lane elements.
1914 *
1915 * @param s the input scalar; the number of the bits to left shift
1916 * @param m the mask controlling lane selection
1917 * @return the result of logically left shifting this vector by the
1918 * broadcast of an input scalar
1919 */
1920 #end[intOrLong]
1921 public abstract $abstractvectortype$ shiftL(int s, VectorMask<$Boxtype$> m);
1922
1923 #if[intOrLong]
1924 /**
1925 * Logically left shifts this vector by an input vector.
1926 * <p>
1927 * This is a vector binary operation where the primitive logical left shift
1928 * operation ({@code <<}) is applied to lane elements.
1929 *
1930 * @param v the input vector
1931 * @return the result of logically left shifting this vector by the input
1932 * vector
1933 */
1934 public abstract $abstractvectortype$ shiftL(Vector<$Boxtype$> v);
1935
1936 /**
1937 * Logically left shifts this vector by an input vector, selecting lane
1938 * elements controlled by a mask.
1939 * <p>
1940 * This is a vector binary operation where the primitive logical left shift
1941 * operation ({@code <<}) is applied to lane elements.
1942 *
1943 * @param v the input vector
1944 * @param m the mask controlling lane selection
1945 * @return the result of logically left shifting this vector by the input
1946 * vector
1947 */
1948 public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1949 return bOp(v, m, (i, a, b) -> ($type$) (a << b));
1950 }
1951 #end[intOrLong]
1952
1953 // logical, or unsigned, shift right
1954
1955 #if[byte]
1956 /**
1957 * Logically right shifts (or unsigned right shifts) this vector by the
1958 * broadcast of an input scalar.
1959 * <p>
1960 * This is a vector binary operation where the primitive logical right shift
1961 * operation ({@code >>>}) is applied to lane elements to logically right shift the
1962 * element by shift value as specified by the input scalar. Only the 3
1963 * lowest-order bits of shift value are used. It is as if the shift value
1964 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1965 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1966 *
1967 * @param s the input scalar; the number of the bits to right shift
1968 * @return the result of logically right shifting this vector by the
1969 * broadcast of an input scalar
1970 */
1971 #end[byte]
1972 #if[short]
1973 /**
1974 * Logically right shifts (or unsigned right shifts) this vector by the
1975 * broadcast of an input scalar.
1976 * <p>
1977 * This is a vector binary operation where the primitive logical right shift
1978 * operation ({@code >>>}) is applied to lane elements to logically right shift the
1979 * element by shift value as specified by the input scalar. Only the 4
1980 * lowest-order bits of shift value are used. It is as if the shift value
1981 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1982 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1983 *
1984 * @param s the input scalar; the number of the bits to right shift
1985 * @return the result of logically right shifting this vector by the
1986 * broadcast of an input scalar
1987 */
1988 #end[short]
1989 #if[intOrLong]
1990 /**
1991 * Logically right shifts (or unsigned right shifts) this vector by the
1992 * broadcast of an input scalar.
1993 * <p>
1994 * This is a vector binary operation where the primitive logical right shift
1995 * operation ({@code >>>}) is applied to lane elements.
1996 *
1997 * @param s the input scalar; the number of the bits to right shift
1998 * @return the result of logically right shifting this vector by the
1999 * broadcast of an input scalar
2000 */
2001 #end[intOrLong]
2002 public abstract $abstractvectortype$ shiftR(int s);
2003
2004 #if[byte]
2005 /**
2006 * Logically right shifts (or unsigned right shifts) this vector by the
2007 * broadcast of an input scalar, selecting lane elements controlled by a
2008 * mask.
2009 * <p>
2010 * This is a vector binary operation where the primitive logical right shift
2011 * operation ({@code >>>}) is applied to lane elements to logically right shift the
2012 * element by shift value as specified by the input scalar. Only the 3
2013 * lowest-order bits of shift value are used. It is as if the shift value
2014 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2015 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2016 *
2017 * @param s the input scalar; the number of the bits to right shift
2018 * @param m the mask controlling lane selection
2019 * @return the result of logically right shifting this vector by the
2020 * broadcast of an input scalar
2021 */
2022 #end[byte]
2023 #if[short]
2024 /**
2025 * Logically right shifts (or unsigned right shifts) this vector by the
2026 * broadcast of an input scalar, selecting lane elements controlled by a
2027 * mask.
2028 * <p>
2029 * This is a vector binary operation where the primitive logical right shift
2030 * operation ({@code >>>}) is applied to lane elements to logically right shift the
2031 * element by shift value as specified by the input scalar. Only the 4
2032 * lowest-order bits of shift value are used. It is as if the shift value
2033 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2034 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2035 *
2036 * @param s the input scalar; the number of the bits to right shift
2037 * @param m the mask controlling lane selection
2038 * @return the result of logically right shifting this vector by the
2039 * broadcast of an input scalar
2040 */
2041 #end[short]
2042 #if[intOrLong]
2043 /**
2044 * Logically right shifts (or unsigned right shifts) this vector by the
2045 * broadcast of an input scalar, selecting lane elements controlled by a
2046 * mask.
2047 * <p>
2048 * This is a vector binary operation where the primitive logical right shift
2049 * operation ({@code >>>}) is applied to lane elements.
2050 *
2051 * @param s the input scalar; the number of the bits to right shift
2052 * @param m the mask controlling lane selection
2053 * @return the result of logically right shifting this vector by the
2054 * broadcast of an input scalar
2055 */
2056 #end[intOrLong]
2057 public abstract $abstractvectortype$ shiftR(int s, VectorMask<$Boxtype$> m);
2058
2059 #if[intOrLong]
2060 /**
2061 * Logically right shifts (or unsigned right shifts) this vector by an
2062 * input vector.
2063 * <p>
2064 * This is a vector binary operation where the primitive logical right shift
2065 * operation ({@code >>>}) is applied to lane elements.
2066 *
2067 * @param v the input vector
2068 * @return the result of logically right shifting this vector by the
2069 * input vector
2070 */
2071 public abstract $abstractvectortype$ shiftR(Vector<$Boxtype$> v);
2072
2073 /**
2074 * Logically right shifts (or unsigned right shifts) this vector by an
2075 * input vector, selecting lane elements controlled by a mask.
2076 * <p>
2077 * This is a vector binary operation where the primitive logical right shift
2078 * operation ({@code >>>}) is applied to lane elements.
2079 *
2080 * @param v the input vector
2081 * @param m the mask controlling lane selection
2082 * @return the result of logically right shifting this vector by the
2083 * input vector
2084 */
2085 public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2086 return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
2087 }
2088 #end[intOrLong]
2089
2090 #if[byte]
2091 /**
2092 * Arithmetically right shifts (or signed right shifts) this vector by the
2093 * broadcast of an input scalar.
2094 * <p>
2095 * This is a vector binary operation where the primitive arithmetic right
2096 * shift operation ({@code >>}) is applied to lane elements to arithmetically
2097 * right shift the element by shift value as specified by the input scalar.
2098 * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2099 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2100 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2101 *
2102 * @param s the input scalar; the number of the bits to right shift
2103 * @return the result of arithmetically right shifting this vector by the
2104 * broadcast of an input scalar
2105 */
2106 #end[byte]
2107 #if[short]
2108 /**
2109 * Arithmetically right shifts (or signed right shifts) this vector by the
2110 * broadcast of an input scalar.
2111 * <p>
2112 * This is a vector binary operation where the primitive arithmetic right
2113 * shift operation ({@code >>}) is applied to lane elements to arithmetically
2114 * right shift the element by shift value as specified by the input scalar.
2115 * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2116 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2117 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2118 *
2119 * @param s the input scalar; the number of the bits to right shift
2120 * @return the result of arithmetically right shifting this vector by the
2121 * broadcast of an input scalar
2122 */
2123 #end[short]
2124 #if[intOrLong]
2125 /**
2126 * Arithmetically right shifts (or signed right shifts) this vector by the
2127 * broadcast of an input scalar.
2128 * <p>
2129 * This is a vector binary operation where the primitive arithmetic right
2130 * shift operation ({@code >>}) is applied to lane elements.
2131 *
2132 * @param s the input scalar; the number of the bits to right shift
2133 * @return the result of arithmetically right shifting this vector by the
2134 * broadcast of an input scalar
2135 */
2136 #end[intOrLong]
2137 public abstract $abstractvectortype$ aShiftR(int s);
2138
2139 #if[byte]
2140 /**
2141 * Arithmetically right shifts (or signed right shifts) this vector by the
2142 * broadcast of an input scalar, selecting lane elements controlled by a
2143 * mask.
2144 * <p>
2145 * This is a vector binary operation where the primitive arithmetic right
2146 * shift operation ({@code >>}) is applied to lane elements to arithmetically
2147 * right shift the element by shift value as specified by the input scalar.
2148 * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2149 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2150 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2151 *
2152 * @param s the input scalar; the number of the bits to right shift
2153 * @param m the mask controlling lane selection
2154 * @return the result of arithmetically right shifting this vector by the
2155 * broadcast of an input scalar
2156 */
2157 #end[byte]
2158 #if[short]
2159 /**
2160 * Arithmetically right shifts (or signed right shifts) this vector by the
2161 * broadcast of an input scalar, selecting lane elements controlled by a
2162 * mask.
2163 * <p>
2164 * This is a vector binary operation where the primitive arithmetic right
2165 * shift operation ({@code >>}) is applied to lane elements to arithmetically
2166 * right shift the element by shift value as specified by the input scalar.
2167 * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2168 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2169 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2170 *
2171 * @param s the input scalar; the number of the bits to right shift
2172 * @param m the mask controlling lane selection
2173 * @return the result of arithmetically right shifting this vector by the
2174 * broadcast of an input scalar
2175 */
2176 #end[short]
2177 #if[intOrLong]
2178 /**
2179 * Arithmetically right shifts (or signed right shifts) this vector by the
2180 * broadcast of an input scalar, selecting lane elements controlled by a
2181 * mask.
2182 * <p>
2183 * This is a vector binary operation where the primitive arithmetic right
2184 * shift operation ({@code >>}) is applied to lane elements.
2185 *
2186 * @param s the input scalar; the number of the bits to right shift
2187 * @param m the mask controlling lane selection
2188 * @return the result of arithmetically right shifting this vector by the
2189 * broadcast of an input scalar
2190 */
2191 #end[intOrLong]
2192 public abstract $abstractvectortype$ aShiftR(int s, VectorMask<$Boxtype$> m);
2193
2194 #if[intOrLong]
2195 /**
2196 * Arithmetically right shifts (or signed right shifts) this vector by an
2197 * input vector.
2198 * <p>
2199 * This is a vector binary operation where the primitive arithmetic right
2200 * shift operation ({@code >>}) is applied to lane elements.
2201 *
2202 * @param v the input vector
2203 * @return the result of arithmetically right shifting this vector by the
2204 * input vector
2205 */
2206 public abstract $abstractvectortype$ aShiftR(Vector<$Boxtype$> v);
2207
2208 /**
2209 * Arithmetically right shifts (or signed right shifts) this vector by an
2210 * input vector, selecting lane elements controlled by a mask.
2211 * <p>
2212 * This is a vector binary operation where the primitive arithmetic right
2213 * shift operation ({@code >>}) is applied to lane elements.
2214 *
2215 * @param v the input vector
2216 * @param m the mask controlling lane selection
2217 * @return the result of arithmetically right shifting this vector by the
2218 * input vector
2219 */
2220 public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2221 return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
2222 }
2223
2224 /**
2225 * Rotates left this vector by the broadcast of an input scalar.
2226 * <p>
2227 * This is a vector binary operation where the operation
2228 * {@link $Wideboxtype$#rotateLeft} is applied to lane elements and where
2229 * lane elements of this vector apply to the first argument, and lane
2230 * elements of the broadcast vector apply to the second argument (the
2231 * rotation distance).
2232 *
2233 * @param s the input scalar; the number of the bits to rotate left
2234 * @return the result of rotating left this vector by the broadcast of an
2235 * input scalar
2236 */
2237 @ForceInline
2238 public final $abstractvectortype$ rotateL(int s) {
2239 return shiftL(s).or(shiftR(-s));
2240 }
2241
2242 /**
2243 * Rotates left this vector by the broadcast of an input scalar, selecting
2244 * lane elements controlled by a mask.
2245 * <p>
2246 * This is a vector binary operation where the operation
2247 * {@link $Wideboxtype$#rotateLeft} is applied to lane elements and where
2248 * lane elements of this vector apply to the first argument, and lane
2249 * elements of the broadcast vector apply to the second argument (the
2250 * rotation distance).
2251 *
2252 * @param s the input scalar; the number of the bits to rotate left
2253 * @param m the mask controlling lane selection
2254 * @return the result of rotating left this vector by the broadcast of an
2255 * input scalar
2256 */
2257 @ForceInline
2258 public final $abstractvectortype$ rotateL(int s, VectorMask<$Boxtype$> m) {
2259 return shiftL(s, m).or(shiftR(-s, m), m);
2260 }
2261
2262 /**
2263 * Rotates right this vector by the broadcast of an input scalar.
2264 * <p>
2265 * This is a vector binary operation where the operation
2266 * {@link $Wideboxtype$#rotateRight} is applied to lane elements and where
2267 * lane elements of this vector apply to the first argument, and lane
2268 * elements of the broadcast vector apply to the second argument (the
2269 * rotation distance).
2270 *
2271 * @param s the input scalar; the number of the bits to rotate right
2272 * @return the result of rotating right this vector by the broadcast of an
2273 * input scalar
2274 */
2275 @ForceInline
2276 public final $abstractvectortype$ rotateR(int s) {
2277 return shiftR(s).or(shiftL(-s));
2278 }
2279
2280 /**
2281 * Rotates right this vector by the broadcast of an input scalar, selecting
2282 * lane elements controlled by a mask.
2283 * <p>
2284 * This is a vector binary operation where the operation
2285 * {@link $Wideboxtype$#rotateRight} is applied to lane elements and where
2286 * lane elements of this vector apply to the first argument, and lane
2287 * elements of the broadcast vector apply to the second argument (the
2288 * rotation distance).
2289 *
2290 * @param s the input scalar; the number of the bits to rotate right
2291 * @param m the mask controlling lane selection
2292 * @return the result of rotating right this vector by the broadcast of an
2293 * input scalar
2294 */
2295 @ForceInline
2296 public final $abstractvectortype$ rotateR(int s, VectorMask<$Boxtype$> m) {
2297 return shiftR(s, m).or(shiftL(-s, m), m);
2298 }
2299 #end[intOrLong]
2300 #end[BITWISE]
2301
2302 @Override
2303 public abstract void intoByteArray(byte[] a, int ix);
2304
2305 @Override
2306 public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
2307
2308 @Override
2309 public abstract void intoByteBuffer(ByteBuffer bb, int ix);
2310
2311 @Override
2312 public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<$Boxtype$> m);
2313
2314
2315 // Type specific horizontal reductions
2316 /**
2317 * Adds all lane elements of this vector.
2318 * <p>
2319 #if[FP]
2320 * This is a vector reduction operation where the addition
2321 * operation ({@code +}) is applied to lane elements,
2322 * and the identity value is {@code 0.0}.
2323 *
2324 * <p>The value of a floating-point sum is a function both of the input values as well
2325 * as the order of addition operations. The order of addition operations of this method
2326 * is intentionally not defined to allow for JVM to generate optimal machine
2327 * code for the underlying platform at runtime. If the platform supports a vector
2328 * instruction to add all values in the vector, or if there is some other efficient machine
2329 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2330 * the default implementation of adding vectors sequentially from left to right is used.
2331 * For this reason, the output of this method may vary for the same input values.
2332 #else[FP]
2333 * This is an associative vector reduction operation where the addition
2334 * operation ({@code +}) is applied to lane elements,
2335 * and the identity value is {@code 0}.
2336 #end[FP]
2337 *
2338 * @return the addition of all the lane elements of this vector
2339 */
2340 public abstract $type$ addAll();
2341
2342 /**
2343 * Adds all lane elements of this vector, selecting lane elements
2344 * controlled by a mask.
2345 * <p>
2346 #if[FP]
2347 * This is a vector reduction operation where the addition
2348 * operation ({@code +}) is applied to lane elements,
2349 * and the identity value is {@code 0.0}.
2350 *
2351 * <p>The value of a floating-point sum is a function both of the input values as well
2352 * as the order of addition operations. The order of addition operations of this method
2353 * is intentionally not defined to allow for JVM to generate optimal machine
2354 * code for the underlying platform at runtime. If the platform supports a vector
2355 * instruction to add all values in the vector, or if there is some other efficient machine
2356 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2357 * the default implementation of adding vectors sequentially from left to right is used.
2358 * For this reason, the output of this method may vary on the same input values.
2359 #else[FP]
2360 * This is an associative vector reduction operation where the addition
2361 * operation ({@code +}) is applied to lane elements,
2362 * and the identity value is {@code 0}.
2363 #end[FP]
2364 *
2365 * @param m the mask controlling lane selection
2366 * @return the addition of the selected lane elements of this vector
2367 */
2368 public abstract $type$ addAll(VectorMask<$Boxtype$> m);
2369
2370 /**
2371 * Multiplies all lane elements of this vector.
2372 * <p>
2373 #if[FP]
2374 * This is a vector reduction operation where the
2375 * multiplication operation ({@code *}) is applied to lane elements,
2376 * and the identity value is {@code 1.0}.
2377 *
2378 * <p>The order of multiplication operations of this method
2379 * is intentionally not defined to allow for JVM to generate optimal machine
2380 * code for the underlying platform at runtime. If the platform supports a vector
2381 * instruction to multiply all values in the vector, or if there is some other efficient machine
2382 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2383 * the default implementation of multiplying vectors sequentially from left to right is used.
2384 * For this reason, the output of this method may vary on the same input values.
2385 #else[FP]
2386 * This is an associative vector reduction operation where the
2387 * multiplication operation ({@code *}) is applied to lane elements,
2388 * and the identity value is {@code 1}.
2389 #end[FP]
2390 *
2391 * @return the multiplication of all the lane elements of this vector
2392 */
2393 public abstract $type$ mulAll();
2394
2395 /**
2396 * Multiplies all lane elements of this vector, selecting lane elements
2397 * controlled by a mask.
2398 * <p>
2399 #if[FP]
2400 * This is a vector reduction operation where the
2401 * multiplication operation ({@code *}) is applied to lane elements,
2402 * and the identity value is {@code 1.0}.
2403 *
2404 * <p>The order of multiplication operations of this method
2405 * is intentionally not defined to allow for JVM to generate optimal machine
2406 * code for the underlying platform at runtime. If the platform supports a vector
2407 * instruction to multiply all values in the vector, or if there is some other efficient machine
2408 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2409 * the default implementation of multiplying vectors sequentially from left to right is used.
2410 * For this reason, the output of this method may vary on the same input values.
2411 #else[FP]
2412 * This is an associative vector reduction operation where the
2413 * multiplication operation ({@code *}) is applied to lane elements,
2414 * and the identity value is {@code 1}.
2415 #end[FP]
2416 *
2417 * @param m the mask controlling lane selection
2418 * @return the multiplication of all the lane elements of this vector
2419 */
2420 public abstract $type$ mulAll(VectorMask<$Boxtype$> m);
2421
2422 /**
2423 * Returns the minimum lane element of this vector.
2424 * <p>
2425 * This is an associative vector reduction operation where the operation
2426 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
2427 * and the identity value is
2428 #if[FP]
2429 * {@link $Boxtype$#POSITIVE_INFINITY}.
2430 #else[FP]
2431 * {@link $Boxtype$#MAX_VALUE}.
2432 #end[FP]
2433 *
2434 * @return the minimum lane element of this vector
2435 */
2436 public abstract $type$ minAll();
2437
2438 /**
2439 * Returns the minimum lane element of this vector, selecting lane elements
2440 * controlled by a mask.
2441 * <p>
2442 * This is an associative vector reduction operation where the operation
2443 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements,
2444 * and the identity value is
2445 #if[FP]
2446 * {@link $Boxtype$#POSITIVE_INFINITY}.
2447 #else[FP]
2448 * {@link $Boxtype$#MAX_VALUE}.
2449 #end[FP]
2450 *
2451 * @param m the mask controlling lane selection
2452 * @return the minimum lane element of this vector
2453 */
2454 public abstract $type$ minAll(VectorMask<$Boxtype$> m);
2455
2456 /**
2457 * Returns the maximum lane element of this vector.
2458 * <p>
2459 * This is an associative vector reduction operation where the operation
2460 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
2461 * and the identity value is
2462 #if[FP]
2463 * {@link $Boxtype$#NEGATIVE_INFINITY}.
2464 #else[FP]
2465 * {@link $Boxtype$#MIN_VALUE}.
2466 #end[FP]
2467 *
2468 * @return the maximum lane element of this vector
2469 */
2470 public abstract $type$ maxAll();
2471
2472 /**
2473 * Returns the maximum lane element of this vector, selecting lane elements
2474 * controlled by a mask.
2475 * <p>
2476 * This is an associative vector reduction operation where the operation
2477 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements,
2478 * and the identity value is
2479 #if[FP]
2480 * {@link $Boxtype$#NEGATIVE_INFINITY}.
2481 #else[FP]
2482 * {@link $Boxtype$#MIN_VALUE}.
2483 #end[FP]
2484 *
2485 * @param m the mask controlling lane selection
2486 * @return the maximum lane element of this vector
2487 */
2488 public abstract $type$ maxAll(VectorMask<$Boxtype$> m);
2489
2490 #if[BITWISE]
2491 /**
2492 * Logically ORs all lane elements of this vector.
2493 * <p>
2494 * This is an associative vector reduction operation where the logical OR
2495 * operation ({@code |}) is applied to lane elements,
2496 * and the identity value is {@code 0}.
2497 *
2498 * @return the logical OR all the lane elements of this vector
2499 */
2500 public abstract $type$ orAll();
2501
2502 /**
2503 * Logically ORs all lane elements of this vector, selecting lane elements
2504 * controlled by a mask.
2505 * <p>
2506 * This is an associative vector reduction operation where the logical OR
2507 * operation ({@code |}) is applied to lane elements,
2508 * and the identity value is {@code 0}.
2509 *
2510 * @param m the mask controlling lane selection
2511 * @return the logical OR all the lane elements of this vector
2512 */
2513 public abstract $type$ orAll(VectorMask<$Boxtype$> m);
2514
2515 /**
2516 * Logically ANDs all lane elements of this vector.
2517 * <p>
2518 * This is an associative vector reduction operation where the logical AND
2519 * operation ({@code |}) is applied to lane elements,
2520 * and the identity value is {@code -1}.
2521 *
2522 * @return the logical AND all the lane elements of this vector
2523 */
2524 public abstract $type$ andAll();
2525
2526 /**
2527 * Logically ANDs all lane elements of this vector, selecting lane elements
2528 * controlled by a mask.
2529 * <p>
2530 * This is an associative vector reduction operation where the logical AND
2531 * operation ({@code |}) is applied to lane elements,
2532 * and the identity value is {@code -1}.
2533 *
2534 * @param m the mask controlling lane selection
2535 * @return the logical AND all the lane elements of this vector
2536 */
2537 public abstract $type$ andAll(VectorMask<$Boxtype$> m);
2538
2539 /**
2540 * Logically XORs all lane elements of this vector.
2541 * <p>
2542 * This is an associative vector reduction operation where the logical XOR
2543 * operation ({@code ^}) is applied to lane elements,
2544 * and the identity value is {@code 0}.
2545 *
2546 * @return the logical XOR all the lane elements of this vector
2547 */
2548 public abstract $type$ xorAll();
2549
2550 /**
2551 * Logically XORs all lane elements of this vector, selecting lane elements
2552 * controlled by a mask.
2553 * <p>
2554 * This is an associative vector reduction operation where the logical XOR
2555 * operation ({@code ^}) is applied to lane elements,
2556 * and the identity value is {@code 0}.
2557 *
2558 * @param m the mask controlling lane selection
2559 * @return the logical XOR all the lane elements of this vector
2560 */
2561 public abstract $type$ xorAll(VectorMask<$Boxtype$> m);
2562 #end[BITWISE]
2563
2564 // Type specific accessors
2565
2566 /**
2567 * Gets the lane element at lane index {@code i}
2568 *
2569 * @param i the lane index
2570 * @return the lane element at lane index {@code i}
2571 * @throws IllegalArgumentException if the index is is out of range
2572 * ({@code < 0 || >= length()})
2573 */
2574 public abstract $type$ get(int i);
2575
2576 /**
2577 * Replaces the lane element of this vector at lane index {@code i} with
2578 * value {@code e}.
2579 * <p>
2580 * This is a cross-lane operation and behaves as if it returns the result
2581 * of blending this vector with an input vector that is the result of
2582 * broadcasting {@code e} and a mask that has only one lane set at lane
2583 * index {@code i}.
2584 *
2585 * @param i the lane index of the lane element to be replaced
2586 * @param e the value to be placed
2587 * @return the result of replacing the lane element of this vector at lane
2588 * index {@code i} with value {@code e}.
2589 * @throws IllegalArgumentException if the index is is out of range
2590 * ({@code < 0 || >= length()})
2591 */
2592 public abstract $abstractvectortype$ with(int i, $type$ e);
2593
2594 // Type specific extractors
2601 * <pre>{@code
2602 * $type$[] a = new $type$[this.length()];
2603 * this.intoArray(a, 0);
2604 * return a;
2605 * }</pre>
2606 *
2607 * @return an array containing the the lane elements of this vector
2608 */
2609 @ForceInline
2610 public final $type$[] toArray() {
2611 $type$[] a = new $type$[species().length()];
2612 intoArray(a, 0);
2613 return a;
2614 }
2615
2616 /**
2617 * Stores this vector into an array starting at offset.
2618 * <p>
2619 * For each vector lane, where {@code N} is the vector lane index,
2620 * the lane element at index {@code N} is stored into the array at index
2621 * {@code i + N}.
2622 *
2623 * @param a the array
2624 * @param i the offset into the array
2625 * @throws IndexOutOfBoundsException if {@code i < 0}, or
2626 * {@code i > a.length - this.length()}
2627 */
2628 public abstract void intoArray($type$[] a, int i);
2629
2630 /**
2631 * Stores this vector into an array starting at offset and using a mask.
2632 * <p>
2633 * For each vector lane, where {@code N} is the vector lane index,
2634 * if the mask lane at index {@code N} is set then the lane element at
2635 * index {@code N} is stored into the array index {@code i + N}.
2636 *
2637 * @param a the array
2638 * @param i the offset into the array
2639 * @param m the mask
2640 * @throws IndexOutOfBoundsException if {@code i < 0}, or
2641 * for any vector lane index {@code N} where the mask at lane {@code N}
2642 * is set {@code i >= a.length - N}
2643 */
2644 public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m);
2645
2646 /**
2647 * Stores this vector into an array using indexes obtained from an index
2648 * map.
2649 * <p>
2650 * For each vector lane, where {@code N} is the vector lane index, the
2651 * lane element at index {@code N} is stored into the array at index
2652 * {@code i + indexMap[j + N]}.
2653 *
2654 * @param a the array
2655 * @param i the offset into the array, may be negative if relative
2656 * indexes in the index map compensate to produce a value within the
2657 * array bounds
2658 * @param indexMap the index map
2659 * @param j the offset into the index map
2660 * @throws IndexOutOfBoundsException if {@code j < 0}, or
2661 * {@code j > indexMap.length - this.length()},
2662 * or for any vector lane index {@code N} the result of
2663 * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length}
2664 */
2665 #if[byteOrShort]
2666 public void intoArray($type$[] a, int i, int[] indexMap, int j) {
2667 forEach((n, e) -> a[i + indexMap[j + n]] = e);
2668 }
2669 #else[byteOrShort]
2670 public abstract void intoArray($type$[] a, int i, int[] indexMap, int j);
2671 #end[byteOrShort]
2672
2673 /**
2674 * Stores this vector into an array using indexes obtained from an index
2675 * map and using a mask.
2676 * <p>
2677 * For each vector lane, where {@code N} is the vector lane index,
2678 * if the mask lane at index {@code N} is set then the lane element at
2679 * index {@code N} is stored into the array at index
2680 * {@code i + indexMap[j + N]}.
2681 *
2682 * @param a the array
2683 * @param i the offset into the array, may be negative if relative
2684 * indexes in the index map compensate to produce a value within the
2685 * array bounds
2686 * @param m the mask
2687 * @param indexMap the index map
2688 * @param j the offset into the index map
2689 * @throws IndexOutOfBoundsException if {@code j < 0}, or
2690 * {@code j > indexMap.length - this.length()},
2691 * or for any vector lane index {@code N} where the mask at lane
2692 * {@code N} is set the result of {@code i + indexMap[j + N]} is
2693 * {@code < 0} or {@code >= a.length}
2694 */
2695 #if[byteOrShort]
2696 public void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j) {
2697 forEach(m, (n, e) -> a[i + indexMap[j + n]] = e);
2698 }
2699 #else[byteOrShort]
2700 public abstract void intoArray($type$[] a, int i, VectorMask<$Boxtype$> m, int[] indexMap, int j);
2701 #end[byteOrShort]
2702 // Species
2703
2704 @Override
2705 public abstract VectorSpecies<$Boxtype$> species();
2706
2707 /**
2708 * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
2709 */
2710 static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
2711 final Function<$type$[], $Type$Vector> vectorFactory;
2712
2713 private $Type$Species(VectorShape shape,
2714 Class<?> boxType,
2715 Class<?> maskType,
2716 Function<$type$[], $Type$Vector> vectorFactory,
2717 Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
2718 Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
2719 fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
2720 super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType, maskFactory,
|
116 public static $abstractvectortype$ zero(VectorSpecies<$Boxtype$> species) {
117 #if[FP]
118 return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
119 $Type$.$type$To$Bitstype$Bits(0.0f), species,
120 ((bits, s) -> (($Type$Species)s).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
121 #else[FP]
122 return VectorIntrinsics.broadcastCoerced((Class<$Type$Vector>) species.boxType(), $type$.class, species.length(),
123 0, species,
124 ((bits, s) -> (($Type$Species)s).op(i -> ($type$)bits)));
125 #end[FP]
126 }
127
128 /**
129 * Loads a vector from a byte array starting at an offset.
130 * <p>
131 * Bytes are composed into primitive lane elements according to the
132 * native byte order of the underlying platform
133 * <p>
134 * This method behaves as if it returns the result of calling the
135 * byte buffer, offset, and mask accepting
136 * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
137 * <pre>{@code
138 * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue());
139 * }</pre>
140 *
141 * @param species species of desired vector
142 * @param a the byte array
143 * @param offset the offset into the array
144 * @return a vector loaded from a byte array
145 * @throws IndexOutOfBoundsException if {@code i < 0} or
146 * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)}
147 */
148 @ForceInline
149 @SuppressWarnings("unchecked")
150 public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset) {
151 Objects.requireNonNull(a);
152 offset = VectorIntrinsics.checkIndex(offset, a.length, species.bitSize() / Byte.SIZE);
153 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
154 a, ((long) offset) + Unsafe.ARRAY_BYTE_BASE_OFFSET,
155 a, offset, species,
156 (c, idx, s) -> {
157 ByteBuffer bbc = ByteBuffer.wrap(c, idx, a.length - idx).order(ByteOrder.nativeOrder());
158 $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
159 return (($Type$Species)s).op(i -> tb.get());
160 });
161 }
162
163 /**
164 * Loads a vector from a byte array starting at an offset and using a
165 * mask.
166 * <p>
167 * Bytes are composed into primitive lane elements according to the
168 * native byte order of the underlying platform.
169 * <p>
170 * This method behaves as if it returns the result of calling the
171 * byte buffer, offset, and mask accepting
172 * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows:
173 * <pre>{@code
174 * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, m);
175 * }</pre>
176 *
177 * @param species species of desired vector
178 * @param a the byte array
179 * @param offset the offset into the array
180 * @param m the mask
181 * @return a vector loaded from a byte array
182 * @throws IndexOutOfBoundsException if {@code offset < 0} or
183 * for any vector lane index {@code N} where the mask at lane {@code N}
184 * is set
185 * {@code offset >= a.length - (N * species.elementSize() / Byte.SIZE)}
186 */
187 @ForceInline
188 public static $abstractvectortype$ fromByteArray(VectorSpecies<$Boxtype$> species, byte[] a, int offset, VectorMask<$Boxtype$> m) {
189 return zero(species).blend(fromByteArray(species, a, offset), m);
190 }
191
192 /**
193 * Loads a vector from an array starting at offset.
194 * <p>
195 * For each vector lane, where {@code N} is the vector lane index, the
196 * array element at index {@code offset + N} is placed into the
197 * resulting vector at lane index {@code N}.
198 *
199 * @param species species of desired vector
200 * @param a the array
201 * @param offset the offset into the array
202 * @return the vector loaded from an array
203 * @throws IndexOutOfBoundsException if {@code offset < 0}, or
204 * {@code offset > a.length - species.length()}
205 */
206 @ForceInline
207 @SuppressWarnings("unchecked")
208 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset){
209 Objects.requireNonNull(a);
210 offset = VectorIntrinsics.checkIndex(offset, a.length, species.length());
211 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
212 a, (((long) offset) << ARRAY_SHIFT) + Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
213 a, offset, species,
214 (c, idx, s) -> (($Type$Species)s).op(n -> c[idx + n]));
215 }
216
217
218 /**
219 * Loads a vector from an array starting at offset and using a mask.
220 * <p>
221 * For each vector lane, where {@code N} is the vector lane index,
222 * if the mask lane at index {@code N} is set then the array element at
223 * index {@code offset + N} is placed into the resulting vector at lane index
224 * {@code N}, otherwise the default element value is placed into the
225 * resulting vector at lane index {@code N}.
226 *
227 * @param species species of desired vector
228 * @param a the array
229 * @param offset the offset into the array
230 * @param m the mask
231 * @return the vector loaded from an array
232 * @throws IndexOutOfBoundsException if {@code offset < 0}, or
233 * for any vector lane index {@code N} where the mask at lane {@code N}
234 * is set {@code offset > a.length - N}
235 */
236 @ForceInline
237 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int offset, VectorMask<$Boxtype$> m) {
238 return zero(species).blend(fromArray(species, a, offset), m);
239 }
240
241 /**
242 * Loads a vector from an array using indexes obtained from an index
243 * map.
244 * <p>
245 * For each vector lane, where {@code N} is the vector lane index, the
246 * array element at index {@code a_offset + indexMap[i_offset + N]} is placed into the
247 * resulting vector at lane index {@code N}.
248 *
249 * @param species species of desired vector
250 * @param a the array
251 * @param a_offset the offset into the array, may be negative if relative
252 * indexes in the index map compensate to produce a value within the
253 * array bounds
254 * @param indexMap the index map
255 * @param i_offset the offset into the index map
256 * @return the vector loaded from an array
257 * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
258 * {@code i_offset > indexMap.length - species.length()},
259 * or for any vector lane index {@code N} the result of
260 * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
261 */
262 #if[byteOrShort]
263 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) {
264 return (($Type$Species)species).op(n -> a[a_offset + indexMap[i_offset + n]]);
265 }
266 #else[byteOrShort]
267 @ForceInline
268 @SuppressWarnings("unchecked")
269 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, int[] indexMap, int i_offset) {
270 Objects.requireNonNull(a);
271 Objects.requireNonNull(indexMap);
272
273 #if[longOrDouble]
274 if (species.length() == 1) {
275 return $abstractvectortype$.fromArray(species, a, a_offset + indexMap[i_offset]);
276 }
277 #end[longOrDouble]
278
279 // Index vector: vix[0:n] = k -> a_offset + indexMap[i_offset + k]
280 IntVector vix = IntVector.fromArray(IntVector.species(species.indexShape()), indexMap, i_offset).add(a_offset);
281
282 vix = VectorIntrinsics.checkIndex(vix, a.length);
283
284 return VectorIntrinsics.loadWithMap((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
285 IntVector.species(species.indexShape()).boxType(), a, Unsafe.ARRAY_$TYPE$_BASE_OFFSET, vix,
286 a, a_offset, indexMap, i_offset, species,
287 ($type$[] c, int idx, int[] iMap, int idy, VectorSpecies<$Boxtype$> s) ->
288 (($Type$Species)s).op(n -> c[idx + iMap[idy+n]]));
289 }
290
291 #end[byteOrShort]
292 /**
293 * Loads a vector from an array using indexes obtained from an index
294 * map and using a mask.
295 * <p>
296 * For each vector lane, where {@code N} is the vector lane index,
297 * if the mask lane at index {@code N} is set then the array element at
298 * index {@code a_offset + indexMap[i_offset + N]} is placed into the resulting vector
299 * at lane index {@code N}.
300 *
301 * @param species species of desired vector
302 * @param a the array
303 * @param a_offset the offset into the array, may be negative if relative
304 * indexes in the index map compensate to produce a value within the
305 * array bounds
306 * @param m the mask
307 * @param indexMap the index map
308 * @param i_offset the offset into the index map
309 * @return the vector loaded from an array
310 * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
311 * {@code i_offset > indexMap.length - species.length()},
312 * or for any vector lane index {@code N} where the mask at lane
313 * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
314 * {@code < 0} or {@code >= a.length}
315 */
316 #if[byteOrShort]
317 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset) {
318 return (($Type$Species)species).op(m, n -> a[a_offset + indexMap[i_offset + n]]);
319 }
320 #else[byteOrShort]
321 @ForceInline
322 @SuppressWarnings("unchecked")
323 public static $abstractvectortype$ fromArray(VectorSpecies<$Boxtype$> species, $type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset) {
324 // @@@ This can result in out of bounds errors for unset mask lanes
325 return zero(species).blend(fromArray(species, a, a_offset, indexMap, i_offset), m);
326 }
327
328 #end[byteOrShort]
329
330 /**
331 * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
332 * offset into the byte buffer.
333 * <p>
334 * Bytes are composed into primitive lane elements according to the
335 * native byte order of the underlying platform.
336 * <p>
337 * This method behaves as if it returns the result of calling the
338 * byte buffer, offset, and mask accepting
339 * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask)} method} as follows:
340 * <pre>{@code
341 * return fromByteBuffer(b, offset, VectorMask.allTrue())
342 * }</pre>
343 *
344 * @param species species of desired vector
345 * @param bb the byte buffer
346 * @param offset the offset into the byte buffer
347 * @return a vector loaded from a byte buffer
348 * @throws IndexOutOfBoundsException if the offset is {@code < 0},
349 * or {@code > b.limit()},
350 * or if there are fewer than
351 * {@code species.length() * species.elementSize() / Byte.SIZE} bytes
352 * remaining in the byte buffer from the given offset
353 */
354 @ForceInline
355 @SuppressWarnings("unchecked")
356 public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset) {
357 if (bb.order() != ByteOrder.nativeOrder()) {
358 throw new IllegalArgumentException();
359 }
360 offset = VectorIntrinsics.checkIndex(offset, bb.limit(), species.bitSize() / Byte.SIZE);
361 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
362 U.getReference(bb, BYTE_BUFFER_HB), U.getLong(bb, BUFFER_ADDRESS) + offset,
363 bb, offset, species,
364 (c, idx, s) -> {
365 ByteBuffer bbc = c.duplicate().position(idx).order(ByteOrder.nativeOrder());
366 $Type$Buffer tb = bbc{#if[byte]?;:.as$Type$Buffer();}
367 return (($Type$Species)s).op(i -> tb.get());
368 });
369 }
370
371 /**
372 * Loads a vector from a {@link ByteBuffer byte buffer} starting at an
373 * offset into the byte buffer and using a mask.
374 * <p>
375 * This method behaves as if the byte buffer is viewed as a primitive
376 * {@link java.nio.Buffer buffer} for the primitive element type,
377 * according to the native byte order of the underlying platform, and
378 * the returned vector is loaded with a mask from a primitive array
379 * obtained from the primitive buffer.
380 * The following pseudocode expresses the behaviour, where
381 * {@code EBuffer} is the primitive buffer type, {@code e} is the
382 * primitive element type, and {@code ESpecies} is the primitive
383 * species for {@code e}:
384 * <pre>{@code
385 * EBuffer eb = b.duplicate().
386 * order(ByteOrder.nativeOrder()).position(offset).
387 * asEBuffer();
388 * e[] es = new e[species.length()];
389 * for (int n = 0; n < t.length; n++) {
390 * if (m.isSet(n))
391 * es[n] = eb.get(n);
392 * }
393 * EVector r = EVector.fromArray(es, 0, m);
394 * }</pre>
395 *
396 * @param species species of desired vector
397 * @param bb the byte buffer
398 * @param offset the offset into the byte buffer
399 * @param m the mask
400 * @return a vector loaded from a byte buffer
401 * @throws IndexOutOfBoundsException if the offset is {@code < 0},
402 * or {@code > b.limit()},
403 * for any vector lane index {@code N} where the mask at lane {@code N}
404 * is set
405 * {@code offset >= b.limit() - (N * species.elementSize() / Byte.SIZE)}
406 */
407 @ForceInline
408 public static $abstractvectortype$ fromByteBuffer(VectorSpecies<$Boxtype$> species, ByteBuffer bb, int offset, VectorMask<$Boxtype$> m) {
409 return zero(species).blend(fromByteBuffer(species, bb, offset), m);
410 }
411
412 /**
413 * Returns a vector where all lane elements are set to the primitive
414 * value {@code e}.
415 *
416 * @param species species of the desired vector
417 * @param e the value
418 * @return a vector of vector where all lane elements are set to
419 * the primitive value {@code e}
420 */
421 #if[FP]
422 @ForceInline
423 @SuppressWarnings("unchecked")
424 public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
425 return VectorIntrinsics.broadcastCoerced(
426 (Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
427 $Type$.$type$To$Bitstype$Bits(e), species,
428 ((bits, sp) -> (($Type$Species)sp).op(i -> $Type$.$bitstype$BitsTo$Type$(($bitstype$)bits))));
429 }
430 #else[FP]
431 @ForceInline
432 @SuppressWarnings("unchecked")
433 public static $abstractvectortype$ broadcast(VectorSpecies<$Boxtype$> species, $type$ e) {
434 return VectorIntrinsics.broadcastCoerced(
435 (Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
436 e, species,
437 ((bits, sp) -> (($Type$Species)sp).op(i -> ($type$)bits)));
438 }
439 #end[FP]
440
441 /**
442 * Returns a vector where each lane element is set to given
443 * primitive values.
444 * <p>
445 * For each vector lane, where {@code N} is the vector lane index, the
446 * the primitive value at index {@code N} is placed into the resulting
447 * vector at lane index {@code N}.
448 *
449 * @param species species of the desired vector
450 * @param es the given primitive values
451 * @return a vector where each lane element is set to given primitive
452 * values
453 * @throws IndexOutOfBoundsException if {@code es.length < species.length()}
454 */
455 @ForceInline
456 @SuppressWarnings("unchecked")
457 public static $abstractvectortype$ scalars(VectorSpecies<$Boxtype$> species, $type$... es) {
458 Objects.requireNonNull(es);
459 int ix = VectorIntrinsics.checkIndex(0, es.length, species.length());
460 return VectorIntrinsics.load((Class<$abstractvectortype$>) species.boxType(), $type$.class, species.length(),
461 es, Unsafe.ARRAY_$TYPE$_BASE_OFFSET,
462 es, ix, species,
463 (c, idx, sp) -> (($Type$Species)sp).op(n -> c[idx + n]));
464 }
465
466 /**
467 * Returns a vector where the first lane element is set to the primtive
468 * value {@code e}, all other lane elements are set to the default
469 * value.
470 *
471 * @param species species of the desired vector
472 * @param e the value
473 * @return a vector where the first lane element is set to the primitive
474 * value {@code e}
475 */
476 @ForceInline
477 public static final $abstractvectortype$ single(VectorSpecies<$Boxtype$> species, $type$ e) {
478 return zero(species).with(0, e);
479 }
480
481 /**
482 * Returns a vector where each lane element is set to a randomly
483 * generated primitive value.
484 *
485 * The semantics are equivalent to calling
486 #if[byteOrShort]
487 * ($type$){@link ThreadLocalRandom#nextInt()}
488 #else[byteOrShort]
489 * {@link ThreadLocalRandom#next$Type$()}
490 #end[byteOrShort]
491 *
492 * @param species species of the desired vector
493 * @return a vector where each lane elements is set to a randomly
494 * generated primitive value
495 */
496 #if[intOrLong]
497 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) {
498 ThreadLocalRandom r = ThreadLocalRandom.current();
499 return (($Type$Species)species).op(i -> r.next$Type$());
500 }
501 #else[intOrLong]
502 #if[FP]
503 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) {
504 ThreadLocalRandom r = ThreadLocalRandom.current();
505 return (($Type$Species)species).op(i -> r.next$Type$());
506 }
507 #else[FP]
508 public static $abstractvectortype$ random(VectorSpecies<$Boxtype$> species) {
509 ThreadLocalRandom r = ThreadLocalRandom.current();
510 return (($Type$Species)species).op(i -> ($type$) r.nextInt());
511 }
512 #end[FP]
513 #end[intOrLong]
514
515 // Ops
516
517 @Override
518 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v);
519
520 /**
521 * Adds this vector to the broadcast of an input scalar.
522 * <p>
523 * This is a lane-wise binary operation which applies the primitive addition operation
524 * ({@code +}) to each lane.
525 *
526 * @param s the input scalar
527 * @return the result of adding this vector to the broadcast of an input
528 * scalar
529 */
530 public abstract $abstractvectortype$ add($type$ s);
531
532 @Override
533 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
534
535 /**
536 * Adds this vector to broadcast of an input scalar,
537 * selecting lane elements controlled by a mask.
538 * <p>
539 * This is a lane-wise binary operation which applies the primitive addition operation
540 * ({@code +}) to each lane.
541 *
542 * @param s the input scalar
543 * @param m the mask controlling lane selection
544 * @return the result of adding this vector to the broadcast of an input
545 * scalar
546 */
547 public abstract $abstractvectortype$ add($type$ s, VectorMask<$Boxtype$> m);
548
549 @Override
550 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v);
551
552 /**
553 * Subtracts the broadcast of an input scalar from this vector.
554 * <p>
555 * This is a lane-wise binary operation which applies the primitive subtraction
556 * operation ({@code -}) to each lane.
557 *
558 * @param s the input scalar
559 * @return the result of subtracting the broadcast of an input
560 * scalar from this vector
561 */
562 public abstract $abstractvectortype$ sub($type$ s);
563
564 @Override
565 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
566
567 /**
568 * Subtracts the broadcast of an input scalar from this vector, selecting
569 * lane elements controlled by a mask.
570 * <p>
571 * This is a lane-wise binary operation which applies the primitive subtraction
572 * operation ({@code -}) to each lane.
573 *
574 * @param s the input scalar
575 * @param m the mask controlling lane selection
576 * @return the result of subtracting the broadcast of an input
577 * scalar from this vector
578 */
579 public abstract $abstractvectortype$ sub($type$ s, VectorMask<$Boxtype$> m);
580
581 @Override
582 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v);
583
584 /**
585 * Multiplies this vector with the broadcast of an input scalar.
586 * <p>
587 * This is a lane-wise binary operation which applies the primitive multiplication
588 * operation ({@code *}) to each lane.
589 *
590 * @param s the input scalar
591 * @return the result of multiplying this vector with the broadcast of an
592 * input scalar
593 */
594 public abstract $abstractvectortype$ mul($type$ s);
595
596 @Override
597 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
598
599 /**
600 * Multiplies this vector with the broadcast of an input scalar, selecting
601 * lane elements controlled by a mask.
602 * <p>
603 * This is a lane-wise binary operation which applies the primitive multiplication
604 * operation ({@code *}) to each lane.
605 *
606 * @param s the input scalar
607 * @param m the mask controlling lane selection
608 * @return the result of multiplying this vector with the broadcast of an
609 * input scalar
610 */
611 public abstract $abstractvectortype$ mul($type$ s, VectorMask<$Boxtype$> m);
612
613 @Override
614 public abstract $abstractvectortype$ neg();
615
616 @Override
617 public abstract $abstractvectortype$ neg(VectorMask<$Boxtype$> m);
618
619 @Override
620 public abstract $abstractvectortype$ abs();
621
622 @Override
623 public abstract $abstractvectortype$ abs(VectorMask<$Boxtype$> m);
624
625 @Override
626 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v);
627
628 @Override
629 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
630
631 /**
632 * Returns the minimum of this vector and the broadcast of an input scalar.
633 * <p>
634 * This is a lane-wise binary operation which applies the operation
635 * {@code (a, b) -> Math.min(a, b)} to each lane.
636 *
637 * @param s the input scalar
638 * @return the minimum of this vector and the broadcast of an input scalar
639 */
640 public abstract $abstractvectortype$ min($type$ s);
641
642 @Override
643 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v);
644
645 @Override
646 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
647
648 /**
649 * Returns the maximum of this vector and the broadcast of an input scalar.
650 * <p>
651 * This is a lane-wise binary operation which applies the operation
652 * {@code (a, b) -> Math.max(a, b)} to each lane.
653 *
654 * @param s the input scalar
655 * @return the maximum of this vector and the broadcast of an input scalar
656 */
657 public abstract $abstractvectortype$ max($type$ s);
658
659 @Override
660 public abstract VectorMask<$Boxtype$> equal(Vector<$Boxtype$> v);
661
662 /**
663 * Tests if this vector is equal to the broadcast of an input scalar.
664 * <p>
665 * This is a lane-wise binary test operation which applies the primitive equals
666 * operation ({@code ==}) each lane.
667 *
668 * @param s the input scalar
669 * @return the result mask of testing if this vector is equal to the
670 * broadcast of an input scalar
671 */
672 public abstract VectorMask<$Boxtype$> equal($type$ s);
673
674 @Override
675 public abstract VectorMask<$Boxtype$> notEqual(Vector<$Boxtype$> v);
676
677 /**
678 * Tests if this vector is not equal to the broadcast of an input scalar.
679 * <p>
680 * This is a lane-wise binary test operation which applies the primitive not equals
681 * operation ({@code !=}) to each lane.
682 *
683 * @param s the input scalar
684 * @return the result mask of testing if this vector is not equal to the
685 * broadcast of an input scalar
686 */
687 public abstract VectorMask<$Boxtype$> notEqual($type$ s);
688
689 @Override
690 public abstract VectorMask<$Boxtype$> lessThan(Vector<$Boxtype$> v);
691
692 /**
693 * Tests if this vector is less than the broadcast of an input scalar.
694 * <p>
695 * This is a lane-wise binary test operation which applies the primitive less than
696 * operation ({@code <}) to each lane.
697 *
698 * @param s the input scalar
699 * @return the mask result of testing if this vector is less than the
700 * broadcast of an input scalar
701 */
702 public abstract VectorMask<$Boxtype$> lessThan($type$ s);
703
704 @Override
705 public abstract VectorMask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v);
706
707 /**
708 * Tests if this vector is less or equal to the broadcast of an input scalar.
709 * <p>
710 * This is a lane-wise binary test operation which applies the primitive less than
711 * or equal to operation ({@code <=}) to each lane.
712 *
713 * @param s the input scalar
714 * @return the mask result of testing if this vector is less than or equal
715 * to the broadcast of an input scalar
716 */
717 public abstract VectorMask<$Boxtype$> lessThanEq($type$ s);
718
719 @Override
720 public abstract VectorMask<$Boxtype$> greaterThan(Vector<$Boxtype$> v);
721
722 /**
723 * Tests if this vector is greater than the broadcast of an input scalar.
724 * <p>
725 * This is a lane-wise binary test operation which applies the primitive greater than
726 * operation ({@code >}) to each lane.
727 *
728 * @param s the input scalar
729 * @return the mask result of testing if this vector is greater than the
730 * broadcast of an input scalar
731 */
732 public abstract VectorMask<$Boxtype$> greaterThan($type$ s);
733
734 @Override
735 public abstract VectorMask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v);
736
737 /**
738 * Tests if this vector is greater than or equal to the broadcast of an
739 * input scalar.
740 * <p>
741 * This is a lane-wise binary test operation which applies the primitive greater than
742 * or equal to operation ({@code >=}) to each lane.
743 *
744 * @param s the input scalar
745 * @return the mask result of testing if this vector is greater than or
746 * equal to the broadcast of an input scalar
747 */
748 public abstract VectorMask<$Boxtype$> greaterThanEq($type$ s);
749
750 @Override
751 public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
752
753 /**
754 * Blends the lane elements of this vector with those of the broadcast of an
755 * input scalar, selecting lanes controlled by a mask.
756 * <p>
757 * For each lane of the mask, at lane index {@code N}, if the mask lane
758 * is set then the lane element at {@code N} from the input vector is
759 * selected and placed into the resulting vector at {@code N},
760 * otherwise the the lane element at {@code N} from this input vector is
761 * selected and placed into the resulting vector at {@code N}.
762 *
776
777 @Override
778 public abstract $abstractvectortype$ reshape(VectorSpecies<$Boxtype$> s);
779
780 @Override
781 public abstract $abstractvectortype$ rotateEL(int i);
782
783 @Override
784 public abstract $abstractvectortype$ rotateER(int i);
785
786 @Override
787 public abstract $abstractvectortype$ shiftEL(int i);
788
789 @Override
790 public abstract $abstractvectortype$ shiftER(int i);
791
792 #if[FP]
793 /**
794 * Divides this vector by an input vector.
795 * <p>
796 * This is a lane-wise binary operation which applies the primitive division
797 * operation ({@code /}) to each lane.
798 *
799 * @param v the input vector
800 * @return the result of dividing this vector by the input vector
801 */
802 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v);
803
804 /**
805 * Divides this vector by the broadcast of an input scalar.
806 * <p>
807 * This is a lane-wise binary operation which applies the primitive division
808 * operation ({@code /}) to each lane.
809 *
810 * @param s the input scalar
811 * @return the result of dividing this vector by the broadcast of an input
812 * scalar
813 */
814 public abstract $abstractvectortype$ div($type$ s);
815
816 /**
817 * Divides this vector by an input vector, selecting lane elements
818 * controlled by a mask.
819 * <p>
820 * This is a lane-wise binary operation which applies the primitive division
821 * operation ({@code /}) to each lane.
822 *
823 * @param v the input vector
824 * @param m the mask controlling lane selection
825 * @return the result of dividing this vector by the input vector
826 */
827 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
828
829 /**
830 * Divides this vector by the broadcast of an input scalar, selecting lane
831 * elements controlled by a mask.
832 * <p>
833 * This is a lane-wise binary operation which applies the primitive division
834 * operation ({@code /}) to each lane.
835 *
836 * @param s the input scalar
837 * @param m the mask controlling lane selection
838 * @return the result of dividing this vector by the broadcast of an input
839 * scalar
840 */
841 public abstract $abstractvectortype$ div($type$ s, VectorMask<$Boxtype$> m);
842
843 /**
844 * Calculates the square root of this vector.
845 * <p>
846 * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation
847 * to each lane.
848 *
849 * @return the square root of this vector
850 */
851 public abstract $abstractvectortype$ sqrt();
852
853 /**
854 * Calculates the square root of this vector, selecting lane elements
855 * controlled by a mask.
856 * <p>
857 * This is a lane-wise unary operation which applies the {@link Math#sqrt} operation
858 * to each lane.
859 *
860 * @param m the mask controlling lane selection
861 * @return the square root of this vector
862 */
863 public $abstractvectortype$ sqrt(VectorMask<$Boxtype$> m) {
864 return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a));
865 }
866
867 /**
868 * Calculates the trigonometric tangent of this vector.
869 * <p>
870 * This is a lane-wise unary operation with same semantic definition as
871 * {@link Math#tan} operation applied to each lane.
872 * The implementation is not required to return same
873 * results as {@link Math#tan}, but adheres to rounding, monotonicity,
874 * and special case semantics as defined in the {@link Math#tan}
875 * specifications. The computed result will be within 1 ulp of the
876 * exact result.
877 *
878 * @return the tangent of this vector
879 */
880 public $abstractvectortype$ tan() {
881 return uOp((i, a) -> ($type$) Math.tan((double) a));
882 }
883
884 /**
885 * Calculates the trigonometric tangent of this vector, selecting lane
886 * elements controlled by a mask.
887 * <p>
888 * Semantics for rounding, monotonicity, and special cases are
889 * described in {@link $abstractvectortype$#tan}
890 *
891 * @param m the mask controlling lane selection
892 * @return the tangent of this vector
893 */
894 public $abstractvectortype$ tan(VectorMask<$Boxtype$> m) {
895 return uOp(m, (i, a) -> ($type$) Math.tan((double) a));
896 }
897
898 /**
899 * Calculates the hyperbolic tangent of this vector.
900 * <p>
901 * This is a lane-wise unary operation with same semantic definition as
902 * {@link Math#tanh} operation applied to each lane.
903 * The implementation is not required to return same
904 * results as {@link Math#tanh}, but adheres to rounding, monotonicity,
905 * and special case semantics as defined in the {@link Math#tanh}
906 * specifications. The computed result will be within 2.5 ulps of the
907 * exact result.
908 *
909 * @return the hyperbolic tangent of this vector
910 */
911 public $abstractvectortype$ tanh() {
912 return uOp((i, a) -> ($type$) Math.tanh((double) a));
913 }
914
915 /**
916 * Calculates the hyperbolic tangent of this vector, selecting lane elements
917 * controlled by a mask.
918 * <p>
919 * Semantics for rounding, monotonicity, and special cases are
920 * described in {@link $abstractvectortype$#tanh}
921 *
922 * @param m the mask controlling lane selection
923 * @return the hyperbolic tangent of this vector
924 */
925 public $abstractvectortype$ tanh(VectorMask<$Boxtype$> m) {
926 return uOp(m, (i, a) -> ($type$) Math.tanh((double) a));
927 }
928
929 /**
930 * Calculates the trigonometric sine of this vector.
931 * <p>
932 * This is a lane-wise unary operation with same semantic definition as
933 * {@link Math#sin} operation applied to each lane.
934 * The implementation is not required to return same
935 * results as {@link Math#sin}, but adheres to rounding, monotonicity,
936 * and special case semantics as defined in the {@link Math#sin}
937 * specifications. The computed result will be within 1 ulp of the
938 * exact result.
939 *
940 * @return the sine of this vector
941 */
942 public $abstractvectortype$ sin() {
943 return uOp((i, a) -> ($type$) Math.sin((double) a));
944 }
945
946 /**
947 * Calculates the trigonometric sine of this vector, selecting lane elements
948 * controlled by a mask.
949 * <p>
950 * Semantics for rounding, monotonicity, and special cases are
951 * described in {@link $abstractvectortype$#sin}
952 *
953 * @param m the mask controlling lane selection
954 * @return the sine of this vector
955 */
956 public $abstractvectortype$ sin(VectorMask<$Boxtype$> m) {
957 return uOp(m, (i, a) -> ($type$) Math.sin((double) a));
958 }
959
960 /**
961 * Calculates the hyperbolic sine of this vector.
962 * <p>
963 * This is a lane-wise unary operation with same semantic definition as
964 * {@link Math#sinh} operation applied to each lane.
965 * The implementation is not required to return same
966 * results as {@link Math#sinh}, but adheres to rounding, monotonicity,
967 * and special case semantics as defined in the {@link Math#sinh}
968 * specifications. The computed result will be within 2.5 ulps of the
969 * exact result.
970 *
971 * @return the hyperbolic sine of this vector
972 */
973 public $abstractvectortype$ sinh() {
974 return uOp((i, a) -> ($type$) Math.sinh((double) a));
975 }
976
977 /**
978 * Calculates the hyperbolic sine of this vector, selecting lane elements
979 * controlled by a mask.
980 * <p>
981 * Semantics for rounding, monotonicity, and special cases are
982 * described in {@link $abstractvectortype$#sinh}
983 *
984 * @param m the mask controlling lane selection
985 * @return the hyperbolic sine of this vector
986 */
987 public $abstractvectortype$ sinh(VectorMask<$Boxtype$> m) {
988 return uOp(m, (i, a) -> ($type$) Math.sinh((double) a));
989 }
990
991 /**
992 * Calculates the trigonometric cosine of this vector.
993 * <p>
994 * This is a lane-wise unary operation with same semantic definition as
995 * {@link Math#cos} operation applied to each lane.
996 * The implementation is not required to return same
997 * results as {@link Math#cos}, but adheres to rounding, monotonicity,
998 * and special case semantics as defined in the {@link Math#cos}
999 * specifications. The computed result will be within 1 ulp of the
1000 * exact result.
1001 *
1002 * @return the cosine of this vector
1003 */
1004 public $abstractvectortype$ cos() {
1005 return uOp((i, a) -> ($type$) Math.cos((double) a));
1006 }
1007
1008 /**
1009 * Calculates the trigonometric cosine of this vector, selecting lane
1010 * elements controlled by a mask.
1011 * <p>
1012 * Semantics for rounding, monotonicity, and special cases are
1013 * described in {@link $abstractvectortype$#cos}
1014 *
1015 * @param m the mask controlling lane selection
1016 * @return the cosine of this vector
1017 */
1018 public $abstractvectortype$ cos(VectorMask<$Boxtype$> m) {
1019 return uOp(m, (i, a) -> ($type$) Math.cos((double) a));
1020 }
1021
1022 /**
1023 * Calculates the hyperbolic cosine of this vector.
1024 * <p>
1025 * This is a lane-wise unary operation with same semantic definition as
1026 * {@link Math#cosh} operation applied to each lane.
1027 * The implementation is not required to return same
1028 * results as {@link Math#cosh}, but adheres to rounding, monotonicity,
1029 * and special case semantics as defined in the {@link Math#cosh}
1030 * specifications. The computed result will be within 2.5 ulps of the
1031 * exact result.
1032 *
1033 * @return the hyperbolic cosine of this vector
1034 */
1035 public $abstractvectortype$ cosh() {
1036 return uOp((i, a) -> ($type$) Math.cosh((double) a));
1037 }
1038
1039 /**
1040 * Calculates the hyperbolic cosine of this vector, selecting lane elements
1041 * controlled by a mask.
1042 * <p>
1043 * Semantics for rounding, monotonicity, and special cases are
1044 * described in {@link $abstractvectortype$#cosh}
1045 *
1046 * @param m the mask controlling lane selection
1047 * @return the hyperbolic cosine of this vector
1048 */
1049 public $abstractvectortype$ cosh(VectorMask<$Boxtype$> m) {
1050 return uOp(m, (i, a) -> ($type$) Math.cosh((double) a));
1051 }
1052
1053 /**
1054 * Calculates the arc sine of this vector.
1055 * <p>
1056 * This is a lane-wise unary operation with same semantic definition as
1057 * {@link Math#asin} operation applied to each lane.
1058 * The implementation is not required to return same
1059 * results as {@link Math#asin}, but adheres to rounding, monotonicity,
1060 * and special case semantics as defined in the {@link Math#asin}
1061 * specifications. The computed result will be within 1 ulp of the
1062 * exact result.
1063 *
1064 * @return the arc sine of this vector
1065 */
1066 public $abstractvectortype$ asin() {
1067 return uOp((i, a) -> ($type$) Math.asin((double) a));
1068 }
1069
1070 /**
1071 * Calculates the arc sine of this vector, selecting lane elements
1072 * controlled by a mask.
1073 * <p>
1074 * Semantics for rounding, monotonicity, and special cases are
1075 * described in {@link $abstractvectortype$#asin}
1076 *
1077 * @param m the mask controlling lane selection
1078 * @return the arc sine of this vector
1079 */
1080 public $abstractvectortype$ asin(VectorMask<$Boxtype$> m) {
1081 return uOp(m, (i, a) -> ($type$) Math.asin((double) a));
1082 }
1083
1084 /**
1085 * Calculates the arc cosine of this vector.
1086 * <p>
1087 * This is a lane-wise unary operation with same semantic definition as
1088 * {@link Math#acos} operation applied to each lane.
1089 * The implementation is not required to return same
1090 * results as {@link Math#acos}, but adheres to rounding, monotonicity,
1091 * and special case semantics as defined in the {@link Math#acos}
1092 * specifications. The computed result will be within 1 ulp of the
1093 * exact result.
1094 *
1095 * @return the arc cosine of this vector
1096 */
1097 public $abstractvectortype$ acos() {
1098 return uOp((i, a) -> ($type$) Math.acos((double) a));
1099 }
1100
1101 /**
1102 * Calculates the arc cosine of this vector, selecting lane elements
1103 * controlled by a mask.
1104 * <p>
1105 * Semantics for rounding, monotonicity, and special cases are
1106 * described in {@link $abstractvectortype$#acos}
1107 *
1108 * @param m the mask controlling lane selection
1109 * @return the arc cosine of this vector
1110 */
1111 public $abstractvectortype$ acos(VectorMask<$Boxtype$> m) {
1112 return uOp(m, (i, a) -> ($type$) Math.acos((double) a));
1113 }
1114
1115 /**
1116 * Calculates the arc tangent of this vector.
1117 * <p>
1118 * This is a lane-wise unary operation with same semantic definition as
1119 * {@link Math#atan} operation applied to each lane.
1120 * The implementation is not required to return same
1121 * results as {@link Math#atan}, but adheres to rounding, monotonicity,
1122 * and special case semantics as defined in the {@link Math#atan}
1123 * specifications. The computed result will be within 1 ulp of the
1124 * exact result.
1125 *
1126 * @return the arc tangent of this vector
1127 */
1128 public $abstractvectortype$ atan() {
1129 return uOp((i, a) -> ($type$) Math.atan((double) a));
1130 }
1131
1132 /**
1133 * Calculates the arc tangent of this vector, selecting lane elements
1134 * controlled by a mask.
1135 * <p>
1136 * Semantics for rounding, monotonicity, and special cases are
1137 * described in {@link $abstractvectortype$#atan}
1138 *
1139 * @param m the mask controlling lane selection
1140 * @return the arc tangent of this vector
1141 */
1142 public $abstractvectortype$ atan(VectorMask<$Boxtype$> m) {
1143 return uOp(m, (i, a) -> ($type$) Math.atan((double) a));
1144 }
1145
1146 /**
1147 * Calculates the arc tangent of this vector divided by an input vector.
1148 * <p>
1149 * This is a lane-wise binary operation with same semantic definition as
1150 * {@link Math#atan2} operation applied to each lane.
1151 * The implementation is not required to return same
1152 * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1153 * and special case semantics as defined in the {@link Math#atan2}
1154 * specifications. The computed result will be within 2 ulps of the
1155 * exact result.
1156 *
1157 * @param v the input vector
1158 * @return the arc tangent of this vector divided by the input vector
1159 */
1160 public $abstractvectortype$ atan2(Vector<$Boxtype$> v) {
1161 return bOp(v, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
1162 }
1163
1164 /**
1165 * Calculates the arc tangent of this vector divided by the broadcast of an
1166 * an input scalar.
1167 * <p>
1168 * This is a lane-wise binary operation with same semantic definition as
1169 * {@link Math#atan2} operation applied to each lane.
1170 * The implementation is not required to return same
1171 * results as {@link Math#atan2}, but adheres to rounding, monotonicity,
1172 * and special case semantics as defined in the {@link Math#atan2}
1173 * specifications. The computed result will be within 1 ulp of the
1174 * exact result.
1175 *
1176 * @param s the input scalar
1177 * @return the arc tangent of this vector over the input vector
1178 */
1179 public abstract $abstractvectortype$ atan2($type$ s);
1180
1181 /**
1182 * Calculates the arc tangent of this vector divided by an input vector,
1183 * selecting lane elements controlled by a mask.
1184 * <p>
1185 * Semantics for rounding, monotonicity, and special cases are
1186 * described in {@link $abstractvectortype$#atan2}
1187 *
1188 * @param v the input vector
1189 * @param m the mask controlling lane selection
1192 public $abstractvectortype$ atan2(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1193 return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b));
1194 }
1195
1196 /**
1197 * Calculates the arc tangent of this vector divided by the broadcast of an
1198 * an input scalar, selecting lane elements controlled by a mask.
1199 * <p>
1200 * Semantics for rounding, monotonicity, and special cases are
1201 * described in {@link $abstractvectortype$#atan2}
1202 *
1203 * @param s the input scalar
1204 * @param m the mask controlling lane selection
1205 * @return the arc tangent of this vector over the input vector
1206 */
1207 public abstract $abstractvectortype$ atan2($type$ s, VectorMask<$Boxtype$> m);
1208
1209 /**
1210 * Calculates the cube root of this vector.
1211 * <p>
1212 * This is a lane-wise unary operation with same semantic definition as
1213 * {@link Math#cbrt} operation applied to each lane.
1214 * The implementation is not required to return same
1215 * results as {@link Math#cbrt}, but adheres to rounding, monotonicity,
1216 * and special case semantics as defined in the {@link Math#cbrt}
1217 * specifications. The computed result will be within 1 ulp of the
1218 * exact result.
1219 *
1220 * @return the cube root of this vector
1221 */
1222 public $abstractvectortype$ cbrt() {
1223 return uOp((i, a) -> ($type$) Math.cbrt((double) a));
1224 }
1225
1226 /**
1227 * Calculates the cube root of this vector, selecting lane elements
1228 * controlled by a mask.
1229 * <p>
1230 * Semantics for rounding, monotonicity, and special cases are
1231 * described in {@link $abstractvectortype$#cbrt}
1232 *
1233 * @param m the mask controlling lane selection
1234 * @return the cube root of this vector
1235 */
1236 public $abstractvectortype$ cbrt(VectorMask<$Boxtype$> m) {
1237 return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a));
1238 }
1239
1240 /**
1241 * Calculates the natural logarithm of this vector.
1242 * <p>
1243 * This is a lane-wise unary operation with same semantic definition as
1244 * {@link Math#log} operation applied to each lane.
1245 * The implementation is not required to return same
1246 * results as {@link Math#log}, but adheres to rounding, monotonicity,
1247 * and special case semantics as defined in the {@link Math#log}
1248 * specifications. The computed result will be within 1 ulp of the
1249 * exact result.
1250 *
1251 * @return the natural logarithm of this vector
1252 */
1253 public $abstractvectortype$ log() {
1254 return uOp((i, a) -> ($type$) Math.log((double) a));
1255 }
1256
1257 /**
1258 * Calculates the natural logarithm of this vector, selecting lane elements
1259 * controlled by a mask.
1260 * <p>
1261 * Semantics for rounding, monotonicity, and special cases are
1262 * described in {@link $abstractvectortype$#log}
1263 *
1264 * @param m the mask controlling lane selection
1265 * @return the natural logarithm of this vector
1266 */
1267 public $abstractvectortype$ log(VectorMask<$Boxtype$> m) {
1268 return uOp(m, (i, a) -> ($type$) Math.log((double) a));
1269 }
1270
1271 /**
1272 * Calculates the base 10 logarithm of this vector.
1273 * <p>
1274 * This is a lane-wise unary operation with same semantic definition as
1275 * {@link Math#log10} operation applied to each lane.
1276 * The implementation is not required to return same
1277 * results as {@link Math#log10}, but adheres to rounding, monotonicity,
1278 * and special case semantics as defined in the {@link Math#log10}
1279 * specifications. The computed result will be within 1 ulp of the
1280 * exact result.
1281 *
1282 * @return the base 10 logarithm of this vector
1283 */
1284 public $abstractvectortype$ log10() {
1285 return uOp((i, a) -> ($type$) Math.log10((double) a));
1286 }
1287
1288 /**
1289 * Calculates the base 10 logarithm of this vector, selecting lane elements
1290 * controlled by a mask.
1291 * <p>
1292 * Semantics for rounding, monotonicity, and special cases are
1293 * described in {@link $abstractvectortype$#log10}
1294 *
1295 * @param m the mask controlling lane selection
1296 * @return the base 10 logarithm of this vector
1297 */
1298 public $abstractvectortype$ log10(VectorMask<$Boxtype$> m) {
1299 return uOp(m, (i, a) -> ($type$) Math.log10((double) a));
1300 }
1301
1302 /**
1303 * Calculates the natural logarithm of the sum of this vector and the
1304 * broadcast of {@code 1}.
1305 * <p>
1306 * This is a lane-wise unary operation with same semantic definition as
1307 * {@link Math#log1p} operation applied to each lane.
1308 * The implementation is not required to return same
1309 * results as {@link Math#log1p}, but adheres to rounding, monotonicity,
1310 * and special case semantics as defined in the {@link Math#log1p}
1311 * specifications. The computed result will be within 1 ulp of the
1312 * exact result.
1313 *
1314 * @return the natural logarithm of the sum of this vector and the broadcast
1315 * of {@code 1}
1316 */
1317 public $abstractvectortype$ log1p() {
1318 return uOp((i, a) -> ($type$) Math.log1p((double) a));
1319 }
1320
1321 /**
1322 * Calculates the natural logarithm of the sum of this vector and the
1323 * broadcast of {@code 1}, selecting lane elements controlled by a mask.
1324 * <p>
1325 * Semantics for rounding, monotonicity, and special cases are
1326 * described in {@link $abstractvectortype$#log1p}
1327 *
1328 * @param m the mask controlling lane selection
1329 * @return the natural logarithm of the sum of this vector and the broadcast
1330 * of {@code 1}
1331 */
1332 public $abstractvectortype$ log1p(VectorMask<$Boxtype$> m) {
1333 return uOp(m, (i, a) -> ($type$) Math.log1p((double) a));
1334 }
1335
1336 /**
1337 * Calculates this vector raised to the power of an input vector.
1338 * <p>
1339 * This is a lane-wise binary operation with same semantic definition as
1340 * {@link Math#pow} operation applied to each lane.
1341 * The implementation is not required to return same
1342 * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1343 * and special case semantics as defined in the {@link Math#pow}
1344 * specifications. The computed result will be within 1 ulp of the
1345 * exact result.
1346 *
1347 * @param v the input vector
1348 * @return this vector raised to the power of an input vector
1349 */
1350 public $abstractvectortype$ pow(Vector<$Boxtype$> v) {
1351 return bOp(v, (i, a, b) -> ($type$) Math.pow((double) a, (double) b));
1352 }
1353
1354 /**
1355 * Calculates this vector raised to the power of the broadcast of an input
1356 * scalar.
1357 * <p>
1358 * This is a lane-wise binary operation with same semantic definition as
1359 * {@link Math#pow} operation applied to each lane.
1360 * The implementation is not required to return same
1361 * results as {@link Math#pow}, but adheres to rounding, monotonicity,
1362 * and special case semantics as defined in the {@link Math#pow}
1363 * specifications. The computed result will be within 1 ulp of the
1364 * exact result.
1365 *
1366 * @param s the input scalar
1367 * @return this vector raised to the power of the broadcast of an input
1368 * scalar.
1369 */
1370 public abstract $abstractvectortype$ pow($type$ s);
1371
1372 /**
1373 * Calculates this vector raised to the power of an input vector, selecting
1374 * lane elements controlled by a mask.
1375 * <p>
1376 * Semantics for rounding, monotonicity, and special cases are
1377 * described in {@link $abstractvectortype$#pow}
1378 *
1379 * @param v the input vector
1385 }
1386
1387 /**
1388 * Calculates this vector raised to the power of the broadcast of an input
1389 * scalar, selecting lane elements controlled by a mask.
1390 * <p>
1391 * Semantics for rounding, monotonicity, and special cases are
1392 * described in {@link $abstractvectortype$#pow}
1393 *
1394 * @param s the input scalar
1395 * @param m the mask controlling lane selection
1396 * @return this vector raised to the power of the broadcast of an input
1397 * scalar.
1398 */
1399 public abstract $abstractvectortype$ pow($type$ s, VectorMask<$Boxtype$> m);
1400
1401 /**
1402 * Calculates the broadcast of Euler's number {@code e} raised to the power
1403 * of this vector.
1404 * <p>
1405 * This is a lane-wise unary operation with same semantic definition as
1406 * {@link Math#exp} operation applied to each lane.
1407 * The implementation is not required to return same
1408 * results as {@link Math#exp}, but adheres to rounding, monotonicity,
1409 * and special case semantics as defined in the {@link Math#exp}
1410 * specifications. The computed result will be within 1 ulp of the
1411 * exact result.
1412 *
1413 * @return the broadcast of Euler's number {@code e} raised to the power of
1414 * this vector
1415 */
1416 public $abstractvectortype$ exp() {
1417 return uOp((i, a) -> ($type$) Math.exp((double) a));
1418 }
1419
1420 /**
1421 * Calculates the broadcast of Euler's number {@code e} raised to the power
1422 * of this vector, selecting lane elements controlled by a mask.
1423 * <p>
1424 * Semantics for rounding, monotonicity, and special cases are
1425 * described in {@link $abstractvectortype$#exp}
1426 *
1427 * @param m the mask controlling lane selection
1428 * @return the broadcast of Euler's number {@code e} raised to the power of
1429 * this vector
1430 */
1431 public $abstractvectortype$ exp(VectorMask<$Boxtype$> m) {
1432 return uOp(m, (i, a) -> ($type$) Math.exp((double) a));
1433 }
1434
1435 /**
1436 * Calculates the broadcast of Euler's number {@code e} raised to the power
1437 * of this vector minus the broadcast of {@code -1}.
1438 * More specifically as if the following (ignoring any differences in
1439 * numerical accuracy):
1440 * <pre>{@code
1441 * this.exp().sub(EVector.broadcast(this.species(), 1))
1442 * }</pre>
1443 * <p>
1444 * This is a lane-wise unary operation with same semantic definition as
1445 * {@link Math#expm1} operation applied to each lane.
1446 * The implementation is not required to return same
1447 * results as {@link Math#expm1}, but adheres to rounding, monotonicity,
1448 * and special case semantics as defined in the {@link Math#expm1}
1449 * specifications. The computed result will be within 1 ulp of the
1450 * exact result.
1451 *
1452 * @return the broadcast of Euler's number {@code e} raised to the power of
1453 * this vector minus the broadcast of {@code -1}
1454 */
1455 public $abstractvectortype$ expm1() {
1456 return uOp((i, a) -> ($type$) Math.expm1((double) a));
1457 }
1458
1459 /**
1460 * Calculates the broadcast of Euler's number {@code e} raised to the power
1461 * of this vector minus the broadcast of {@code -1}, selecting lane elements
1462 * controlled by a mask
1463 * More specifically as if the following (ignoring any differences in
1464 * numerical accuracy):
1465 * <pre>{@code
1466 * this.exp(m).sub(EVector.broadcast(this.species(), 1), m)
1467 * }</pre>
1468 * <p>
1469 * Semantics for rounding, monotonicity, and special cases are
1470 * described in {@link $abstractvectortype$#expm1}
1471 *
1472 * @param m the mask controlling lane selection
1473 * @return the broadcast of Euler's number {@code e} raised to the power of
1474 * this vector minus the broadcast of {@code -1}
1475 */
1476 public $abstractvectortype$ expm1(VectorMask<$Boxtype$> m) {
1477 return uOp(m, (i, a) -> ($type$) Math.expm1((double) a));
1478 }
1479
1480 /**
1481 * Calculates the product of this vector and a first input vector summed
1482 * with a second input vector.
1483 * More specifically as if the following (ignoring any differences in
1484 * numerical accuracy):
1485 * <pre>{@code
1486 * this.mul(v1).add(v2)
1487 * }</pre>
1488 * <p>
1489 * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1490 * to each lane.
1491 *
1492 * @param v1 the first input vector
1493 * @param v2 the second input vector
1494 * @return the product of this vector and the first input vector summed with
1495 * the second input vector
1496 */
1497 public abstract $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2);
1498
1499 /**
1500 * Calculates the product of this vector and the broadcast of a first input
1501 * scalar summed with the broadcast of a second input scalar.
1502 * More specifically as if the following:
1503 * <pre>{@code
1504 * this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2))
1505 * }</pre>
1506 * <p>
1507 * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1508 * to each lane.
1509 *
1510 * @param s1 the first input scalar
1511 * @param s2 the second input scalar
1512 * @return the product of this vector and the broadcast of a first input
1513 * scalar summed with the broadcast of a second input scalar
1514 */
1515 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2);
1516
1517 /**
1518 * Calculates the product of this vector and a first input vector summed
1519 * with a second input vector, selecting lane elements controlled by a mask.
1520 * More specifically as if the following (ignoring any differences in
1521 * numerical accuracy):
1522 * <pre>{@code
1523 * this.mul(v1, m).add(v2, m)
1524 * }</pre>
1525 * <p>
1526 * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1527 * to each lane.
1528 *
1529 * @param v1 the first input vector
1530 * @param v2 the second input vector
1531 * @param m the mask controlling lane selection
1532 * @return the product of this vector and the first input vector summed with
1533 * the second input vector
1534 */
1535 public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, VectorMask<$Boxtype$> m) {
1536 return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c));
1537 }
1538
1539 /**
1540 * Calculates the product of this vector and the broadcast of a first input
1541 * scalar summed with the broadcast of a second input scalar, selecting lane
1542 * elements controlled by a mask
1543 * More specifically as if the following:
1544 * <pre>{@code
1545 * this.fma(EVector.broadcast(this.species(), s1), EVector.broadcast(this.species(), s2), m)
1546 * }</pre>
1547 * <p>
1548 * This is a lane-wise ternary operation which applies the {@link Math#fma} operation
1549 * to each lane.
1550 *
1551 * @param s1 the first input scalar
1552 * @param s2 the second input scalar
1553 * @param m the mask controlling lane selection
1554 * @return the product of this vector and the broadcast of a first input
1555 * scalar summed with the broadcast of a second input scalar
1556 */
1557 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, VectorMask<$Boxtype$> m);
1558
1559 /**
1560 * Calculates square root of the sum of the squares of this vector and an
1561 * input vector.
1562 * More specifically as if the following (ignoring any differences in
1563 * numerical accuracy):
1564 * <pre>{@code
1565 * this.mul(this).add(v.mul(v)).sqrt()
1566 * }</pre>
1567 * <p>
1568 * This is a lane-wise binary operation with same semantic definition as
1569 * {@link Math#hypot} operation applied to each lane.
1570 * The implementation is not required to return same
1571 * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1572 * and special case semantics as defined in the {@link Math#hypot}
1573 * specifications. The computed result will be within 1 ulp of the
1574 * exact result.
1575 *
1576 * @param v the input vector
1577 * @return square root of the sum of the squares of this vector and an input
1578 * vector
1579 */
1580 public $abstractvectortype$ hypot(Vector<$Boxtype$> v) {
1581 return bOp(v, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
1582 }
1583
1584 /**
1585 * Calculates square root of the sum of the squares of this vector and the
1586 * broadcast of an input scalar.
1587 * More specifically as if the following (ignoring any differences in
1588 * numerical accuracy):
1589 * <pre>{@code
1590 * this.mul(this).add(EVector.broadcast(this.species(), s * s)).sqrt()
1591 * }</pre>
1592 * <p>
1593 * This is a lane-wise binary operation with same semantic definition as
1594 * {@link Math#hypot} operation applied to each.
1595 * The implementation is not required to return same
1596 * results as {@link Math#hypot}, but adheres to rounding, monotonicity,
1597 * and special case semantics as defined in the {@link Math#hypot}
1598 * specifications. The computed result will be within 1 ulp of the
1599 * exact result.
1600 *
1601 * @param s the input scalar
1602 * @return square root of the sum of the squares of this vector and the
1603 * broadcast of an input scalar
1604 */
1605 public abstract $abstractvectortype$ hypot($type$ s);
1606
1607 /**
1608 * Calculates square root of the sum of the squares of this vector and an
1609 * input vector, selecting lane elements controlled by a mask.
1610 * More specifically as if the following (ignoring any differences in
1611 * numerical accuracy):
1612 * <pre>{@code
1613 * this.mul(this, m).add(v.mul(v), m).sqrt(m)
1614 * }</pre>
1615 * <p>
1616 * Semantics for rounding, monotonicity, and special cases are
1617 * described in {@link $abstractvectortype$#hypot}
1618 *
1619 * @param v the input vector
1620 * @param m the mask controlling lane selection
1621 * @return square root of the sum of the squares of this vector and an input
1622 * vector
1623 */
1624 public $abstractvectortype$ hypot(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1625 return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b));
1626 }
1627
1628 /**
1629 * Calculates square root of the sum of the squares of this vector and the
1630 * broadcast of an input scalar, selecting lane elements controlled by a
1631 * mask.
1632 * More specifically as if the following (ignoring any differences in
1633 * numerical accuracy):
1634 * <pre>{@code
1635 * this.mul(this, m).add(EVector.broadcast(this.species(), s * s), m).sqrt(m)
1636 * }</pre>
1637 * <p>
1638 * Semantics for rounding, monotonicity, and special cases are
1639 * described in {@link $abstractvectortype$#hypot}
1640 *
1641 * @param s the input scalar
1642 * @param m the mask controlling lane selection
1643 * @return square root of the sum of the squares of this vector and the
1644 * broadcast of an input scalar
1645 */
1646 public abstract $abstractvectortype$ hypot($type$ s, VectorMask<$Boxtype$> m);
1647 #end[FP]
1648
1649 #if[BITWISE]
1650
1651 /**
1652 * Bitwise ANDs this vector with an input vector.
1653 * <p>
1654 * This is a lane-wise binary operation which applies the primitive bitwise AND
1655 * operation ({@code &}) to each lane.
1656 *
1657 * @param v the input vector
1658 * @return the bitwise AND of this vector with the input vector
1659 */
1660 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v);
1661
1662 /**
1663 * Bitwise ANDs this vector with the broadcast of an input scalar.
1664 * <p>
1665 * This is a lane-wise binary operation which applies the primitive bitwise AND
1666 * operation ({@code &}) to each lane.
1667 *
1668 * @param s the input scalar
1669 * @return the bitwise AND of this vector with the broadcast of an input
1670 * scalar
1671 */
1672 public abstract $abstractvectortype$ and($type$ s);
1673
1674 /**
1675 * Bitwise ANDs this vector with an input vector, selecting lane elements
1676 * controlled by a mask.
1677 * <p>
1678 * This is a lane-wise binary operation which applies the primitive bitwise AND
1679 * operation ({@code &}) to each lane.
1680 *
1681 * @param v the input vector
1682 * @param m the mask controlling lane selection
1683 * @return the bitwise AND of this vector with the input vector
1684 */
1685 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1686
1687 /**
1688 * Bitwise ANDs this vector with the broadcast of an input scalar, selecting
1689 * lane elements controlled by a mask.
1690 * <p>
1691 * This is a lane-wise binary operation which applies the primitive bitwise AND
1692 * operation ({@code &}) to each lane.
1693 *
1694 * @param s the input scalar
1695 * @param m the mask controlling lane selection
1696 * @return the bitwise AND of this vector with the broadcast of an input
1697 * scalar
1698 */
1699 public abstract $abstractvectortype$ and($type$ s, VectorMask<$Boxtype$> m);
1700
1701 /**
1702 * Bitwise ORs this vector with an input vector.
1703 * <p>
1704 * This is a lane-wise binary operation which applies the primitive bitwise OR
1705 * operation ({@code |}) to each lane.
1706 *
1707 * @param v the input vector
1708 * @return the bitwise OR of this vector with the input vector
1709 */
1710 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v);
1711
1712 /**
1713 * Bitwise ORs this vector with the broadcast of an input scalar.
1714 * <p>
1715 * This is a lane-wise binary operation which applies the primitive bitwise OR
1716 * operation ({@code |}) to each lane.
1717 *
1718 * @param s the input scalar
1719 * @return the bitwise OR of this vector with the broadcast of an input
1720 * scalar
1721 */
1722 public abstract $abstractvectortype$ or($type$ s);
1723
1724 /**
1725 * Bitwise ORs this vector with an input vector, selecting lane elements
1726 * controlled by a mask.
1727 * <p>
1728 * This is a lane-wise binary operation which applies the primitive bitwise OR
1729 * operation ({@code |}) to each lane.
1730 *
1731 * @param v the input vector
1732 * @param m the mask controlling lane selection
1733 * @return the bitwise OR of this vector with the input vector
1734 */
1735 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1736
1737 /**
1738 * Bitwise ORs this vector with the broadcast of an input scalar, selecting
1739 * lane elements controlled by a mask.
1740 * <p>
1741 * This is a lane-wise binary operation which applies the primitive bitwise OR
1742 * operation ({@code |}) to each lane.
1743 *
1744 * @param s the input scalar
1745 * @param m the mask controlling lane selection
1746 * @return the bitwise OR of this vector with the broadcast of an input
1747 * scalar
1748 */
1749 public abstract $abstractvectortype$ or($type$ s, VectorMask<$Boxtype$> m);
1750
1751 /**
1752 * Bitwise XORs this vector with an input vector.
1753 * <p>
1754 * This is a lane-wise binary operation which applies the primitive bitwise XOR
1755 * operation ({@code ^}) to each lane.
1756 *
1757 * @param v the input vector
1758 * @return the bitwise XOR of this vector with the input vector
1759 */
1760 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v);
1761
1762 /**
1763 * Bitwise XORs this vector with the broadcast of an input scalar.
1764 * <p>
1765 * This is a lane-wise binary operation which applies the primitive bitwise XOR
1766 * operation ({@code ^}) to each lane.
1767 *
1768 * @param s the input scalar
1769 * @return the bitwise XOR of this vector with the broadcast of an input
1770 * scalar
1771 */
1772 public abstract $abstractvectortype$ xor($type$ s);
1773
1774 /**
1775 * Bitwise XORs this vector with an input vector, selecting lane elements
1776 * controlled by a mask.
1777 * <p>
1778 * This is a lane-wise binary operation which applies the primitive bitwise XOR
1779 * operation ({@code ^}) to each lane.
1780 *
1781 * @param v the input vector
1782 * @param m the mask controlling lane selection
1783 * @return the bitwise XOR of this vector with the input vector
1784 */
1785 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m);
1786
1787 /**
1788 * Bitwise XORs this vector with the broadcast of an input scalar, selecting
1789 * lane elements controlled by a mask.
1790 * <p>
1791 * This is a lane-wise binary operation which applies the primitive bitwise XOR
1792 * operation ({@code ^}) to each lane.
1793 *
1794 * @param s the input scalar
1795 * @param m the mask controlling lane selection
1796 * @return the bitwise XOR of this vector with the broadcast of an input
1797 * scalar
1798 */
1799 public abstract $abstractvectortype$ xor($type$ s, VectorMask<$Boxtype$> m);
1800
1801 /**
1802 * Bitwise NOTs this vector.
1803 * <p>
1804 * This is a lane-wise unary operation which applies the primitive bitwise NOT
1805 * operation ({@code ~}) to each lane.
1806 *
1807 * @return the bitwise NOT of this vector
1808 */
1809 public abstract $abstractvectortype$ not();
1810
1811 /**
1812 * Bitwise NOTs this vector, selecting lane elements controlled by a mask.
1813 * <p>
1814 * This is a lane-wise unary operation which applies the primitive bitwise NOT
1815 * operation ({@code ~}) to each lane.
1816 *
1817 * @param m the mask controlling lane selection
1818 * @return the bitwise NOT of this vector
1819 */
1820 public abstract $abstractvectortype$ not(VectorMask<$Boxtype$> m);
1821
1822 #if[byte]
1823 /**
1824 * Logically left shifts this vector by the broadcast of an input scalar.
1825 * <p>
1826 * This is a lane-wise binary operation which applies the primitive logical left shift
1827 * operation ({@code <<}) to each lane to left shift the
1828 * element by shift value as specified by the input scalar. Only the 3
1829 * lowest-order bits of shift value are used. It is as if the shift value
1830 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1831 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1832 *
1833 * @param s the input scalar; the number of the bits to left shift
1834 * @return the result of logically left shifting left this vector by the
1835 * broadcast of an input scalar
1836 */
1837 #end[byte]
1838 #if[short]
1839 /**
1840 * Logically left shifts this vector by the broadcast of an input scalar.
1841 * <p>
1842 * This is a lane-wise binary operation which applies the primitive logical left shift
1843 * operation ({@code <<}) to each lane to left shift the
1844 * element by shift value as specified by the input scalar. Only the 4
1845 * lowest-order bits of shift value are used. It is as if the shift value
1846 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1847 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1848 *
1849 * @param s the input scalar; the number of the bits to left shift
1850 * @return the result of logically left shifting left this vector by the
1851 * broadcast of an input scalar
1852 */
1853 #end[short]
1854 #if[intOrLong]
1855 /**
1856 * Logically left shifts this vector by the broadcast of an input scalar.
1857 * <p>
1858 * This is a lane-wise binary operation which applies the primitive logical left shift
1859 * operation ({@code <<}) to each lane.
1860 *
1861 * @param s the input scalar; the number of the bits to left shift
1862 * @return the result of logically left shifting left this vector by the
1863 * broadcast of an input scalar
1864 */
1865 #end[intOrLong]
1866 public abstract $abstractvectortype$ shiftL(int s);
1867
1868 #if[byte]
1869 /**
1870 * Logically left shifts this vector by the broadcast of an input scalar,
1871 * selecting lane elements controlled by a mask.
1872 * <p>
1873 * This is a lane-wise binary operation which applies the primitive logical left shift
1874 * operation ({@code <<}) to each lane to left shift the
1875 * element by shift value as specified by the input scalar. Only the 3
1876 * lowest-order bits of shift value are used. It is as if the shift value
1877 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1878 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1879 *
1880 * @param s the input scalar; the number of the bits to left shift
1881 * @param m the mask controlling lane selection
1882 * @return the result of logically left shifting left this vector by the
1883 * broadcast of an input scalar
1884 */
1885 #end[byte]
1886 #if[short]
1887 /**
1888 * Logically left shifts this vector by the broadcast of an input scalar,
1889 * selecting lane elements controlled by a mask.
1890 * <p>
1891 * This is a lane-wise binary operation which applies the primitive logical left shift
1892 * operation ({@code <<}) to each lane to left shift the
1893 * element by shift value as specified by the input scalar. Only the 4
1894 * lowest-order bits of shift value are used. It is as if the shift value
1895 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1896 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1897 *
1898 * @param s the input scalar; the number of the bits to left shift
1899 * @param m the mask controlling lane selection
1900 * @return the result of logically left shifting left this vector by the
1901 * broadcast of an input scalar
1902 */
1903 #end[short]
1904 #if[intOrLong]
1905 /**
1906 * Logically left shifts this vector by the broadcast of an input scalar,
1907 * selecting lane elements controlled by a mask.
1908 * <p>
1909 * This is a lane-wise binary operation which applies the primitive logical left shift
1910 * operation ({@code <<}) to each lane.
1911 *
1912 * @param s the input scalar; the number of the bits to left shift
1913 * @param m the mask controlling lane selection
1914 * @return the result of logically left shifting this vector by the
1915 * broadcast of an input scalar
1916 */
1917 #end[intOrLong]
1918 public abstract $abstractvectortype$ shiftL(int s, VectorMask<$Boxtype$> m);
1919
1920 #if[intOrLong]
1921 /**
1922 * Logically left shifts this vector by an input vector.
1923 * <p>
1924 * This is a lane-wise binary operation which applies the primitive logical left shift
1925 * operation ({@code <<}) to each lane.
1926 *
1927 * @param v the input vector
1928 * @return the result of logically left shifting this vector by the input
1929 * vector
1930 */
1931 public abstract $abstractvectortype$ shiftL(Vector<$Boxtype$> v);
1932
1933 /**
1934 * Logically left shifts this vector by an input vector, selecting lane
1935 * elements controlled by a mask.
1936 * <p>
1937 * This is a lane-wise binary operation which applies the primitive logical left shift
1938 * operation ({@code <<}) to each lane.
1939 *
1940 * @param v the input vector
1941 * @param m the mask controlling lane selection
1942 * @return the result of logically left shifting this vector by the input
1943 * vector
1944 */
1945 public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
1946 return bOp(v, m, (i, a, b) -> ($type$) (a << b));
1947 }
1948 #end[intOrLong]
1949
1950 // logical, or unsigned, shift right
1951
1952 #if[byte]
1953 /**
1954 * Logically right shifts (or unsigned right shifts) this vector by the
1955 * broadcast of an input scalar.
1956 * <p>
1957 * This is a lane-wise binary operation which applies the primitive logical right shift
1958 * operation ({@code >>>}) to each lane to logically right shift the
1959 * element by shift value as specified by the input scalar. Only the 3
1960 * lowest-order bits of shift value are used. It is as if the shift value
1961 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
1962 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
1963 *
1964 * @param s the input scalar; the number of the bits to right shift
1965 * @return the result of logically right shifting this vector by the
1966 * broadcast of an input scalar
1967 */
1968 #end[byte]
1969 #if[short]
1970 /**
1971 * Logically right shifts (or unsigned right shifts) this vector by the
1972 * broadcast of an input scalar.
1973 * <p>
1974 * This is a lane-wise binary operation which applies the primitive logical right shift
1975 * operation ({@code >>>}) to each lane to logically right shift the
1976 * element by shift value as specified by the input scalar. Only the 4
1977 * lowest-order bits of shift value are used. It is as if the shift value
1978 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
1979 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
1980 *
1981 * @param s the input scalar; the number of the bits to right shift
1982 * @return the result of logically right shifting this vector by the
1983 * broadcast of an input scalar
1984 */
1985 #end[short]
1986 #if[intOrLong]
1987 /**
1988 * Logically right shifts (or unsigned right shifts) this vector by the
1989 * broadcast of an input scalar.
1990 * <p>
1991 * This is a lane-wise binary operation which applies the primitive logical right shift
1992 * operation ({@code >>>}) to each lane.
1993 *
1994 * @param s the input scalar; the number of the bits to right shift
1995 * @return the result of logically right shifting this vector by the
1996 * broadcast of an input scalar
1997 */
1998 #end[intOrLong]
1999 public abstract $abstractvectortype$ shiftR(int s);
2000
2001 #if[byte]
2002 /**
2003 * Logically right shifts (or unsigned right shifts) this vector by the
2004 * broadcast of an input scalar, selecting lane elements controlled by a
2005 * mask.
2006 * <p>
2007 * This is a lane-wise binary operation which applies the primitive logical right shift
2008 * operation ({@code >>}) to each lane to logically right shift the
2009 * element by shift value as specified by the input scalar. Only the 3
2010 * lowest-order bits of shift value are used. It is as if the shift value
2011 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2012 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2013 *
2014 * @param s the input scalar; the number of the bits to right shift
2015 * @param m the mask controlling lane selection
2016 * @return the result of logically right shifting this vector by the
2017 * broadcast of an input scalar
2018 */
2019 #end[byte]
2020 #if[short]
2021 /**
2022 * Logically right shifts (or unsigned right shifts) this vector by the
2023 * broadcast of an input scalar, selecting lane elements controlled by a
2024 * mask.
2025 * <p>
2026 * This is a lane-wise binary operation which applies the primitive logical right shift
2027 * operation ({@code >>>}) to each lane to logically right shift the
2028 * element by shift value as specified by the input scalar. Only the 4
2029 * lowest-order bits of shift value are used. It is as if the shift value
2030 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2031 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2032 *
2033 * @param s the input scalar; the number of the bits to right shift
2034 * @param m the mask controlling lane selection
2035 * @return the result of logically right shifting this vector by the
2036 * broadcast of an input scalar
2037 */
2038 #end[short]
2039 #if[intOrLong]
2040 /**
2041 * Logically right shifts (or unsigned right shifts) this vector by the
2042 * broadcast of an input scalar, selecting lane elements controlled by a
2043 * mask.
2044 * <p>
2045 * This is a lane-wise binary operation which applies the primitive logical right shift
2046 * operation ({@code >>>}) to each lane.
2047 *
2048 * @param s the input scalar; the number of the bits to right shift
2049 * @param m the mask controlling lane selection
2050 * @return the result of logically right shifting this vector by the
2051 * broadcast of an input scalar
2052 */
2053 #end[intOrLong]
2054 public abstract $abstractvectortype$ shiftR(int s, VectorMask<$Boxtype$> m);
2055
2056 #if[intOrLong]
2057 /**
2058 * Logically right shifts (or unsigned right shifts) this vector by an
2059 * input vector.
2060 * <p>
2061 * This is a lane-wise binary operation which applies the primitive logical right shift
2062 * operation ({@code >>>}) to each lane.
2063 *
2064 * @param v the input vector
2065 * @return the result of logically right shifting this vector by the
2066 * input vector
2067 */
2068 public abstract $abstractvectortype$ shiftR(Vector<$Boxtype$> v);
2069
2070 /**
2071 * Logically right shifts (or unsigned right shifts) this vector by an
2072 * input vector, selecting lane elements controlled by a mask.
2073 * <p>
2074 * This is a lane-wise binary operation which applies the primitive logical right shift
2075 * operation ({@code >>>}) to each lane.
2076 *
2077 * @param v the input vector
2078 * @param m the mask controlling lane selection
2079 * @return the result of logically right shifting this vector by the
2080 * input vector
2081 */
2082 public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2083 return bOp(v, m, (i, a, b) -> ($type$) (a >>> b));
2084 }
2085 #end[intOrLong]
2086
2087 #if[byte]
2088 /**
2089 * Arithmetically right shifts (or signed right shifts) this vector by the
2090 * broadcast of an input scalar.
2091 * <p>
2092 * This is a lane-wise binary operation which applies the primitive arithmetic right
2093 * shift operation ({@code >>}) to each lane to arithmetically
2094 * right shift the element by shift value as specified by the input scalar.
2095 * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2096 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2097 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2098 *
2099 * @param s the input scalar; the number of the bits to right shift
2100 * @return the result of arithmetically right shifting this vector by the
2101 * broadcast of an input scalar
2102 */
2103 #end[byte]
2104 #if[short]
2105 /**
2106 * Arithmetically right shifts (or signed right shifts) this vector by the
2107 * broadcast of an input scalar.
2108 * <p>
2109 * This is a lane-wise binary operation which applies the primitive arithmetic right
2110 * shift operation ({@code >>}) to each lane to arithmetically
2111 * right shift the element by shift value as specified by the input scalar.
2112 * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2113 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2114 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2115 *
2116 * @param s the input scalar; the number of the bits to right shift
2117 * @return the result of arithmetically right shifting this vector by the
2118 * broadcast of an input scalar
2119 */
2120 #end[short]
2121 #if[intOrLong]
2122 /**
2123 * Arithmetically right shifts (or signed right shifts) this vector by the
2124 * broadcast of an input scalar.
2125 * <p>
2126 * This is a lane-wise binary operation which applies the primitive arithmetic right
2127 * shift operation ({@code >>}) to each lane.
2128 *
2129 * @param s the input scalar; the number of the bits to right shift
2130 * @return the result of arithmetically right shifting this vector by the
2131 * broadcast of an input scalar
2132 */
2133 #end[intOrLong]
2134 public abstract $abstractvectortype$ aShiftR(int s);
2135
2136 #if[byte]
2137 /**
2138 * Arithmetically right shifts (or signed right shifts) this vector by the
2139 * broadcast of an input scalar, selecting lane elements controlled by a
2140 * mask.
2141 * <p>
2142 * This is a lane-wise binary operation which applies the primitive arithmetic right
2143 * shift operation ({@code >>}) to each lane to arithmetically
2144 * right shift the element by shift value as specified by the input scalar.
2145 * Only the 3 lowest-order bits of shift value are used. It is as if the shift
2146 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7.
2147 * The shift distance actually used is therefore always in the range 0 to 7, inclusive.
2148 *
2149 * @param s the input scalar; the number of the bits to right shift
2150 * @param m the mask controlling lane selection
2151 * @return the result of arithmetically right shifting this vector by the
2152 * broadcast of an input scalar
2153 */
2154 #end[byte]
2155 #if[short]
2156 /**
2157 * Arithmetically right shifts (or signed right shifts) this vector by the
2158 * broadcast of an input scalar, selecting lane elements controlled by a
2159 * mask.
2160 * <p>
2161 * This is a lane-wise binary operation which applies the primitive arithmetic right
2162 * shift operation ({@code >>}) to each lane to arithmetically
2163 * right shift the element by shift value as specified by the input scalar.
2164 * Only the 4 lowest-order bits of shift value are used. It is as if the shift
2165 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF.
2166 * The shift distance actually used is therefore always in the range 0 to 15, inclusive.
2167 *
2168 * @param s the input scalar; the number of the bits to right shift
2169 * @param m the mask controlling lane selection
2170 * @return the result of arithmetically right shifting this vector by the
2171 * broadcast of an input scalar
2172 */
2173 #end[short]
2174 #if[intOrLong]
2175 /**
2176 * Arithmetically right shifts (or signed right shifts) this vector by the
2177 * broadcast of an input scalar, selecting lane elements controlled by a
2178 * mask.
2179 * <p>
2180 * This is a lane-wise binary operation which applies the primitive arithmetic right
2181 * shift operation ({@code >>}) to each lane.
2182 *
2183 * @param s the input scalar; the number of the bits to right shift
2184 * @param m the mask controlling lane selection
2185 * @return the result of arithmetically right shifting this vector by the
2186 * broadcast of an input scalar
2187 */
2188 #end[intOrLong]
2189 public abstract $abstractvectortype$ aShiftR(int s, VectorMask<$Boxtype$> m);
2190
2191 #if[intOrLong]
2192 /**
2193 * Arithmetically right shifts (or signed right shifts) this vector by an
2194 * input vector.
2195 * <p>
2196 * This is a lane-wise binary operation which applies the primitive arithmetic right
2197 * shift operation ({@code >>}) to each lane.
2198 *
2199 * @param v the input vector
2200 * @return the result of arithmetically right shifting this vector by the
2201 * input vector
2202 */
2203 public abstract $abstractvectortype$ aShiftR(Vector<$Boxtype$> v);
2204
2205 /**
2206 * Arithmetically right shifts (or signed right shifts) this vector by an
2207 * input vector, selecting lane elements controlled by a mask.
2208 * <p>
2209 * This is a lane-wise binary operation which applies the primitive arithmetic right
2210 * shift operation ({@code >>}) to each lane.
2211 *
2212 * @param v the input vector
2213 * @param m the mask controlling lane selection
2214 * @return the result of arithmetically right shifting this vector by the
2215 * input vector
2216 */
2217 public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, VectorMask<$Boxtype$> m) {
2218 return bOp(v, m, (i, a, b) -> ($type$) (a >> b));
2219 }
2220
2221 /**
2222 * Rotates left this vector by the broadcast of an input scalar.
2223 * <p>
2224 * This is a lane-wise binary operation which applies the operation
2225 * {@link $Wideboxtype$#rotateLeft} to each lane and where
2226 * lane elements of this vector apply to the first argument, and lane
2227 * elements of the broadcast vector apply to the second argument (the
2228 * rotation distance).
2229 *
2230 * @param s the input scalar; the number of the bits to rotate left
2231 * @return the result of rotating left this vector by the broadcast of an
2232 * input scalar
2233 */
2234 @ForceInline
2235 public final $abstractvectortype$ rotateL(int s) {
2236 return shiftL(s).or(shiftR(-s));
2237 }
2238
2239 /**
2240 * Rotates left this vector by the broadcast of an input scalar, selecting
2241 * lane elements controlled by a mask.
2242 * <p>
2243 * This is a lane-wise binary operation which applies the operation
2244 * {@link $Wideboxtype$#rotateLeft} to each lane and where
2245 * lane elements of this vector apply to the first argument, and lane
2246 * elements of the broadcast vector apply to the second argument (the
2247 * rotation distance).
2248 *
2249 * @param s the input scalar; the number of the bits to rotate left
2250 * @param m the mask controlling lane selection
2251 * @return the result of rotating left this vector by the broadcast of an
2252 * input scalar
2253 */
2254 @ForceInline
2255 public final $abstractvectortype$ rotateL(int s, VectorMask<$Boxtype$> m) {
2256 return shiftL(s, m).or(shiftR(-s, m), m);
2257 }
2258
2259 /**
2260 * Rotates right this vector by the broadcast of an input scalar.
2261 * <p>
2262 * This is a lane-wise binary operation which applies the operation
2263 * {@link $Wideboxtype$#rotateRight} to each lane and where
2264 * lane elements of this vector apply to the first argument, and lane
2265 * elements of the broadcast vector apply to the second argument (the
2266 * rotation distance).
2267 *
2268 * @param s the input scalar; the number of the bits to rotate right
2269 * @return the result of rotating right this vector by the broadcast of an
2270 * input scalar
2271 */
2272 @ForceInline
2273 public final $abstractvectortype$ rotateR(int s) {
2274 return shiftR(s).or(shiftL(-s));
2275 }
2276
2277 /**
2278 * Rotates right this vector by the broadcast of an input scalar, selecting
2279 * lane elements controlled by a mask.
2280 * <p>
2281 * This is a lane-wise binary operation which applies the operation
2282 * {@link $Wideboxtype$#rotateRight} to each lane and where
2283 * lane elements of this vector apply to the first argument, and lane
2284 * elements of the broadcast vector apply to the second argument (the
2285 * rotation distance).
2286 *
2287 * @param s the input scalar; the number of the bits to rotate right
2288 * @param m the mask controlling lane selection
2289 * @return the result of rotating right this vector by the broadcast of an
2290 * input scalar
2291 */
2292 @ForceInline
2293 public final $abstractvectortype$ rotateR(int s, VectorMask<$Boxtype$> m) {
2294 return shiftR(s, m).or(shiftL(-s, m), m);
2295 }
2296 #end[intOrLong]
2297 #end[BITWISE]
2298
2299 @Override
2300 public abstract void intoByteArray(byte[] a, int ix);
2301
2302 @Override
2303 public abstract void intoByteArray(byte[] a, int ix, VectorMask<$Boxtype$> m);
2304
2305 @Override
2306 public abstract void intoByteBuffer(ByteBuffer bb, int ix);
2307
2308 @Override
2309 public abstract void intoByteBuffer(ByteBuffer bb, int ix, VectorMask<$Boxtype$> m);
2310
2311
2312 // Type specific horizontal reductions
2313 /**
2314 * Adds all lane elements of this vector.
2315 * <p>
2316 #if[FP]
2317 * This is a cross-lane reduction operation which applies the addition
2318 * operation ({@code +}) to lane elements,
2319 * and the identity value is {@code 0.0}.
2320 *
2321 * <p>The value of a floating-point sum is a function both of the input values as well
2322 * as the order of addition operations. The order of addition operations of this method
2323 * is intentionally not defined to allow for JVM to generate optimal machine
2324 * code for the underlying platform at runtime. If the platform supports a vector
2325 * instruction to add all values in the vector, or if there is some other efficient machine
2326 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2327 * the default implementation of adding vectors sequentially from left to right is used.
2328 * For this reason, the output of this method may vary for the same input values.
2329 #else[FP]
2330 * This is an associative cross-lane reduction operation which applies the addition
2331 * operation ({@code +}) to lane elements,
2332 * and the identity value is {@code 0}.
2333 #end[FP]
2334 *
2335 * @return the addition of all the lane elements of this vector
2336 */
2337 public abstract $type$ addAll();
2338
2339 /**
2340 * Adds all lane elements of this vector, selecting lane elements
2341 * controlled by a mask.
2342 * <p>
2343 #if[FP]
2344 * This is a cross-lane reduction operation which applies the addition
2345 * operation ({@code +}) to lane elements,
2346 * and the identity value is {@code 0.0}.
2347 *
2348 * <p>The value of a floating-point sum is a function both of the input values as well
2349 * as the order of addition operations. The order of addition operations of this method
2350 * is intentionally not defined to allow for JVM to generate optimal machine
2351 * code for the underlying platform at runtime. If the platform supports a vector
2352 * instruction to add all values in the vector, or if there is some other efficient machine
2353 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2354 * the default implementation of adding vectors sequentially from left to right is used.
2355 * For this reason, the output of this method may vary on the same input values.
2356 #else[FP]
2357 * This is an associative cross-lane reduction operation which applies the addition
2358 * operation ({@code +}) to lane elements,
2359 * and the identity value is {@code 0}.
2360 #end[FP]
2361 *
2362 * @param m the mask controlling lane selection
2363 * @return the addition of the selected lane elements of this vector
2364 */
2365 public abstract $type$ addAll(VectorMask<$Boxtype$> m);
2366
2367 /**
2368 * Multiplies all lane elements of this vector.
2369 * <p>
2370 #if[FP]
2371 * This is a cross-lane reduction operation which applies the
2372 * multiplication operation ({@code *}) to lane elements,
2373 * and the identity value is {@code 1.0}.
2374 *
2375 * <p>The order of multiplication operations of this method
2376 * is intentionally not defined to allow for JVM to generate optimal machine
2377 * code for the underlying platform at runtime. If the platform supports a vector
2378 * instruction to multiply all values in the vector, or if there is some other efficient machine
2379 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2380 * the default implementation of multiplying vectors sequentially from left to right is used.
2381 * For this reason, the output of this method may vary on the same input values.
2382 #else[FP]
2383 * This is an associative cross-lane reduction operation which applies the
2384 * multiplication operation ({@code *}) to lane elements,
2385 * and the identity value is {@code 1}.
2386 #end[FP]
2387 *
2388 * @return the multiplication of all the lane elements of this vector
2389 */
2390 public abstract $type$ mulAll();
2391
2392 /**
2393 * Multiplies all lane elements of this vector, selecting lane elements
2394 * controlled by a mask.
2395 * <p>
2396 #if[FP]
2397 * This is a cross-lane reduction operation which applies the
2398 * multiplication operation ({@code *}) to lane elements,
2399 * and the identity value is {@code 1.0}.
2400 *
2401 * <p>The order of multiplication operations of this method
2402 * is intentionally not defined to allow for JVM to generate optimal machine
2403 * code for the underlying platform at runtime. If the platform supports a vector
2404 * instruction to multiply all values in the vector, or if there is some other efficient machine
2405 * code sequence, then the JVM has the option of generating this machine code. Otherwise,
2406 * the default implementation of multiplying vectors sequentially from left to right is used.
2407 * For this reason, the output of this method may vary on the same input values.
2408 #else[FP]
2409 * This is an associative cross-lane reduction operation which applies the
2410 * multiplication operation ({@code *}) to lane elements,
2411 * and the identity value is {@code 1}.
2412 #end[FP]
2413 *
2414 * @param m the mask controlling lane selection
2415 * @return the multiplication of all the lane elements of this vector
2416 */
2417 public abstract $type$ mulAll(VectorMask<$Boxtype$> m);
2418
2419 /**
2420 * Returns the minimum lane element of this vector.
2421 * <p>
2422 * This is an associative cross-lane reduction operation which applies the operation
2423 * {@code (a, b) -> Math.min(a, b)} to lane elements,
2424 * and the identity value is
2425 #if[FP]
2426 * {@link $Boxtype$#POSITIVE_INFINITY}.
2427 #else[FP]
2428 * {@link $Boxtype$#MAX_VALUE}.
2429 #end[FP]
2430 *
2431 * @return the minimum lane element of this vector
2432 */
2433 public abstract $type$ minAll();
2434
2435 /**
2436 * Returns the minimum lane element of this vector, selecting lane elements
2437 * controlled by a mask.
2438 * <p>
2439 * This is an associative cross-lane reduction operation which applies the operation
2440 * {@code (a, b) -> Math.min(a, b)} to lane elements,
2441 * and the identity value is
2442 #if[FP]
2443 * {@link $Boxtype$#POSITIVE_INFINITY}.
2444 #else[FP]
2445 * {@link $Boxtype$#MAX_VALUE}.
2446 #end[FP]
2447 *
2448 * @param m the mask controlling lane selection
2449 * @return the minimum lane element of this vector
2450 */
2451 public abstract $type$ minAll(VectorMask<$Boxtype$> m);
2452
2453 /**
2454 * Returns the maximum lane element of this vector.
2455 * <p>
2456 * This is an associative cross-lane reduction operation which applies the operation
2457 * {@code (a, b) -> Math.max(a, b)} to lane elements,
2458 * and the identity value is
2459 #if[FP]
2460 * {@link $Boxtype$#NEGATIVE_INFINITY}.
2461 #else[FP]
2462 * {@link $Boxtype$#MIN_VALUE}.
2463 #end[FP]
2464 *
2465 * @return the maximum lane element of this vector
2466 */
2467 public abstract $type$ maxAll();
2468
2469 /**
2470 * Returns the maximum lane element of this vector, selecting lane elements
2471 * controlled by a mask.
2472 * <p>
2473 * This is an associative cross-lane reduction operation which applies the operation
2474 * {@code (a, b) -> Math.max(a, b)} to lane elements,
2475 * and the identity value is
2476 #if[FP]
2477 * {@link $Boxtype$#NEGATIVE_INFINITY}.
2478 #else[FP]
2479 * {@link $Boxtype$#MIN_VALUE}.
2480 #end[FP]
2481 *
2482 * @param m the mask controlling lane selection
2483 * @return the maximum lane element of this vector
2484 */
2485 public abstract $type$ maxAll(VectorMask<$Boxtype$> m);
2486
2487 #if[BITWISE]
2488 /**
2489 * Logically ORs all lane elements of this vector.
2490 * <p>
2491 * This is an associative cross-lane reduction operation which applies the logical OR
2492 * operation ({@code |}) to lane elements,
2493 * and the identity value is {@code 0}.
2494 *
2495 * @return the logical OR all the lane elements of this vector
2496 */
2497 public abstract $type$ orAll();
2498
2499 /**
2500 * Logically ORs all lane elements of this vector, selecting lane elements
2501 * controlled by a mask.
2502 * <p>
2503 * This is an associative cross-lane reduction operation which applies the logical OR
2504 * operation ({@code |}) to lane elements,
2505 * and the identity value is {@code 0}.
2506 *
2507 * @param m the mask controlling lane selection
2508 * @return the logical OR all the lane elements of this vector
2509 */
2510 public abstract $type$ orAll(VectorMask<$Boxtype$> m);
2511
2512 /**
2513 * Logically ANDs all lane elements of this vector.
2514 * <p>
2515 * This is an associative cross-lane reduction operation which applies the logical AND
2516 * operation ({@code |}) to lane elements,
2517 * and the identity value is {@code -1}.
2518 *
2519 * @return the logical AND all the lane elements of this vector
2520 */
2521 public abstract $type$ andAll();
2522
2523 /**
2524 * Logically ANDs all lane elements of this vector, selecting lane elements
2525 * controlled by a mask.
2526 * <p>
2527 * This is an associative cross-lane reduction operation which applies the logical AND
2528 * operation ({@code |}) to lane elements,
2529 * and the identity value is {@code -1}.
2530 *
2531 * @param m the mask controlling lane selection
2532 * @return the logical AND all the lane elements of this vector
2533 */
2534 public abstract $type$ andAll(VectorMask<$Boxtype$> m);
2535
2536 /**
2537 * Logically XORs all lane elements of this vector.
2538 * <p>
2539 * This is an associative cross-lane reduction operation which applies the logical XOR
2540 * operation ({@code ^}) to lane elements,
2541 * and the identity value is {@code 0}.
2542 *
2543 * @return the logical XOR all the lane elements of this vector
2544 */
2545 public abstract $type$ xorAll();
2546
2547 /**
2548 * Logically XORs all lane elements of this vector, selecting lane elements
2549 * controlled by a mask.
2550 * <p>
2551 * This is an associative cross-lane reduction operation which applies the logical XOR
2552 * operation ({@code ^}) to lane elements,
2553 * and the identity value is {@code 0}.
2554 *
2555 * @param m the mask controlling lane selection
2556 * @return the logical XOR all the lane elements of this vector
2557 */
2558 public abstract $type$ xorAll(VectorMask<$Boxtype$> m);
2559 #end[BITWISE]
2560
2561 // Type specific accessors
2562
2563 /**
2564 * Gets the lane element at lane index {@code i}
2565 *
2566 * @param i the lane index
2567 * @return the lane element at lane index {@code i}
2568 * @throws IllegalArgumentException if the index is is out of range
2569 * ({@code < 0 || >= length()})
2570 */
2571 public abstract $type$ lane(int i);
2572
2573 /**
2574 * Replaces the lane element of this vector at lane index {@code i} with
2575 * value {@code e}.
2576 * <p>
2577 * This is a cross-lane operation and behaves as if it returns the result
2578 * of blending this vector with an input vector that is the result of
2579 * broadcasting {@code e} and a mask that has only one lane set at lane
2580 * index {@code i}.
2581 *
2582 * @param i the lane index of the lane element to be replaced
2583 * @param e the value to be placed
2584 * @return the result of replacing the lane element of this vector at lane
2585 * index {@code i} with value {@code e}.
2586 * @throws IllegalArgumentException if the index is is out of range
2587 * ({@code < 0 || >= length()})
2588 */
2589 public abstract $abstractvectortype$ with(int i, $type$ e);
2590
2591 // Type specific extractors
2598 * <pre>{@code
2599 * $type$[] a = new $type$[this.length()];
2600 * this.intoArray(a, 0);
2601 * return a;
2602 * }</pre>
2603 *
2604 * @return an array containing the the lane elements of this vector
2605 */
2606 @ForceInline
2607 public final $type$[] toArray() {
2608 $type$[] a = new $type$[species().length()];
2609 intoArray(a, 0);
2610 return a;
2611 }
2612
2613 /**
2614 * Stores this vector into an array starting at offset.
2615 * <p>
2616 * For each vector lane, where {@code N} is the vector lane index,
2617 * the lane element at index {@code N} is stored into the array at index
2618 * {@code offset + N}.
2619 *
2620 * @param a the array
2621 * @param offset the offset into the array
2622 * @throws IndexOutOfBoundsException if {@code offset < 0}, or
2623 * {@code offset > a.length - this.length()}
2624 */
2625 public abstract void intoArray($type$[] a, int offset);
2626
2627 /**
2628 * Stores this vector into an array starting at offset and using a mask.
2629 * <p>
2630 * For each vector lane, where {@code N} is the vector lane index,
2631 * if the mask lane at index {@code N} is set then the lane element at
2632 * index {@code N} is stored into the array index {@code offset + N}.
2633 *
2634 * @param a the array
2635 * @param offset the offset into the array
2636 * @param m the mask
2637 * @throws IndexOutOfBoundsException if {@code offset < 0}, or
2638 * for any vector lane index {@code N} where the mask at lane {@code N}
2639 * is set {@code offset >= a.length - N}
2640 */
2641 public abstract void intoArray($type$[] a, int offset, VectorMask<$Boxtype$> m);
2642
2643 /**
2644 * Stores this vector into an array using indexes obtained from an index
2645 * map.
2646 * <p>
2647 * For each vector lane, where {@code N} is the vector lane index, the
2648 * lane element at index {@code N} is stored into the array at index
2649 * {@code a_offset + indexMap[i_offset + N]}.
2650 *
2651 * @param a the array
2652 * @param a_offset the offset into the array, may be negative if relative
2653 * indexes in the index map compensate to produce a value within the
2654 * array bounds
2655 * @param indexMap the index map
2656 * @param i_offset the offset into the index map
2657 * @throws IndexOutOfBoundsException if {@code i_offset < 0}, or
2658 * {@code i_offset > indexMap.length - this.length()},
2659 * or for any vector lane index {@code N} the result of
2660 * {@code a_offset + indexMap[i_offset + N]} is {@code < 0} or {@code >= a.length}
2661 */
2662 #if[byteOrShort]
2663 public void intoArray($type$[] a, int a_offset, int[] indexMap, int i_offset) {
2664 forEach((n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
2665 }
2666 #else[byteOrShort]
2667 public abstract void intoArray($type$[] a, int a_offset, int[] indexMap, int i_offset);
2668 #end[byteOrShort]
2669
2670 /**
2671 * Stores this vector into an array using indexes obtained from an index
2672 * map and using a mask.
2673 * <p>
2674 * For each vector lane, where {@code N} is the vector lane index,
2675 * if the mask lane at index {@code N} is set then the lane element at
2676 * index {@code N} is stored into the array at index
2677 * {@code a_offset + indexMap[i_offset + N]}.
2678 *
2679 * @param a the array
2680 * @param a_offset the offset into the array, may be negative if relative
2681 * indexes in the index map compensate to produce a value within the
2682 * array bounds
2683 * @param m the mask
2684 * @param indexMap the index map
2685 * @param i_offset the offset into the index map
2686 * @throws IndexOutOfBoundsException if {@code j < 0}, or
2687 * {@code i_offset > indexMap.length - this.length()},
2688 * or for any vector lane index {@code N} where the mask at lane
2689 * {@code N} is set the result of {@code a_offset + indexMap[i_offset + N]} is
2690 * {@code < 0} or {@code >= a.length}
2691 */
2692 #if[byteOrShort]
2693 public void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset) {
2694 forEach(m, (n, e) -> a[a_offset + indexMap[i_offset + n]] = e);
2695 }
2696 #else[byteOrShort]
2697 public abstract void intoArray($type$[] a, int a_offset, VectorMask<$Boxtype$> m, int[] indexMap, int i_offset);
2698 #end[byteOrShort]
2699 // Species
2700
2701 @Override
2702 public abstract VectorSpecies<$Boxtype$> species();
2703
2704 /**
2705 * Class representing {@link $abstractvectortype$}'s of the same {@link VectorShape VectorShape}.
2706 */
2707 static final class $Type$Species extends AbstractSpecies<$Boxtype$> {
2708 final Function<$type$[], $Type$Vector> vectorFactory;
2709
2710 private $Type$Species(VectorShape shape,
2711 Class<?> boxType,
2712 Class<?> maskType,
2713 Function<$type$[], $Type$Vector> vectorFactory,
2714 Function<boolean[], VectorMask<$Boxtype$>> maskFactory,
2715 Function<IntUnaryOperator, VectorShuffle<$Boxtype$>> shuffleFromArrayFactory,
2716 fShuffleFromArray<$Boxtype$> shuffleFromOpFactory) {
2717 super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType, maskFactory,
|