1 /* 2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have 23 * questions. 24 */ 25 package jdk.incubator.vector; 26 27 import java.nio.ByteBuffer; 28 #if[!byte] 29 import java.nio.$Type$Buffer; 30 #end[!byte] 31 import java.nio.ByteOrder; 32 import java.util.Objects; 33 import java.util.function.IntUnaryOperator; 34 import java.util.function.Function; 35 import java.util.concurrent.ThreadLocalRandom; 36 37 import jdk.internal.misc.Unsafe; 38 import jdk.internal.vm.annotation.ForceInline; 39 import static jdk.incubator.vector.VectorIntrinsics.*; 40 41 42 /** 43 * A specialized {@link Vector} representing an ordered immutable sequence of 44 * {@code $type$} values. 45 */ 46 @SuppressWarnings("cast") 47 public abstract class $abstractvectortype$ extends Vector<$Boxtype$> { 48 49 $abstractvectortype$() {} 50 51 private static final int ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(Unsafe.ARRAY_$TYPE$_INDEX_SCALE); 52 53 // Unary operator 54 55 interface FUnOp { 56 $type$ apply(int i, $type$ a); 57 } 58 59 abstract $abstractvectortype$ uOp(FUnOp f); 60 61 abstract $abstractvectortype$ uOp(Mask<$Boxtype$> m, FUnOp f); 62 63 // Binary operator 64 65 interface FBinOp { 66 $type$ apply(int i, $type$ a, $type$ b); 67 } 68 69 abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, FBinOp f); 70 71 abstract $abstractvectortype$ bOp(Vector<$Boxtype$> v, Mask<$Boxtype$> m, FBinOp f); 72 73 // Trinary operator 74 75 interface FTriOp { 76 $type$ apply(int i, $type$ a, $type$ b, $type$ c); 77 } 78 79 abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, FTriOp f); 80 81 abstract $abstractvectortype$ tOp(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m, FTriOp f); 82 83 // Reduction operator 84 85 abstract $type$ rOp($type$ v, FBinOp f); 86 87 // Binary test 88 89 interface FBinTest { 90 boolean apply(int i, $type$ a, $type$ b); 91 } 92 93 abstract Mask<$Boxtype$> bTest(Vector<$Boxtype$> v, FBinTest f); 94 95 // Foreach 96 97 interface FUnCon { 98 void apply(int i, $type$ a); 99 } 100 101 abstract void forEach(FUnCon f); 102 103 abstract void forEach(Mask<$Boxtype$> m, FUnCon f); 104 105 // Static factories 106 107 /** 108 * Returns a vector where all lane elements are set to the default 109 * primitive value. 110 * 111 * @param species species of desired vector 112 * @return a zero vector of given species 113 */ 114 @ForceInline 115 @SuppressWarnings("unchecked") 116 public static $abstractvectortype$ zero(Species<$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(Species<$Boxtype$>, ByteBuffer, int, Mask) 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(Species<$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(Species<$Boxtype$>, ByteBuffer, int, Mask) 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(Species<$Boxtype$> species, byte[] a, int ix, Mask<$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(Species<$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(Species<$Boxtype$> species, $type$[] a, int i, Mask<$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(Species<$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(Species<$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, Species<$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(Species<$Boxtype$> species, $type$[] a, int i, Mask<$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(Species<$Boxtype$> species, $type$[] a, int i, Mask<$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(Species<$Boxtype$>, ByteBuffer, int, Mask)} 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(Species<$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(Species<$Boxtype$> species, ByteBuffer bb, int ix, Mask<$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(Species<$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(Species<$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(Species<$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(Species<$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(Species<$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(Species<$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(Species<$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 /** 519 * Returns a mask where each lane is set or unset according to given 520 * {@code boolean} values 521 * <p> 522 * For each mask lane, where {@code N} is the mask lane index, 523 * if the given {@code boolean} value at index {@code N} is {@code true} 524 * then the mask lane at index {@code N} is set, otherwise it is unset. 525 * 526 * @param species mask species 527 * @param bits the given {@code boolean} values 528 * @return a mask where each lane is set or unset according to the given {@code boolean} value 529 * @throws IndexOutOfBoundsException if {@code bits.length < species.length()} 530 */ 531 @ForceInline 532 public static Mask<$Boxtype$> maskFromValues(Species<$Boxtype$> species, boolean... bits) { 533 if (species.boxType() == $Type$MaxVector.class) 534 return new $Type$MaxVector.$Type$MaxMask(bits); 535 switch (species.bitSize()) { 536 case 64: return new $Type$64Vector.$Type$64Mask(bits); 537 case 128: return new $Type$128Vector.$Type$128Mask(bits); 538 case 256: return new $Type$256Vector.$Type$256Mask(bits); 539 case 512: return new $Type$512Vector.$Type$512Mask(bits); 540 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 541 } 542 } 543 544 // @@@ This is a bad implementation -- makes lambdas capturing -- fix this 545 static Mask<$Boxtype$> trueMask(Species<$Boxtype$> species) { 546 if (species.boxType() == $Type$MaxVector.class) 547 return $Type$MaxVector.$Type$MaxMask.TRUE_MASK; 548 switch (species.bitSize()) { 549 case 64: return $Type$64Vector.$Type$64Mask.TRUE_MASK; 550 case 128: return $Type$128Vector.$Type$128Mask.TRUE_MASK; 551 case 256: return $Type$256Vector.$Type$256Mask.TRUE_MASK; 552 case 512: return $Type$512Vector.$Type$512Mask.TRUE_MASK; 553 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 554 } 555 } 556 557 static Mask<$Boxtype$> falseMask(Species<$Boxtype$> species) { 558 if (species.boxType() == $Type$MaxVector.class) 559 return $Type$MaxVector.$Type$MaxMask.FALSE_MASK; 560 switch (species.bitSize()) { 561 case 64: return $Type$64Vector.$Type$64Mask.FALSE_MASK; 562 case 128: return $Type$128Vector.$Type$128Mask.FALSE_MASK; 563 case 256: return $Type$256Vector.$Type$256Mask.FALSE_MASK; 564 case 512: return $Type$512Vector.$Type$512Mask.FALSE_MASK; 565 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 566 } 567 } 568 569 /** 570 * Loads a mask from a {@code boolean} array starting at an offset. 571 * <p> 572 * For each mask lane, where {@code N} is the mask lane index, 573 * if the array element at index {@code ix + N} is {@code true} then the 574 * mask lane at index {@code N} is set, otherwise it is unset. 575 * 576 * @param species mask species 577 * @param bits the {@code boolean} array 578 * @param ix the offset into the array 579 * @return the mask loaded from a {@code boolean} array 580 * @throws IndexOutOfBoundsException if {@code ix < 0}, or 581 * {@code ix > bits.length - species.length()} 582 */ 583 @ForceInline 584 @SuppressWarnings("unchecked") 585 public static Mask<$Boxtype$> maskFromArray(Species<$Boxtype$> species, boolean[] bits, int ix) { 586 Objects.requireNonNull(bits); 587 ix = VectorIntrinsics.checkIndex(ix, bits.length, species.length()); 588 return VectorIntrinsics.load((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(), 589 bits, (((long) ix) << ARRAY_SHIFT) + Unsafe.ARRAY_BOOLEAN_BASE_OFFSET, 590 bits, ix, species, 591 (c, idx, s) -> (Mask<$Boxtype$>) (($Type$Species)s).opm(n -> c[idx + n])); 592 } 593 594 /** 595 * Returns a mask where all lanes are set. 596 * 597 * @param species mask species 598 * @return a mask where all lanes are set 599 */ 600 @ForceInline 601 @SuppressWarnings("unchecked") 602 public static Mask<$Boxtype$> maskAllTrue(Species<$Boxtype$> species) { 603 return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(), 604 ($bitstype$)-1, species, 605 ((z, s) -> trueMask(s))); 606 } 607 608 /** 609 * Returns a mask where all lanes are unset. 610 * 611 * @param species mask species 612 * @return a mask where all lanes are unset 613 */ 614 @ForceInline 615 @SuppressWarnings("unchecked") 616 public static Mask<$Boxtype$> maskAllFalse(Species<$Boxtype$> species) { 617 return VectorIntrinsics.broadcastCoerced((Class<Mask<$Boxtype$>>) species.maskType(), $bitstype$.class, species.length(), 618 0, species, 619 ((z, s) -> falseMask(s))); 620 } 621 622 /** 623 * Returns a shuffle of mapped indexes where each lane element is 624 * the result of applying a mapping function to the corresponding lane 625 * index. 626 * <p> 627 * Care should be taken to ensure Shuffle values produced from this 628 * method are consumed as constants to ensure optimal generation of 629 * code. For example, values held in static final fields or values 630 * held in loop constant local variables. 631 * <p> 632 * This method behaves as if a shuffle is created from an array of 633 * mapped indexes as follows: 634 * <pre>{@code 635 * int[] a = new int[species.length()]; 636 * for (int i = 0; i < a.length; i++) { 637 * a[i] = f.applyAsInt(i); 638 * } 639 * return this.shuffleFromValues(a); 640 * }</pre> 641 * 642 * @param species shuffle species 643 * @param f the lane index mapping function 644 * @return a shuffle of mapped indexes 645 */ 646 @ForceInline 647 public static Shuffle<$Boxtype$> shuffle(Species<$Boxtype$> species, IntUnaryOperator f) { 648 if (species.boxType() == $Type$MaxVector.class) 649 return new $Type$MaxVector.$Type$MaxShuffle(f); 650 switch (species.bitSize()) { 651 case 64: return new $Type$64Vector.$Type$64Shuffle(f); 652 case 128: return new $Type$128Vector.$Type$128Shuffle(f); 653 case 256: return new $Type$256Vector.$Type$256Shuffle(f); 654 case 512: return new $Type$512Vector.$Type$512Shuffle(f); 655 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 656 } 657 } 658 659 /** 660 * Returns a shuffle where each lane element is the value of its 661 * corresponding lane index. 662 * <p> 663 * This method behaves as if a shuffle is created from an identity 664 * index mapping function as follows: 665 * <pre>{@code 666 * return this.shuffle(i -> i); 667 * }</pre> 668 * 669 * @param species shuffle species 670 * @return a shuffle of lane indexes 671 */ 672 @ForceInline 673 public static Shuffle<$Boxtype$> shuffleIota(Species<$Boxtype$> species) { 674 if (species.boxType() == $Type$MaxVector.class) 675 return new $Type$MaxVector.$Type$MaxShuffle(AbstractShuffle.IDENTITY); 676 switch (species.bitSize()) { 677 case 64: return new $Type$64Vector.$Type$64Shuffle(AbstractShuffle.IDENTITY); 678 case 128: return new $Type$128Vector.$Type$128Shuffle(AbstractShuffle.IDENTITY); 679 case 256: return new $Type$256Vector.$Type$256Shuffle(AbstractShuffle.IDENTITY); 680 case 512: return new $Type$512Vector.$Type$512Shuffle(AbstractShuffle.IDENTITY); 681 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 682 } 683 } 684 685 /** 686 * Returns a shuffle where each lane element is set to a given 687 * {@code int} value logically AND'ed by the species length minus one. 688 * <p> 689 * For each shuffle lane, where {@code N} is the shuffle lane index, the 690 * the {@code int} value at index {@code N} logically AND'ed by 691 * {@code species.length() - 1} is placed into the resulting shuffle at 692 * lane index {@code N}. 693 * 694 * @param species shuffle species 695 * @param ixs the given {@code int} values 696 * @return a shuffle where each lane element is set to a given 697 * {@code int} value 698 * @throws IndexOutOfBoundsException if the number of int values is 699 * {@code < species.length()} 700 */ 701 @ForceInline 702 public static Shuffle<$Boxtype$> shuffleFromValues(Species<$Boxtype$> species, int... ixs) { 703 if (species.boxType() == $Type$MaxVector.class) 704 return new $Type$MaxVector.$Type$MaxShuffle(ixs); 705 switch (species.bitSize()) { 706 case 64: return new $Type$64Vector.$Type$64Shuffle(ixs); 707 case 128: return new $Type$128Vector.$Type$128Shuffle(ixs); 708 case 256: return new $Type$256Vector.$Type$256Shuffle(ixs); 709 case 512: return new $Type$512Vector.$Type$512Shuffle(ixs); 710 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 711 } 712 } 713 714 /** 715 * Loads a shuffle from an {@code int} array starting at an offset. 716 * <p> 717 * For each shuffle lane, where {@code N} is the shuffle lane index, the 718 * array element at index {@code i + N} logically AND'ed by 719 * {@code species.length() - 1} is placed into the resulting shuffle at lane 720 * index {@code N}. 721 * 722 * @param species shuffle species 723 * @param ixs the {@code int} array 724 * @param i the offset into the array 725 * @return a shuffle loaded from the {@code int} array 726 * @throws IndexOutOfBoundsException if {@code i < 0}, or 727 * {@code i > a.length - species.length()} 728 */ 729 @ForceInline 730 public static Shuffle<$Boxtype$> shuffleFromArray(Species<$Boxtype$> species, int[] ixs, int i) { 731 if (species.boxType() == $Type$MaxVector.class) 732 return new $Type$MaxVector.$Type$MaxShuffle(ixs, i); 733 switch (species.bitSize()) { 734 case 64: return new $Type$64Vector.$Type$64Shuffle(ixs, i); 735 case 128: return new $Type$128Vector.$Type$128Shuffle(ixs, i); 736 case 256: return new $Type$256Vector.$Type$256Shuffle(ixs, i); 737 case 512: return new $Type$512Vector.$Type$512Shuffle(ixs, i); 738 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 739 } 740 } 741 742 // Ops 743 744 @Override 745 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v); 746 747 /** 748 * Adds this vector to the broadcast of an input scalar. 749 * <p> 750 * This is a vector binary operation where the primitive addition operation 751 * ({@code +}) is applied to lane elements. 752 * 753 * @param s the input scalar 754 * @return the result of adding this vector to the broadcast of an input 755 * scalar 756 */ 757 public abstract $abstractvectortype$ add($type$ s); 758 759 @Override 760 public abstract $abstractvectortype$ add(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 761 762 /** 763 * Adds this vector to broadcast of an input scalar, 764 * selecting lane elements controlled by a mask. 765 * <p> 766 * This is a vector binary operation where the primitive addition operation 767 * ({@code +}) is applied to lane elements. 768 * 769 * @param s the input scalar 770 * @param m the mask controlling lane selection 771 * @return the result of adding this vector to the broadcast of an input 772 * scalar 773 */ 774 public abstract $abstractvectortype$ add($type$ s, Mask<$Boxtype$> m); 775 776 @Override 777 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v); 778 779 /** 780 * Subtracts the broadcast of an input scalar from this vector. 781 * <p> 782 * This is a vector binary operation where the primitive subtraction 783 * operation ({@code -}) is applied to lane elements. 784 * 785 * @param s the input scalar 786 * @return the result of subtracting the broadcast of an input 787 * scalar from this vector 788 */ 789 public abstract $abstractvectortype$ sub($type$ s); 790 791 @Override 792 public abstract $abstractvectortype$ sub(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 793 794 /** 795 * Subtracts the broadcast of an input scalar from this vector, selecting 796 * lane elements controlled by a mask. 797 * <p> 798 * This is a vector binary operation where the primitive subtraction 799 * operation ({@code -}) is applied to lane elements. 800 * 801 * @param s the input scalar 802 * @param m the mask controlling lane selection 803 * @return the result of subtracting the broadcast of an input 804 * scalar from this vector 805 */ 806 public abstract $abstractvectortype$ sub($type$ s, Mask<$Boxtype$> m); 807 808 @Override 809 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v); 810 811 /** 812 * Multiplies this vector with the broadcast of an input scalar. 813 * <p> 814 * This is a vector binary operation where the primitive multiplication 815 * operation ({@code *}) is applied to lane elements. 816 * 817 * @param s the input scalar 818 * @return the result of multiplying this vector with the broadcast of an 819 * input scalar 820 */ 821 public abstract $abstractvectortype$ mul($type$ s); 822 823 @Override 824 public abstract $abstractvectortype$ mul(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 825 826 /** 827 * Multiplies this vector with the broadcast of an input scalar, selecting 828 * lane elements controlled by a mask. 829 * <p> 830 * This is a vector binary operation where the primitive multiplication 831 * operation ({@code *}) is applied to lane elements. 832 * 833 * @param s the input scalar 834 * @param m the mask controlling lane selection 835 * @return the result of multiplying this vector with the broadcast of an 836 * input scalar 837 */ 838 public abstract $abstractvectortype$ mul($type$ s, Mask<$Boxtype$> m); 839 840 @Override 841 public abstract $abstractvectortype$ neg(); 842 843 @Override 844 public abstract $abstractvectortype$ neg(Mask<$Boxtype$> m); 845 846 @Override 847 public abstract $abstractvectortype$ abs(); 848 849 @Override 850 public abstract $abstractvectortype$ abs(Mask<$Boxtype$> m); 851 852 @Override 853 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v); 854 855 @Override 856 public abstract $abstractvectortype$ min(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 857 858 /** 859 * Returns the minimum of this vector and the broadcast of an input scalar. 860 * <p> 861 * This is a vector binary operation where the operation 862 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements. 863 * 864 * @param s the input scalar 865 * @return the minimum of this vector and the broadcast of an input scalar 866 */ 867 public abstract $abstractvectortype$ min($type$ s); 868 869 @Override 870 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v); 871 872 @Override 873 public abstract $abstractvectortype$ max(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 874 875 /** 876 * Returns the maximum of this vector and the broadcast of an input scalar. 877 * <p> 878 * This is a vector binary operation where the operation 879 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements. 880 * 881 * @param s the input scalar 882 * @return the maximum of this vector and the broadcast of an input scalar 883 */ 884 public abstract $abstractvectortype$ max($type$ s); 885 886 @Override 887 public abstract Mask<$Boxtype$> equal(Vector<$Boxtype$> v); 888 889 /** 890 * Tests if this vector is equal to the broadcast of an input scalar. 891 * <p> 892 * This is a vector binary test operation where the primitive equals 893 * operation ({@code ==}) is applied to lane elements. 894 * 895 * @param s the input scalar 896 * @return the result mask of testing if this vector is equal to the 897 * broadcast of an input scalar 898 */ 899 public abstract Mask<$Boxtype$> equal($type$ s); 900 901 @Override 902 public abstract Mask<$Boxtype$> notEqual(Vector<$Boxtype$> v); 903 904 /** 905 * Tests if this vector is not equal to the broadcast of an input scalar. 906 * <p> 907 * This is a vector binary test operation where the primitive not equals 908 * operation ({@code !=}) is applied to lane elements. 909 * 910 * @param s the input scalar 911 * @return the result mask of testing if this vector is not equal to the 912 * broadcast of an input scalar 913 */ 914 public abstract Mask<$Boxtype$> notEqual($type$ s); 915 916 @Override 917 public abstract Mask<$Boxtype$> lessThan(Vector<$Boxtype$> v); 918 919 /** 920 * Tests if this vector is less than the broadcast of an input scalar. 921 * <p> 922 * This is a vector binary test operation where the primitive less than 923 * operation ({@code <}) is applied to lane elements. 924 * 925 * @param s the input scalar 926 * @return the mask result of testing if this vector is less than the 927 * broadcast of an input scalar 928 */ 929 public abstract Mask<$Boxtype$> lessThan($type$ s); 930 931 @Override 932 public abstract Mask<$Boxtype$> lessThanEq(Vector<$Boxtype$> v); 933 934 /** 935 * Tests if this vector is less or equal to the broadcast of an input scalar. 936 * <p> 937 * This is a vector binary test operation where the primitive less than 938 * or equal to operation ({@code <=}) is applied to lane elements. 939 * 940 * @param s the input scalar 941 * @return the mask result of testing if this vector is less than or equal 942 * to the broadcast of an input scalar 943 */ 944 public abstract Mask<$Boxtype$> lessThanEq($type$ s); 945 946 @Override 947 public abstract Mask<$Boxtype$> greaterThan(Vector<$Boxtype$> v); 948 949 /** 950 * Tests if this vector is greater than the broadcast of an input scalar. 951 * <p> 952 * This is a vector binary test operation where the primitive greater than 953 * operation ({@code >}) is applied to lane elements. 954 * 955 * @param s the input scalar 956 * @return the mask result of testing if this vector is greater than the 957 * broadcast of an input scalar 958 */ 959 public abstract Mask<$Boxtype$> greaterThan($type$ s); 960 961 @Override 962 public abstract Mask<$Boxtype$> greaterThanEq(Vector<$Boxtype$> v); 963 964 /** 965 * Tests if this vector is greater than or equal to the broadcast of an 966 * input scalar. 967 * <p> 968 * This is a vector binary test operation where the primitive greater than 969 * or equal to operation ({@code >=}) is applied to lane elements. 970 * 971 * @param s the input scalar 972 * @return the mask result of testing if this vector is greater than or 973 * equal to the broadcast of an input scalar 974 */ 975 public abstract Mask<$Boxtype$> greaterThanEq($type$ s); 976 977 @Override 978 public abstract $abstractvectortype$ blend(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 979 980 /** 981 * Blends the lane elements of this vector with those of the broadcast of an 982 * input scalar, selecting lanes controlled by a mask. 983 * <p> 984 * For each lane of the mask, at lane index {@code N}, if the mask lane 985 * is set then the lane element at {@code N} from the input vector is 986 * selected and placed into the resulting vector at {@code N}, 987 * otherwise the the lane element at {@code N} from this input vector is 988 * selected and placed into the resulting vector at {@code N}. 989 * 990 * @param s the input scalar 991 * @param m the mask controlling lane selection 992 * @return the result of blending the lane elements of this vector with 993 * those of the broadcast of an input scalar 994 */ 995 public abstract $abstractvectortype$ blend($type$ s, Mask<$Boxtype$> m); 996 997 @Override 998 public abstract $abstractvectortype$ rearrange(Vector<$Boxtype$> v, 999 Shuffle<$Boxtype$> s, Mask<$Boxtype$> m); 1000 1001 @Override 1002 public abstract $abstractvectortype$ rearrange(Shuffle<$Boxtype$> m); 1003 1004 @Override 1005 public abstract $abstractvectortype$ reshape(Species<$Boxtype$> s); 1006 1007 @Override 1008 public abstract $abstractvectortype$ rotateEL(int i); 1009 1010 @Override 1011 public abstract $abstractvectortype$ rotateER(int i); 1012 1013 @Override 1014 public abstract $abstractvectortype$ shiftEL(int i); 1015 1016 @Override 1017 public abstract $abstractvectortype$ shiftER(int i); 1018 1019 #if[FP] 1020 /** 1021 * Divides this vector by an input vector. 1022 * <p> 1023 * This is a vector binary operation where the primitive division 1024 * operation ({@code /}) is applied to lane elements. 1025 * 1026 * @param v the input vector 1027 * @return the result of dividing this vector by the input vector 1028 */ 1029 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v); 1030 1031 /** 1032 * Divides this vector by the broadcast of an input scalar. 1033 * <p> 1034 * This is a vector binary operation where the primitive division 1035 * operation ({@code /}) is applied to lane elements. 1036 * 1037 * @param s the input scalar 1038 * @return the result of dividing this vector by the broadcast of an input 1039 * scalar 1040 */ 1041 public abstract $abstractvectortype$ div($type$ s); 1042 1043 /** 1044 * Divides this vector by an input vector, selecting lane elements 1045 * controlled by a mask. 1046 * <p> 1047 * This is a vector binary operation where the primitive division 1048 * operation ({@code /}) is applied to lane elements. 1049 * 1050 * @param v the input vector 1051 * @param m the mask controlling lane selection 1052 * @return the result of dividing this vector by the input vector 1053 */ 1054 public abstract $abstractvectortype$ div(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 1055 1056 /** 1057 * Divides this vector by the broadcast of an input scalar, selecting lane 1058 * elements controlled by a mask. 1059 * <p> 1060 * This is a vector binary operation where the primitive division 1061 * operation ({@code /}) is applied to lane elements. 1062 * 1063 * @param s the input scalar 1064 * @param m the mask controlling lane selection 1065 * @return the result of dividing this vector by the broadcast of an input 1066 * scalar 1067 */ 1068 public abstract $abstractvectortype$ div($type$ s, Mask<$Boxtype$> m); 1069 1070 /** 1071 * Calculates the square root of this vector. 1072 * <p> 1073 * This is a vector unary operation where the {@link Math#sqrt} operation 1074 * is applied to lane elements. 1075 * 1076 * @return the square root of this vector 1077 */ 1078 public abstract $abstractvectortype$ sqrt(); 1079 1080 /** 1081 * Calculates the square root of this vector, selecting lane elements 1082 * controlled by a mask. 1083 * <p> 1084 * This is a vector unary operation where the {@link Math#sqrt} operation 1085 * is applied to lane elements. 1086 * 1087 * @param m the mask controlling lane selection 1088 * @return the square root of this vector 1089 */ 1090 public $abstractvectortype$ sqrt(Mask<$Boxtype$> m) { 1091 return uOp(m, (i, a) -> ($type$) Math.sqrt((double) a)); 1092 } 1093 1094 /** 1095 * Calculates the trigonometric tangent of this vector. 1096 * <p> 1097 * This is a vector unary operation with same semantic definition as 1098 * {@link Math#tan} operation applied to lane elements. 1099 * The implementation is not required to return same 1100 * results as {@link Math#tan}, but adheres to rounding, monotonicity, 1101 * and special case semantics as defined in the {@link Math#tan} 1102 * specifications. The computed result will be within 1 ulp of the 1103 * exact result. 1104 * 1105 * @return the tangent of this vector 1106 */ 1107 public $abstractvectortype$ tan() { 1108 return uOp((i, a) -> ($type$) Math.tan((double) a)); 1109 } 1110 1111 /** 1112 * Calculates the trigonometric tangent of this vector, selecting lane 1113 * elements controlled by a mask. 1114 * <p> 1115 * Semantics for rounding, monotonicity, and special cases are 1116 * described in {@link $abstractvectortype$#tan} 1117 * 1118 * @param m the mask controlling lane selection 1119 * @return the tangent of this vector 1120 */ 1121 public $abstractvectortype$ tan(Mask<$Boxtype$> m) { 1122 return uOp(m, (i, a) -> ($type$) Math.tan((double) a)); 1123 } 1124 1125 /** 1126 * Calculates the hyperbolic tangent of this vector. 1127 * <p> 1128 * This is a vector unary operation with same semantic definition as 1129 * {@link Math#tanh} operation applied to lane elements. 1130 * The implementation is not required to return same 1131 * results as {@link Math#tanh}, but adheres to rounding, monotonicity, 1132 * and special case semantics as defined in the {@link Math#tanh} 1133 * specifications. The computed result will be within 2.5 ulps of the 1134 * exact result. 1135 * 1136 * @return the hyperbolic tangent of this vector 1137 */ 1138 public $abstractvectortype$ tanh() { 1139 return uOp((i, a) -> ($type$) Math.tanh((double) a)); 1140 } 1141 1142 /** 1143 * Calculates the hyperbolic tangent of this vector, selecting lane elements 1144 * controlled by a mask. 1145 * <p> 1146 * Semantics for rounding, monotonicity, and special cases are 1147 * described in {@link $abstractvectortype$#tanh} 1148 * 1149 * @param m the mask controlling lane selection 1150 * @return the hyperbolic tangent of this vector 1151 */ 1152 public $abstractvectortype$ tanh(Mask<$Boxtype$> m) { 1153 return uOp(m, (i, a) -> ($type$) Math.tanh((double) a)); 1154 } 1155 1156 /** 1157 * Calculates the trigonometric sine of this vector. 1158 * <p> 1159 * This is a vector unary operation with same semantic definition as 1160 * {@link Math#sin} operation applied to lane elements. 1161 * The implementation is not required to return same 1162 * results as {@link Math#sin}, but adheres to rounding, monotonicity, 1163 * and special case semantics as defined in the {@link Math#sin} 1164 * specifications. The computed result will be within 1 ulp of the 1165 * exact result. 1166 * 1167 * @return the sine of this vector 1168 */ 1169 public $abstractvectortype$ sin() { 1170 return uOp((i, a) -> ($type$) Math.sin((double) a)); 1171 } 1172 1173 /** 1174 * Calculates the trigonometric sine of this vector, selecting lane elements 1175 * controlled by a mask. 1176 * <p> 1177 * Semantics for rounding, monotonicity, and special cases are 1178 * described in {@link $abstractvectortype$#sin} 1179 * 1180 * @param m the mask controlling lane selection 1181 * @return the sine of this vector 1182 */ 1183 public $abstractvectortype$ sin(Mask<$Boxtype$> m) { 1184 return uOp(m, (i, a) -> ($type$) Math.sin((double) a)); 1185 } 1186 1187 /** 1188 * Calculates the hyperbolic sine of this vector. 1189 * <p> 1190 * This is a vector unary operation with same semantic definition as 1191 * {@link Math#sinh} operation applied to lane elements. 1192 * The implementation is not required to return same 1193 * results as {@link Math#sinh}, but adheres to rounding, monotonicity, 1194 * and special case semantics as defined in the {@link Math#sinh} 1195 * specifications. The computed result will be within 2.5 ulps of the 1196 * exact result. 1197 * 1198 * @return the hyperbolic sine of this vector 1199 */ 1200 public $abstractvectortype$ sinh() { 1201 return uOp((i, a) -> ($type$) Math.sinh((double) a)); 1202 } 1203 1204 /** 1205 * Calculates the hyperbolic sine of this vector, selecting lane elements 1206 * controlled by a mask. 1207 * <p> 1208 * Semantics for rounding, monotonicity, and special cases are 1209 * described in {@link $abstractvectortype$#sinh} 1210 * 1211 * @param m the mask controlling lane selection 1212 * @return the hyperbolic sine of this vector 1213 */ 1214 public $abstractvectortype$ sinh(Mask<$Boxtype$> m) { 1215 return uOp(m, (i, a) -> ($type$) Math.sinh((double) a)); 1216 } 1217 1218 /** 1219 * Calculates the trigonometric cosine of this vector. 1220 * <p> 1221 * This is a vector unary operation with same semantic definition as 1222 * {@link Math#cos} operation applied to lane elements. 1223 * The implementation is not required to return same 1224 * results as {@link Math#cos}, but adheres to rounding, monotonicity, 1225 * and special case semantics as defined in the {@link Math#cos} 1226 * specifications. The computed result will be within 1 ulp of the 1227 * exact result. 1228 * 1229 * @return the cosine of this vector 1230 */ 1231 public $abstractvectortype$ cos() { 1232 return uOp((i, a) -> ($type$) Math.cos((double) a)); 1233 } 1234 1235 /** 1236 * Calculates the trigonometric cosine of this vector, selecting lane 1237 * elements controlled by a mask. 1238 * <p> 1239 * Semantics for rounding, monotonicity, and special cases are 1240 * described in {@link $abstractvectortype$#cos} 1241 * 1242 * @param m the mask controlling lane selection 1243 * @return the cosine of this vector 1244 */ 1245 public $abstractvectortype$ cos(Mask<$Boxtype$> m) { 1246 return uOp(m, (i, a) -> ($type$) Math.cos((double) a)); 1247 } 1248 1249 /** 1250 * Calculates the hyperbolic cosine of this vector. 1251 * <p> 1252 * This is a vector unary operation with same semantic definition as 1253 * {@link Math#cosh} operation applied to lane elements. 1254 * The implementation is not required to return same 1255 * results as {@link Math#cosh}, but adheres to rounding, monotonicity, 1256 * and special case semantics as defined in the {@link Math#cosh} 1257 * specifications. The computed result will be within 2.5 ulps of the 1258 * exact result. 1259 * 1260 * @return the hyperbolic cosine of this vector 1261 */ 1262 public $abstractvectortype$ cosh() { 1263 return uOp((i, a) -> ($type$) Math.cosh((double) a)); 1264 } 1265 1266 /** 1267 * Calculates the hyperbolic cosine of this vector, selecting lane elements 1268 * controlled by a mask. 1269 * <p> 1270 * Semantics for rounding, monotonicity, and special cases are 1271 * described in {@link $abstractvectortype$#cosh} 1272 * 1273 * @param m the mask controlling lane selection 1274 * @return the hyperbolic cosine of this vector 1275 */ 1276 public $abstractvectortype$ cosh(Mask<$Boxtype$> m) { 1277 return uOp(m, (i, a) -> ($type$) Math.cosh((double) a)); 1278 } 1279 1280 /** 1281 * Calculates the arc sine of this vector. 1282 * <p> 1283 * This is a vector unary operation with same semantic definition as 1284 * {@link Math#asin} operation applied to lane elements. 1285 * The implementation is not required to return same 1286 * results as {@link Math#asin}, but adheres to rounding, monotonicity, 1287 * and special case semantics as defined in the {@link Math#asin} 1288 * specifications. The computed result will be within 1 ulp of the 1289 * exact result. 1290 * 1291 * @return the arc sine of this vector 1292 */ 1293 public $abstractvectortype$ asin() { 1294 return uOp((i, a) -> ($type$) Math.asin((double) a)); 1295 } 1296 1297 /** 1298 * Calculates the arc sine of this vector, selecting lane elements 1299 * controlled by a mask. 1300 * <p> 1301 * Semantics for rounding, monotonicity, and special cases are 1302 * described in {@link $abstractvectortype$#asin} 1303 * 1304 * @param m the mask controlling lane selection 1305 * @return the arc sine of this vector 1306 */ 1307 public $abstractvectortype$ asin(Mask<$Boxtype$> m) { 1308 return uOp(m, (i, a) -> ($type$) Math.asin((double) a)); 1309 } 1310 1311 /** 1312 * Calculates the arc cosine of this vector. 1313 * <p> 1314 * This is a vector unary operation with same semantic definition as 1315 * {@link Math#acos} operation applied to lane elements. 1316 * The implementation is not required to return same 1317 * results as {@link Math#acos}, but adheres to rounding, monotonicity, 1318 * and special case semantics as defined in the {@link Math#acos} 1319 * specifications. The computed result will be within 1 ulp of the 1320 * exact result. 1321 * 1322 * @return the arc cosine of this vector 1323 */ 1324 public $abstractvectortype$ acos() { 1325 return uOp((i, a) -> ($type$) Math.acos((double) a)); 1326 } 1327 1328 /** 1329 * Calculates the arc cosine of this vector, selecting lane elements 1330 * controlled by a mask. 1331 * <p> 1332 * Semantics for rounding, monotonicity, and special cases are 1333 * described in {@link $abstractvectortype$#acos} 1334 * 1335 * @param m the mask controlling lane selection 1336 * @return the arc cosine of this vector 1337 */ 1338 public $abstractvectortype$ acos(Mask<$Boxtype$> m) { 1339 return uOp(m, (i, a) -> ($type$) Math.acos((double) a)); 1340 } 1341 1342 /** 1343 * Calculates the arc tangent of this vector. 1344 * <p> 1345 * This is a vector unary operation with same semantic definition as 1346 * {@link Math#atan} operation applied to lane elements. 1347 * The implementation is not required to return same 1348 * results as {@link Math#atan}, but adheres to rounding, monotonicity, 1349 * and special case semantics as defined in the {@link Math#atan} 1350 * specifications. The computed result will be within 1 ulp of the 1351 * exact result. 1352 * 1353 * @return the arc tangent of this vector 1354 */ 1355 public $abstractvectortype$ atan() { 1356 return uOp((i, a) -> ($type$) Math.atan((double) a)); 1357 } 1358 1359 /** 1360 * Calculates the arc tangent of this vector, selecting lane elements 1361 * controlled by a mask. 1362 * <p> 1363 * Semantics for rounding, monotonicity, and special cases are 1364 * described in {@link $abstractvectortype$#atan} 1365 * 1366 * @param m the mask controlling lane selection 1367 * @return the arc tangent of this vector 1368 */ 1369 public $abstractvectortype$ atan(Mask<$Boxtype$> m) { 1370 return uOp(m, (i, a) -> ($type$) Math.atan((double) a)); 1371 } 1372 1373 /** 1374 * Calculates the arc tangent of this vector divided by an input vector. 1375 * <p> 1376 * This is a vector binary operation with same semantic definition as 1377 * {@link Math#atan2} operation applied to lane elements. 1378 * The implementation is not required to return same 1379 * results as {@link Math#atan2}, but adheres to rounding, monotonicity, 1380 * and special case semantics as defined in the {@link Math#atan2} 1381 * specifications. The computed result will be within 2 ulps of the 1382 * exact result. 1383 * 1384 * @param v the input vector 1385 * @return the arc tangent of this vector divided by the input vector 1386 */ 1387 public $abstractvectortype$ atan2(Vector<$Boxtype$> v) { 1388 return bOp(v, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b)); 1389 } 1390 1391 /** 1392 * Calculates the arc tangent of this vector divided by the broadcast of an 1393 * an input scalar. 1394 * <p> 1395 * This is a vector binary operation with same semantic definition as 1396 * {@link Math#atan2} operation applied to lane elements. 1397 * The implementation is not required to return same 1398 * results as {@link Math#atan2}, but adheres to rounding, monotonicity, 1399 * and special case semantics as defined in the {@link Math#atan2} 1400 * specifications. The computed result will be within 1 ulp of the 1401 * exact result. 1402 * 1403 * @param s the input scalar 1404 * @return the arc tangent of this vector over the input vector 1405 */ 1406 public abstract $abstractvectortype$ atan2($type$ s); 1407 1408 /** 1409 * Calculates the arc tangent of this vector divided by an input vector, 1410 * selecting lane elements controlled by a mask. 1411 * <p> 1412 * Semantics for rounding, monotonicity, and special cases are 1413 * described in {@link $abstractvectortype$#atan2} 1414 * 1415 * @param v the input vector 1416 * @param m the mask controlling lane selection 1417 * @return the arc tangent of this vector divided by the input vector 1418 */ 1419 public $abstractvectortype$ atan2(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 1420 return bOp(v, m, (i, a, b) -> ($type$) Math.atan2((double) a, (double) b)); 1421 } 1422 1423 /** 1424 * Calculates the arc tangent of this vector divided by the broadcast of an 1425 * an input scalar, selecting lane elements controlled by a mask. 1426 * <p> 1427 * Semantics for rounding, monotonicity, and special cases are 1428 * described in {@link $abstractvectortype$#atan2} 1429 * 1430 * @param s the input scalar 1431 * @param m the mask controlling lane selection 1432 * @return the arc tangent of this vector over the input vector 1433 */ 1434 public abstract $abstractvectortype$ atan2($type$ s, Mask<$Boxtype$> m); 1435 1436 /** 1437 * Calculates the cube root of this vector. 1438 * <p> 1439 * This is a vector unary operation with same semantic definition as 1440 * {@link Math#cbrt} operation applied to lane elements. 1441 * The implementation is not required to return same 1442 * results as {@link Math#cbrt}, but adheres to rounding, monotonicity, 1443 * and special case semantics as defined in the {@link Math#cbrt} 1444 * specifications. The computed result will be within 1 ulp of the 1445 * exact result. 1446 * 1447 * @return the cube root of this vector 1448 */ 1449 public $abstractvectortype$ cbrt() { 1450 return uOp((i, a) -> ($type$) Math.cbrt((double) a)); 1451 } 1452 1453 /** 1454 * Calculates the cube root of this vector, selecting lane elements 1455 * controlled by a mask. 1456 * <p> 1457 * Semantics for rounding, monotonicity, and special cases are 1458 * described in {@link $abstractvectortype$#cbrt} 1459 * 1460 * @param m the mask controlling lane selection 1461 * @return the cube root of this vector 1462 */ 1463 public $abstractvectortype$ cbrt(Mask<$Boxtype$> m) { 1464 return uOp(m, (i, a) -> ($type$) Math.cbrt((double) a)); 1465 } 1466 1467 /** 1468 * Calculates the natural logarithm of this vector. 1469 * <p> 1470 * This is a vector unary operation with same semantic definition as 1471 * {@link Math#log} operation applied to lane elements. 1472 * The implementation is not required to return same 1473 * results as {@link Math#log}, but adheres to rounding, monotonicity, 1474 * and special case semantics as defined in the {@link Math#log} 1475 * specifications. The computed result will be within 1 ulp of the 1476 * exact result. 1477 * 1478 * @return the natural logarithm of this vector 1479 */ 1480 public $abstractvectortype$ log() { 1481 return uOp((i, a) -> ($type$) Math.log((double) a)); 1482 } 1483 1484 /** 1485 * Calculates the natural logarithm of this vector, selecting lane elements 1486 * controlled by a mask. 1487 * <p> 1488 * Semantics for rounding, monotonicity, and special cases are 1489 * described in {@link $abstractvectortype$#log} 1490 * 1491 * @param m the mask controlling lane selection 1492 * @return the natural logarithm of this vector 1493 */ 1494 public $abstractvectortype$ log(Mask<$Boxtype$> m) { 1495 return uOp(m, (i, a) -> ($type$) Math.log((double) a)); 1496 } 1497 1498 /** 1499 * Calculates the base 10 logarithm of this vector. 1500 * <p> 1501 * This is a vector unary operation with same semantic definition as 1502 * {@link Math#log10} operation applied to lane elements. 1503 * The implementation is not required to return same 1504 * results as {@link Math#log10}, but adheres to rounding, monotonicity, 1505 * and special case semantics as defined in the {@link Math#log10} 1506 * specifications. The computed result will be within 1 ulp of the 1507 * exact result. 1508 * 1509 * @return the base 10 logarithm of this vector 1510 */ 1511 public $abstractvectortype$ log10() { 1512 return uOp((i, a) -> ($type$) Math.log10((double) a)); 1513 } 1514 1515 /** 1516 * Calculates the base 10 logarithm of this vector, selecting lane elements 1517 * controlled by a mask. 1518 * <p> 1519 * Semantics for rounding, monotonicity, and special cases are 1520 * described in {@link $abstractvectortype$#log10} 1521 * 1522 * @param m the mask controlling lane selection 1523 * @return the base 10 logarithm of this vector 1524 */ 1525 public $abstractvectortype$ log10(Mask<$Boxtype$> m) { 1526 return uOp(m, (i, a) -> ($type$) Math.log10((double) a)); 1527 } 1528 1529 /** 1530 * Calculates the natural logarithm of the sum of this vector and the 1531 * broadcast of {@code 1}. 1532 * <p> 1533 * This is a vector unary operation with same semantic definition as 1534 * {@link Math#log1p} operation applied to lane elements. 1535 * The implementation is not required to return same 1536 * results as {@link Math#log1p}, but adheres to rounding, monotonicity, 1537 * and special case semantics as defined in the {@link Math#log1p} 1538 * specifications. The computed result will be within 1 ulp of the 1539 * exact result. 1540 * 1541 * @return the natural logarithm of the sum of this vector and the broadcast 1542 * of {@code 1} 1543 */ 1544 public $abstractvectortype$ log1p() { 1545 return uOp((i, a) -> ($type$) Math.log1p((double) a)); 1546 } 1547 1548 /** 1549 * Calculates the natural logarithm of the sum of this vector and the 1550 * broadcast of {@code 1}, selecting lane elements controlled by a mask. 1551 * <p> 1552 * Semantics for rounding, monotonicity, and special cases are 1553 * described in {@link $abstractvectortype$#log1p} 1554 * 1555 * @param m the mask controlling lane selection 1556 * @return the natural logarithm of the sum of this vector and the broadcast 1557 * of {@code 1} 1558 */ 1559 public $abstractvectortype$ log1p(Mask<$Boxtype$> m) { 1560 return uOp(m, (i, a) -> ($type$) Math.log1p((double) a)); 1561 } 1562 1563 /** 1564 * Calculates this vector raised to the power of an input vector. 1565 * <p> 1566 * This is a vector binary operation with same semantic definition as 1567 * {@link Math#pow} operation applied to lane elements. 1568 * The implementation is not required to return same 1569 * results as {@link Math#pow}, but adheres to rounding, monotonicity, 1570 * and special case semantics as defined in the {@link Math#pow} 1571 * specifications. The computed result will be within 1 ulp of the 1572 * exact result. 1573 * 1574 * @param v the input vector 1575 * @return this vector raised to the power of an input vector 1576 */ 1577 public $abstractvectortype$ pow(Vector<$Boxtype$> v) { 1578 return bOp(v, (i, a, b) -> ($type$) Math.pow((double) a, (double) b)); 1579 } 1580 1581 /** 1582 * Calculates this vector raised to the power of the broadcast of an input 1583 * scalar. 1584 * <p> 1585 * This is a vector binary operation with same semantic definition as 1586 * {@link Math#pow} operation applied to lane elements. 1587 * The implementation is not required to return same 1588 * results as {@link Math#pow}, but adheres to rounding, monotonicity, 1589 * and special case semantics as defined in the {@link Math#pow} 1590 * specifications. The computed result will be within 1 ulp of the 1591 * exact result. 1592 * 1593 * @param s the input scalar 1594 * @return this vector raised to the power of the broadcast of an input 1595 * scalar. 1596 */ 1597 public abstract $abstractvectortype$ pow($type$ s); 1598 1599 /** 1600 * Calculates this vector raised to the power of an input vector, selecting 1601 * lane elements controlled by a mask. 1602 * <p> 1603 * Semantics for rounding, monotonicity, and special cases are 1604 * described in {@link $abstractvectortype$#pow} 1605 * 1606 * @param v the input vector 1607 * @param m the mask controlling lane selection 1608 * @return this vector raised to the power of an input vector 1609 */ 1610 public $abstractvectortype$ pow(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 1611 return bOp(v, m, (i, a, b) -> ($type$) Math.pow((double) a, (double) b)); 1612 } 1613 1614 /** 1615 * Calculates this vector raised to the power of the broadcast of an input 1616 * scalar, selecting lane elements controlled by a mask. 1617 * <p> 1618 * Semantics for rounding, monotonicity, and special cases are 1619 * described in {@link $abstractvectortype$#pow} 1620 * 1621 * @param s the input scalar 1622 * @param m the mask controlling lane selection 1623 * @return this vector raised to the power of the broadcast of an input 1624 * scalar. 1625 */ 1626 public abstract $abstractvectortype$ pow($type$ s, Mask<$Boxtype$> m); 1627 1628 /** 1629 * Calculates the broadcast of Euler's number {@code e} raised to the power 1630 * of this vector. 1631 * <p> 1632 * This is a vector unary operation with same semantic definition as 1633 * {@link Math#exp} operation applied to lane elements. 1634 * The implementation is not required to return same 1635 * results as {@link Math#exp}, but adheres to rounding, monotonicity, 1636 * and special case semantics as defined in the {@link Math#exp} 1637 * specifications. The computed result will be within 1 ulp of the 1638 * exact result. 1639 * 1640 * @return the broadcast of Euler's number {@code e} raised to the power of 1641 * this vector 1642 */ 1643 public $abstractvectortype$ exp() { 1644 return uOp((i, a) -> ($type$) Math.exp((double) a)); 1645 } 1646 1647 /** 1648 * Calculates the broadcast of Euler's number {@code e} raised to the power 1649 * of this vector, selecting lane elements controlled by a mask. 1650 * <p> 1651 * Semantics for rounding, monotonicity, and special cases are 1652 * described in {@link $abstractvectortype$#exp} 1653 * 1654 * @param m the mask controlling lane selection 1655 * @return the broadcast of Euler's number {@code e} raised to the power of 1656 * this vector 1657 */ 1658 public $abstractvectortype$ exp(Mask<$Boxtype$> m) { 1659 return uOp(m, (i, a) -> ($type$) Math.exp((double) a)); 1660 } 1661 1662 /** 1663 * Calculates the broadcast of Euler's number {@code e} raised to the power 1664 * of this vector minus the broadcast of {@code -1}. 1665 * More specifically as if the following (ignoring any differences in 1666 * numerical accuracy): 1667 * <pre>{@code 1668 * this.exp().sub(this.species().broadcast(1)) 1669 * }</pre> 1670 * <p> 1671 * This is a vector unary operation with same semantic definition as 1672 * {@link Math#expm1} operation applied to lane elements. 1673 * The implementation is not required to return same 1674 * results as {@link Math#expm1}, but adheres to rounding, monotonicity, 1675 * and special case semantics as defined in the {@link Math#expm1} 1676 * specifications. The computed result will be within 1 ulp of the 1677 * exact result. 1678 * 1679 * @return the broadcast of Euler's number {@code e} raised to the power of 1680 * this vector minus the broadcast of {@code -1} 1681 */ 1682 public $abstractvectortype$ expm1() { 1683 return uOp((i, a) -> ($type$) Math.expm1((double) a)); 1684 } 1685 1686 /** 1687 * Calculates the broadcast of Euler's number {@code e} raised to the power 1688 * of this vector minus the broadcast of {@code -1}, selecting lane elements 1689 * controlled by a mask 1690 * More specifically as if the following (ignoring any differences in 1691 * numerical accuracy): 1692 * <pre>{@code 1693 * this.exp(m).sub(this.species().broadcast(1), m) 1694 * }</pre> 1695 * <p> 1696 * Semantics for rounding, monotonicity, and special cases are 1697 * described in {@link $abstractvectortype$#expm1} 1698 * 1699 * @param m the mask controlling lane selection 1700 * @return the broadcast of Euler's number {@code e} raised to the power of 1701 * this vector minus the broadcast of {@code -1} 1702 */ 1703 public $abstractvectortype$ expm1(Mask<$Boxtype$> m) { 1704 return uOp(m, (i, a) -> ($type$) Math.expm1((double) a)); 1705 } 1706 1707 /** 1708 * Calculates the product of this vector and a first input vector summed 1709 * with a second input vector. 1710 * More specifically as if the following (ignoring any differences in 1711 * numerical accuracy): 1712 * <pre>{@code 1713 * this.mul(v1).add(v2) 1714 * }</pre> 1715 * <p> 1716 * This is a vector ternary operation where the {@link Math#fma} operation 1717 * is applied to lane elements. 1718 * 1719 * @param v1 the first input vector 1720 * @param v2 the second input vector 1721 * @return the product of this vector and the first input vector summed with 1722 * the second input vector 1723 */ 1724 public abstract $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2); 1725 1726 /** 1727 * Calculates the product of this vector and the broadcast of a first input 1728 * scalar summed with the broadcast of a second input scalar. 1729 * More specifically as if the following: 1730 * <pre>{@code 1731 * this.fma(this.species().broadcast(s1), this.species().broadcast(s2)) 1732 * }</pre> 1733 * <p> 1734 * This is a vector ternary operation where the {@link Math#fma} operation 1735 * is applied to lane elements. 1736 * 1737 * @param s1 the first input scalar 1738 * @param s2 the second input scalar 1739 * @return the product of this vector and the broadcast of a first input 1740 * scalar summed with the broadcast of a second input scalar 1741 */ 1742 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2); 1743 1744 /** 1745 * Calculates the product of this vector and a first input vector summed 1746 * with a second input vector, selecting lane elements controlled by a mask. 1747 * More specifically as if the following (ignoring any differences in 1748 * numerical accuracy): 1749 * <pre>{@code 1750 * this.mul(v1, m).add(v2, m) 1751 * }</pre> 1752 * <p> 1753 * This is a vector ternary operation where the {@link Math#fma} operation 1754 * is applied to lane elements. 1755 * 1756 * @param v1 the first input vector 1757 * @param v2 the second input vector 1758 * @param m the mask controlling lane selection 1759 * @return the product of this vector and the first input vector summed with 1760 * the second input vector 1761 */ 1762 public $abstractvectortype$ fma(Vector<$Boxtype$> v1, Vector<$Boxtype$> v2, Mask<$Boxtype$> m) { 1763 return tOp(v1, v2, m, (i, a, b, c) -> Math.fma(a, b, c)); 1764 } 1765 1766 /** 1767 * Calculates the product of this vector and the broadcast of a first input 1768 * scalar summed with the broadcast of a second input scalar, selecting lane 1769 * elements controlled by a mask 1770 * More specifically as if the following: 1771 * <pre>{@code 1772 * this.fma(this.species().broadcast(s1), this.species().broadcast(s2), m) 1773 * }</pre> 1774 * <p> 1775 * This is a vector ternary operation where the {@link Math#fma} operation 1776 * is applied to lane elements. 1777 * 1778 * @param s1 the first input scalar 1779 * @param s2 the second input scalar 1780 * @param m the mask controlling lane selection 1781 * @return the product of this vector and the broadcast of a first input 1782 * scalar summed with the broadcast of a second input scalar 1783 */ 1784 public abstract $abstractvectortype$ fma($type$ s1, $type$ s2, Mask<$Boxtype$> m); 1785 1786 /** 1787 * Calculates square root of the sum of the squares of this vector and an 1788 * input vector. 1789 * More specifically as if the following (ignoring any differences in 1790 * numerical accuracy): 1791 * <pre>{@code 1792 * this.mul(this).add(v.mul(v)).sqrt() 1793 * }</pre> 1794 * <p> 1795 * This is a vector binary operation with same semantic definition as 1796 * {@link Math#hypot} operation applied to lane elements. 1797 * The implementation is not required to return same 1798 * results as {@link Math#hypot}, but adheres to rounding, monotonicity, 1799 * and special case semantics as defined in the {@link Math#hypot} 1800 * specifications. The computed result will be within 1 ulp of the 1801 * exact result. 1802 * 1803 * @param v the input vector 1804 * @return square root of the sum of the squares of this vector and an input 1805 * vector 1806 */ 1807 public $abstractvectortype$ hypot(Vector<$Boxtype$> v) { 1808 return bOp(v, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b)); 1809 } 1810 1811 /** 1812 * Calculates square root of the sum of the squares of this vector and the 1813 * broadcast of an input scalar. 1814 * More specifically as if the following (ignoring any differences in 1815 * numerical accuracy): 1816 * <pre>{@code 1817 * this.mul(this).add(this.species().broadcast(v * v)).sqrt() 1818 * }</pre> 1819 * <p> 1820 * This is a vector binary operation with same semantic definition as 1821 * {@link Math#hypot} operation applied to lane elements. 1822 * The implementation is not required to return same 1823 * results as {@link Math#hypot}, but adheres to rounding, monotonicity, 1824 * and special case semantics as defined in the {@link Math#hypot} 1825 * specifications. The computed result will be within 1 ulp of the 1826 * exact result. 1827 * 1828 * @param s the input scalar 1829 * @return square root of the sum of the squares of this vector and the 1830 * broadcast of an input scalar 1831 */ 1832 public abstract $abstractvectortype$ hypot($type$ s); 1833 1834 /** 1835 * Calculates square root of the sum of the squares of this vector and an 1836 * input vector, selecting lane elements controlled by a mask. 1837 * More specifically as if the following (ignoring any differences in 1838 * numerical accuracy): 1839 * <pre>{@code 1840 * this.mul(this, m).add(v.mul(v), m).sqrt(m) 1841 * }</pre> 1842 * <p> 1843 * Semantics for rounding, monotonicity, and special cases are 1844 * described in {@link $abstractvectortype$#hypot} 1845 * 1846 * @param v the input vector 1847 * @param m the mask controlling lane selection 1848 * @return square root of the sum of the squares of this vector and an input 1849 * vector 1850 */ 1851 public $abstractvectortype$ hypot(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 1852 return bOp(v, m, (i, a, b) -> ($type$) Math.hypot((double) a, (double) b)); 1853 } 1854 1855 /** 1856 * Calculates square root of the sum of the squares of this vector and the 1857 * broadcast of an input scalar, selecting lane elements controlled by a 1858 * mask. 1859 * More specifically as if the following (ignoring any differences in 1860 * numerical accuracy): 1861 * <pre>{@code 1862 * this.mul(this, m).add(this.species().broadcast(v * v), m).sqrt(m) 1863 * }</pre> 1864 * <p> 1865 * Semantics for rounding, monotonicity, and special cases are 1866 * described in {@link $abstractvectortype$#hypot} 1867 * 1868 * @param s the input scalar 1869 * @param m the mask controlling lane selection 1870 * @return square root of the sum of the squares of this vector and the 1871 * broadcast of an input scalar 1872 */ 1873 public abstract $abstractvectortype$ hypot($type$ s, Mask<$Boxtype$> m); 1874 #end[FP] 1875 1876 #if[BITWISE] 1877 1878 /** 1879 * Bitwise ANDs this vector with an input vector. 1880 * <p> 1881 * This is a vector binary operation where the primitive bitwise AND 1882 * operation ({@code &}) is applied to lane elements. 1883 * 1884 * @param v the input vector 1885 * @return the bitwise AND of this vector with the input vector 1886 */ 1887 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v); 1888 1889 /** 1890 * Bitwise ANDs this vector with the broadcast of an input scalar. 1891 * <p> 1892 * This is a vector binary operation where the primitive bitwise AND 1893 * operation ({@code &}) is applied to lane elements. 1894 * 1895 * @param s the input scalar 1896 * @return the bitwise AND of this vector with the broadcast of an input 1897 * scalar 1898 */ 1899 public abstract $abstractvectortype$ and($type$ s); 1900 1901 /** 1902 * Bitwise ANDs this vector with an input vector, selecting lane elements 1903 * controlled by a mask. 1904 * <p> 1905 * This is a vector binary operation where the primitive bitwise AND 1906 * operation ({@code &}) is applied to lane elements. 1907 * 1908 * @param v the input vector 1909 * @param m the mask controlling lane selection 1910 * @return the bitwise AND of this vector with the input vector 1911 */ 1912 public abstract $abstractvectortype$ and(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 1913 1914 /** 1915 * Bitwise ANDs this vector with the broadcast of an input scalar, selecting 1916 * lane elements controlled by a mask. 1917 * <p> 1918 * This is a vector binary operation where the primitive bitwise AND 1919 * operation ({@code &}) is applied to lane elements. 1920 * 1921 * @param s the input scalar 1922 * @param m the mask controlling lane selection 1923 * @return the bitwise AND of this vector with the broadcast of an input 1924 * scalar 1925 */ 1926 public abstract $abstractvectortype$ and($type$ s, Mask<$Boxtype$> m); 1927 1928 /** 1929 * Bitwise ORs this vector with an input vector. 1930 * <p> 1931 * This is a vector binary operation where the primitive bitwise OR 1932 * operation ({@code |}) is applied to lane elements. 1933 * 1934 * @param v the input vector 1935 * @return the bitwise OR of this vector with the input vector 1936 */ 1937 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v); 1938 1939 /** 1940 * Bitwise ORs this vector with the broadcast of an input scalar. 1941 * <p> 1942 * This is a vector binary operation where the primitive bitwise OR 1943 * operation ({@code |}) is applied to lane elements. 1944 * 1945 * @param s the input scalar 1946 * @return the bitwise OR of this vector with the broadcast of an input 1947 * scalar 1948 */ 1949 public abstract $abstractvectortype$ or($type$ s); 1950 1951 /** 1952 * Bitwise ORs this vector with an input vector, selecting lane elements 1953 * controlled by a mask. 1954 * <p> 1955 * This is a vector binary operation where the primitive bitwise OR 1956 * operation ({@code |}) is applied to lane elements. 1957 * 1958 * @param v the input vector 1959 * @param m the mask controlling lane selection 1960 * @return the bitwise OR of this vector with the input vector 1961 */ 1962 public abstract $abstractvectortype$ or(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 1963 1964 /** 1965 * Bitwise ORs this vector with the broadcast of an input scalar, selecting 1966 * lane elements controlled by a mask. 1967 * <p> 1968 * This is a vector binary operation where the primitive bitwise OR 1969 * operation ({@code |}) is applied to lane elements. 1970 * 1971 * @param s the input scalar 1972 * @param m the mask controlling lane selection 1973 * @return the bitwise OR of this vector with the broadcast of an input 1974 * scalar 1975 */ 1976 public abstract $abstractvectortype$ or($type$ s, Mask<$Boxtype$> m); 1977 1978 /** 1979 * Bitwise XORs this vector with an input vector. 1980 * <p> 1981 * This is a vector binary operation where the primitive bitwise XOR 1982 * operation ({@code ^}) is applied to lane elements. 1983 * 1984 * @param v the input vector 1985 * @return the bitwise XOR of this vector with the input vector 1986 */ 1987 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v); 1988 1989 /** 1990 * Bitwise XORs this vector with the broadcast of an input scalar. 1991 * <p> 1992 * This is a vector binary operation where the primitive bitwise XOR 1993 * operation ({@code ^}) is applied to lane elements. 1994 * 1995 * @param s the input scalar 1996 * @return the bitwise XOR of this vector with the broadcast of an input 1997 * scalar 1998 */ 1999 public abstract $abstractvectortype$ xor($type$ s); 2000 2001 /** 2002 * Bitwise XORs this vector with an input vector, selecting lane elements 2003 * controlled by a mask. 2004 * <p> 2005 * This is a vector binary operation where the primitive bitwise XOR 2006 * operation ({@code ^}) is applied to lane elements. 2007 * 2008 * @param v the input vector 2009 * @param m the mask controlling lane selection 2010 * @return the bitwise XOR of this vector with the input vector 2011 */ 2012 public abstract $abstractvectortype$ xor(Vector<$Boxtype$> v, Mask<$Boxtype$> m); 2013 2014 /** 2015 * Bitwise XORs this vector with the broadcast of an input scalar, selecting 2016 * lane elements controlled by a mask. 2017 * <p> 2018 * This is a vector binary operation where the primitive bitwise XOR 2019 * operation ({@code ^}) is applied to lane elements. 2020 * 2021 * @param s the input scalar 2022 * @param m the mask controlling lane selection 2023 * @return the bitwise XOR of this vector with the broadcast of an input 2024 * scalar 2025 */ 2026 public abstract $abstractvectortype$ xor($type$ s, Mask<$Boxtype$> m); 2027 2028 /** 2029 * Bitwise NOTs this vector. 2030 * <p> 2031 * This is a vector unary operation where the primitive bitwise NOT 2032 * operation ({@code ~}) is applied to lane elements. 2033 * 2034 * @return the bitwise NOT of this vector 2035 */ 2036 public abstract $abstractvectortype$ not(); 2037 2038 /** 2039 * Bitwise NOTs this vector, selecting lane elements controlled by a mask. 2040 * <p> 2041 * This is a vector unary operation where the primitive bitwise NOT 2042 * operation ({@code ~}) is applied to lane elements. 2043 * 2044 * @param m the mask controlling lane selection 2045 * @return the bitwise NOT of this vector 2046 */ 2047 public abstract $abstractvectortype$ not(Mask<$Boxtype$> m); 2048 2049 #if[byte] 2050 /** 2051 * Logically left shifts this vector by the broadcast of an input scalar. 2052 * <p> 2053 * This is a vector binary operation where the primitive logical left shift 2054 * operation ({@code <<}) is applied to lane elements to left shift the 2055 * element by shift value as specified by the input scalar. Only the 3 2056 * lowest-order bits of shift value are used. It is as if the shift value 2057 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2058 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2059 * 2060 * @param s the input scalar; the number of the bits to left shift 2061 * @return the result of logically left shifting left this vector by the 2062 * broadcast of an input scalar 2063 */ 2064 #end[byte] 2065 #if[short] 2066 /** 2067 * Logically left shifts this vector by the broadcast of an input scalar. 2068 * <p> 2069 * This is a vector binary operation where the primitive logical left shift 2070 * operation ({@code <<}) is applied to lane elements to left shift the 2071 * element by shift value as specified by the input scalar. Only the 4 2072 * lowest-order bits of shift value are used. It is as if the shift value 2073 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2074 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2075 * 2076 * @param s the input scalar; the number of the bits to left shift 2077 * @return the result of logically left shifting left this vector by the 2078 * broadcast of an input scalar 2079 */ 2080 #end[short] 2081 #if[intOrLong] 2082 /** 2083 * Logically left shifts this vector by the broadcast of an input scalar. 2084 * <p> 2085 * This is a vector binary operation where the primitive logical left shift 2086 * operation ({@code <<}) is applied to lane elements. 2087 * 2088 * @param s the input scalar; the number of the bits to left shift 2089 * @return the result of logically left shifting left this vector by the 2090 * broadcast of an input scalar 2091 */ 2092 #end[intOrLong] 2093 public abstract $abstractvectortype$ shiftL(int s); 2094 2095 #if[byte] 2096 /** 2097 * Logically left shifts this vector by the broadcast of an input scalar, 2098 * selecting lane elements controlled by a mask. 2099 * <p> 2100 * This is a vector binary operation where the primitive logical left shift 2101 * operation ({@code <<}) is applied to lane elements to left shift the 2102 * element by shift value as specified by the input scalar. Only the 3 2103 * lowest-order bits of shift value are used. It is as if the shift value 2104 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2105 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2106 * 2107 * @param s the input scalar; the number of the bits to left shift 2108 * @param m the mask controlling lane selection 2109 * @return the result of logically left shifting left this vector by the 2110 * broadcast of an input scalar 2111 */ 2112 #end[byte] 2113 #if[short] 2114 /** 2115 * Logically left shifts this vector by the broadcast of an input scalar, 2116 * selecting lane elements controlled by a mask. 2117 * <p> 2118 * This is a vector binary operation where the primitive logical left shift 2119 * operation ({@code <<}) is applied to lane elements to left shift the 2120 * element by shift value as specified by the input scalar. Only the 4 2121 * lowest-order bits of shift value are used. It is as if the shift value 2122 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2123 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2124 * 2125 * @param s the input scalar; the number of the bits to left shift 2126 * @param m the mask controlling lane selection 2127 * @return the result of logically left shifting left this vector by the 2128 * broadcast of an input scalar 2129 */ 2130 #end[short] 2131 #if[intOrLong] 2132 /** 2133 * Logically left shifts this vector by the broadcast of an input scalar, 2134 * selecting lane elements controlled by a mask. 2135 * <p> 2136 * This is a vector binary operation where the primitive logical left shift 2137 * operation ({@code <<}) is applied to lane elements. 2138 * 2139 * @param s the input scalar; the number of the bits to left shift 2140 * @param m the mask controlling lane selection 2141 * @return the result of logically left shifting this vector by the 2142 * broadcast of an input scalar 2143 */ 2144 #end[intOrLong] 2145 public abstract $abstractvectortype$ shiftL(int s, Mask<$Boxtype$> m); 2146 2147 #if[intOrLong] 2148 /** 2149 * Logically left shifts this vector by an input vector. 2150 * <p> 2151 * This is a vector binary operation where the primitive logical left shift 2152 * operation ({@code <<}) is applied to lane elements. 2153 * 2154 * @param v the input vector 2155 * @return the result of logically left shifting this vector by the input 2156 * vector 2157 */ 2158 public abstract $abstractvectortype$ shiftL(Vector<$Boxtype$> v); 2159 2160 /** 2161 * Logically left shifts this vector by an input vector, selecting lane 2162 * elements controlled by a mask. 2163 * <p> 2164 * This is a vector binary operation where the primitive logical left shift 2165 * operation ({@code <<}) is applied to lane elements. 2166 * 2167 * @param v the input vector 2168 * @param m the mask controlling lane selection 2169 * @return the result of logically left shifting this vector by the input 2170 * vector 2171 */ 2172 public $abstractvectortype$ shiftL(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 2173 return bOp(v, m, (i, a, b) -> ($type$) (a << b)); 2174 } 2175 #end[intOrLong] 2176 2177 // logical, or unsigned, shift right 2178 2179 #if[byte] 2180 /** 2181 * Logically right shifts (or unsigned right shifts) this vector by the 2182 * broadcast of an input scalar. 2183 * <p> 2184 * This is a vector binary operation where the primitive logical right shift 2185 * operation ({@code >>>}) is applied to lane elements to logically right shift the 2186 * element by shift value as specified by the input scalar. Only the 3 2187 * lowest-order bits of shift value are used. It is as if the shift value 2188 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2189 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2190 * 2191 * @param s the input scalar; the number of the bits to right shift 2192 * @return the result of logically right shifting this vector by the 2193 * broadcast of an input scalar 2194 */ 2195 #end[byte] 2196 #if[short] 2197 /** 2198 * Logically right shifts (or unsigned right shifts) this vector by the 2199 * broadcast of an input scalar. 2200 * <p> 2201 * This is a vector binary operation where the primitive logical right shift 2202 * operation ({@code >>>}) is applied to lane elements to logically right shift the 2203 * element by shift value as specified by the input scalar. Only the 4 2204 * lowest-order bits of shift value are used. It is as if the shift value 2205 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2206 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2207 * 2208 * @param s the input scalar; the number of the bits to right shift 2209 * @return the result of logically right shifting this vector by the 2210 * broadcast of an input scalar 2211 */ 2212 #end[short] 2213 #if[intOrLong] 2214 /** 2215 * Logically right shifts (or unsigned right shifts) this vector by the 2216 * broadcast of an input scalar. 2217 * <p> 2218 * This is a vector binary operation where the primitive logical right shift 2219 * operation ({@code >>>}) is applied to lane elements. 2220 * 2221 * @param s the input scalar; the number of the bits to right shift 2222 * @return the result of logically right shifting this vector by the 2223 * broadcast of an input scalar 2224 */ 2225 #end[intOrLong] 2226 public abstract $abstractvectortype$ shiftR(int s); 2227 2228 #if[byte] 2229 /** 2230 * Logically right shifts (or unsigned right shifts) this vector by the 2231 * broadcast of an input scalar, selecting lane elements controlled by a 2232 * mask. 2233 * <p> 2234 * This is a vector binary operation where the primitive logical right shift 2235 * operation ({@code >>>}) is applied to lane elements to logically right shift the 2236 * element by shift value as specified by the input scalar. Only the 3 2237 * lowest-order bits of shift value are used. It is as if the shift value 2238 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2239 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2240 * 2241 * @param s the input scalar; the number of the bits to right shift 2242 * @param m the mask controlling lane selection 2243 * @return the result of logically right shifting this vector by the 2244 * broadcast of an input scalar 2245 */ 2246 #end[byte] 2247 #if[short] 2248 /** 2249 * Logically right shifts (or unsigned right shifts) this vector by the 2250 * broadcast of an input scalar, selecting lane elements controlled by a 2251 * mask. 2252 * <p> 2253 * This is a vector binary operation where the primitive logical right shift 2254 * operation ({@code >>>}) is applied to lane elements to logically right shift the 2255 * element by shift value as specified by the input scalar. Only the 4 2256 * lowest-order bits of shift value are used. It is as if the shift value 2257 * were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2258 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2259 * 2260 * @param s the input scalar; the number of the bits to right shift 2261 * @param m the mask controlling lane selection 2262 * @return the result of logically right shifting this vector by the 2263 * broadcast of an input scalar 2264 */ 2265 #end[short] 2266 #if[intOrLong] 2267 /** 2268 * Logically right shifts (or unsigned right shifts) this vector by the 2269 * broadcast of an input scalar, selecting lane elements controlled by a 2270 * mask. 2271 * <p> 2272 * This is a vector binary operation where the primitive logical right shift 2273 * operation ({@code >>>}) is applied to lane elements. 2274 * 2275 * @param s the input scalar; the number of the bits to right shift 2276 * @param m the mask controlling lane selection 2277 * @return the result of logically right shifting this vector by the 2278 * broadcast of an input scalar 2279 */ 2280 #end[intOrLong] 2281 public abstract $abstractvectortype$ shiftR(int s, Mask<$Boxtype$> m); 2282 2283 #if[intOrLong] 2284 /** 2285 * Logically right shifts (or unsigned right shifts) this vector by an 2286 * input vector. 2287 * <p> 2288 * This is a vector binary operation where the primitive logical right shift 2289 * operation ({@code >>>}) is applied to lane elements. 2290 * 2291 * @param v the input vector 2292 * @return the result of logically right shifting this vector by the 2293 * input vector 2294 */ 2295 public abstract $abstractvectortype$ shiftR(Vector<$Boxtype$> v); 2296 2297 /** 2298 * Logically right shifts (or unsigned right shifts) this vector by an 2299 * input vector, selecting lane elements controlled by a mask. 2300 * <p> 2301 * This is a vector binary operation where the primitive logical right shift 2302 * operation ({@code >>>}) is applied to lane elements. 2303 * 2304 * @param v the input vector 2305 * @param m the mask controlling lane selection 2306 * @return the result of logically right shifting this vector by the 2307 * input vector 2308 */ 2309 public $abstractvectortype$ shiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 2310 return bOp(v, m, (i, a, b) -> ($type$) (a >>> b)); 2311 } 2312 #end[intOrLong] 2313 2314 #if[byte] 2315 /** 2316 * Arithmetically right shifts (or signed right shifts) this vector by the 2317 * broadcast of an input scalar. 2318 * <p> 2319 * This is a vector binary operation where the primitive arithmetic right 2320 * shift operation ({@code >>}) is applied to lane elements to arithmetically 2321 * right shift the element by shift value as specified by the input scalar. 2322 * Only the 3 lowest-order bits of shift value are used. It is as if the shift 2323 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2324 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2325 * 2326 * @param s the input scalar; the number of the bits to right shift 2327 * @return the result of arithmetically right shifting this vector by the 2328 * broadcast of an input scalar 2329 */ 2330 #end[byte] 2331 #if[short] 2332 /** 2333 * Arithmetically right shifts (or signed right shifts) this vector by the 2334 * broadcast of an input scalar. 2335 * <p> 2336 * This is a vector binary operation where the primitive arithmetic right 2337 * shift operation ({@code >>}) is applied to lane elements to arithmetically 2338 * right shift the element by shift value as specified by the input scalar. 2339 * Only the 4 lowest-order bits of shift value are used. It is as if the shift 2340 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2341 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2342 * 2343 * @param s the input scalar; the number of the bits to right shift 2344 * @return the result of arithmetically right shifting this vector by the 2345 * broadcast of an input scalar 2346 */ 2347 #end[short] 2348 #if[intOrLong] 2349 /** 2350 * Arithmetically right shifts (or signed right shifts) this vector by the 2351 * broadcast of an input scalar. 2352 * <p> 2353 * This is a vector binary operation where the primitive arithmetic right 2354 * shift operation ({@code >>}) is applied to lane elements. 2355 * 2356 * @param s the input scalar; the number of the bits to right shift 2357 * @return the result of arithmetically right shifting this vector by the 2358 * broadcast of an input scalar 2359 */ 2360 #end[intOrLong] 2361 public abstract $abstractvectortype$ aShiftR(int s); 2362 2363 #if[byte] 2364 /** 2365 * Arithmetically right shifts (or signed right shifts) this vector by the 2366 * broadcast of an input scalar, selecting lane elements controlled by a 2367 * mask. 2368 * <p> 2369 * This is a vector binary operation where the primitive arithmetic right 2370 * shift operation ({@code >>}) is applied to lane elements to arithmetically 2371 * right shift the element by shift value as specified by the input scalar. 2372 * Only the 3 lowest-order bits of shift value are used. It is as if the shift 2373 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0x7. 2374 * The shift distance actually used is therefore always in the range 0 to 7, inclusive. 2375 * 2376 * @param s the input scalar; the number of the bits to right shift 2377 * @param m the mask controlling lane selection 2378 * @return the result of arithmetically right shifting this vector by the 2379 * broadcast of an input scalar 2380 */ 2381 #end[byte] 2382 #if[short] 2383 /** 2384 * Arithmetically right shifts (or signed right shifts) this vector by the 2385 * broadcast of an input scalar, selecting lane elements controlled by a 2386 * mask. 2387 * <p> 2388 * This is a vector binary operation where the primitive arithmetic right 2389 * shift operation ({@code >>}) is applied to lane elements to arithmetically 2390 * right shift the element by shift value as specified by the input scalar. 2391 * Only the 4 lowest-order bits of shift value are used. It is as if the shift 2392 * value were subjected to a bitwise logical AND operator ({@code &}) with the mask value 0xF. 2393 * The shift distance actually used is therefore always in the range 0 to 15, inclusive. 2394 * 2395 * @param s the input scalar; the number of the bits to right shift 2396 * @param m the mask controlling lane selection 2397 * @return the result of arithmetically right shifting this vector by the 2398 * broadcast of an input scalar 2399 */ 2400 #end[short] 2401 #if[intOrLong] 2402 /** 2403 * Arithmetically right shifts (or signed right shifts) this vector by the 2404 * broadcast of an input scalar, selecting lane elements controlled by a 2405 * mask. 2406 * <p> 2407 * This is a vector binary operation where the primitive arithmetic right 2408 * shift operation ({@code >>}) is applied to lane elements. 2409 * 2410 * @param s the input scalar; the number of the bits to right shift 2411 * @param m the mask controlling lane selection 2412 * @return the result of arithmetically right shifting this vector by the 2413 * broadcast of an input scalar 2414 */ 2415 #end[intOrLong] 2416 public abstract $abstractvectortype$ aShiftR(int s, Mask<$Boxtype$> m); 2417 2418 #if[intOrLong] 2419 /** 2420 * Arithmetically right shifts (or signed right shifts) this vector by an 2421 * input vector. 2422 * <p> 2423 * This is a vector binary operation where the primitive arithmetic right 2424 * shift operation ({@code >>}) is applied to lane elements. 2425 * 2426 * @param v the input vector 2427 * @return the result of arithmetically right shifting this vector by the 2428 * input vector 2429 */ 2430 public abstract $abstractvectortype$ aShiftR(Vector<$Boxtype$> v); 2431 2432 /** 2433 * Arithmetically right shifts (or signed right shifts) this vector by an 2434 * input vector, selecting lane elements controlled by a mask. 2435 * <p> 2436 * This is a vector binary operation where the primitive arithmetic right 2437 * shift operation ({@code >>}) is applied to lane elements. 2438 * 2439 * @param v the input vector 2440 * @param m the mask controlling lane selection 2441 * @return the result of arithmetically right shifting this vector by the 2442 * input vector 2443 */ 2444 public $abstractvectortype$ aShiftR(Vector<$Boxtype$> v, Mask<$Boxtype$> m) { 2445 return bOp(v, m, (i, a, b) -> ($type$) (a >> b)); 2446 } 2447 2448 /** 2449 * Rotates left this vector by the broadcast of an input scalar. 2450 * <p> 2451 * This is a vector binary operation where the operation 2452 * {@link $Wideboxtype$#rotateLeft} is applied to lane elements and where 2453 * lane elements of this vector apply to the first argument, and lane 2454 * elements of the broadcast vector apply to the second argument (the 2455 * rotation distance). 2456 * 2457 * @param s the input scalar; the number of the bits to rotate left 2458 * @return the result of rotating left this vector by the broadcast of an 2459 * input scalar 2460 */ 2461 @ForceInline 2462 public final $abstractvectortype$ rotateL(int s) { 2463 return shiftL(s).or(shiftR(-s)); 2464 } 2465 2466 /** 2467 * Rotates left this vector by the broadcast of an input scalar, selecting 2468 * lane elements controlled by a mask. 2469 * <p> 2470 * This is a vector binary operation where the operation 2471 * {@link $Wideboxtype$#rotateLeft} is applied to lane elements and where 2472 * lane elements of this vector apply to the first argument, and lane 2473 * elements of the broadcast vector apply to the second argument (the 2474 * rotation distance). 2475 * 2476 * @param s the input scalar; the number of the bits to rotate left 2477 * @param m the mask controlling lane selection 2478 * @return the result of rotating left this vector by the broadcast of an 2479 * input scalar 2480 */ 2481 @ForceInline 2482 public final $abstractvectortype$ rotateL(int s, Mask<$Boxtype$> m) { 2483 return shiftL(s, m).or(shiftR(-s, m), m); 2484 } 2485 2486 /** 2487 * Rotates right this vector by the broadcast of an input scalar. 2488 * <p> 2489 * This is a vector binary operation where the operation 2490 * {@link $Wideboxtype$#rotateRight} is applied to lane elements and where 2491 * lane elements of this vector apply to the first argument, and lane 2492 * elements of the broadcast vector apply to the second argument (the 2493 * rotation distance). 2494 * 2495 * @param s the input scalar; the number of the bits to rotate right 2496 * @return the result of rotating right this vector by the broadcast of an 2497 * input scalar 2498 */ 2499 @ForceInline 2500 public final $abstractvectortype$ rotateR(int s) { 2501 return shiftR(s).or(shiftL(-s)); 2502 } 2503 2504 /** 2505 * Rotates right this vector by the broadcast of an input scalar, selecting 2506 * lane elements controlled by a mask. 2507 * <p> 2508 * This is a vector binary operation where the operation 2509 * {@link $Wideboxtype$#rotateRight} is applied to lane elements and where 2510 * lane elements of this vector apply to the first argument, and lane 2511 * elements of the broadcast vector apply to the second argument (the 2512 * rotation distance). 2513 * 2514 * @param s the input scalar; the number of the bits to rotate right 2515 * @param m the mask controlling lane selection 2516 * @return the result of rotating right this vector by the broadcast of an 2517 * input scalar 2518 */ 2519 @ForceInline 2520 public final $abstractvectortype$ rotateR(int s, Mask<$Boxtype$> m) { 2521 return shiftR(s, m).or(shiftL(-s, m), m); 2522 } 2523 #end[intOrLong] 2524 #end[BITWISE] 2525 2526 @Override 2527 public abstract void intoByteArray(byte[] a, int ix); 2528 2529 @Override 2530 public abstract void intoByteArray(byte[] a, int ix, Mask<$Boxtype$> m); 2531 2532 @Override 2533 public abstract void intoByteBuffer(ByteBuffer bb, int ix); 2534 2535 @Override 2536 public abstract void intoByteBuffer(ByteBuffer bb, int ix, Mask<$Boxtype$> m); 2537 2538 2539 // Type specific horizontal reductions 2540 /** 2541 * Adds all lane elements of this vector. 2542 * <p> 2543 #if[FP] 2544 * This is a vector reduction operation where the addition 2545 * operation ({@code +}) is applied to lane elements, 2546 * and the identity value is {@code 0.0}. 2547 * 2548 * <p>The value of a floating-point sum is a function both of the input values as well 2549 * as the order of addition operations. The order of addition operations of this method 2550 * is intentionally not defined to allow for JVM to generate optimal machine 2551 * code for the underlying platform at runtime. If the platform supports a vector 2552 * instruction to add all values in the vector, or if there is some other efficient machine 2553 * code sequence, then the JVM has the option of generating this machine code. Otherwise, 2554 * the default implementation of adding vectors sequentially from left to right is used. 2555 * For this reason, the output of this method may vary for the same input values. 2556 #else[FP] 2557 * This is an associative vector reduction operation where the addition 2558 * operation ({@code +}) is applied to lane elements, 2559 * and the identity value is {@code 0}. 2560 #end[FP] 2561 * 2562 * @return the addition of all the lane elements of this vector 2563 */ 2564 public abstract $type$ addAll(); 2565 2566 /** 2567 * Adds all lane elements of this vector, selecting lane elements 2568 * controlled by a mask. 2569 * <p> 2570 #if[FP] 2571 * This is a vector reduction operation where the addition 2572 * operation ({@code +}) is applied to lane elements, 2573 * and the identity value is {@code 0.0}. 2574 * 2575 * <p>The value of a floating-point sum is a function both of the input values as well 2576 * as the order of addition operations. The order of addition operations of this method 2577 * is intentionally not defined to allow for JVM to generate optimal machine 2578 * code for the underlying platform at runtime. If the platform supports a vector 2579 * instruction to add all values in the vector, or if there is some other efficient machine 2580 * code sequence, then the JVM has the option of generating this machine code. Otherwise, 2581 * the default implementation of adding vectors sequentially from left to right is used. 2582 * For this reason, the output of this method may vary on the same input values. 2583 #else[FP] 2584 * This is an associative vector reduction operation where the addition 2585 * operation ({@code +}) is applied to lane elements, 2586 * and the identity value is {@code 0}. 2587 #end[FP] 2588 * 2589 * @param m the mask controlling lane selection 2590 * @return the addition of the selected lane elements of this vector 2591 */ 2592 public abstract $type$ addAll(Mask<$Boxtype$> m); 2593 2594 /** 2595 * Multiplies all lane elements of this vector. 2596 * <p> 2597 #if[FP] 2598 * This is a vector reduction operation where the 2599 * multiplication operation ({@code *}) is applied to lane elements, 2600 * and the identity value is {@code 1.0}. 2601 * 2602 * <p>The order of multiplication operations of this method 2603 * is intentionally not defined to allow for JVM to generate optimal machine 2604 * code for the underlying platform at runtime. If the platform supports a vector 2605 * instruction to multiply all values in the vector, or if there is some other efficient machine 2606 * code sequence, then the JVM has the option of generating this machine code. Otherwise, 2607 * the default implementation of multiplying vectors sequentially from left to right is used. 2608 * For this reason, the output of this method may vary on the same input values. 2609 #else[FP] 2610 * This is an associative vector reduction operation where the 2611 * multiplication operation ({@code *}) is applied to lane elements, 2612 * and the identity value is {@code 1}. 2613 #end[FP] 2614 * 2615 * @return the multiplication of all the lane elements of this vector 2616 */ 2617 public abstract $type$ mulAll(); 2618 2619 /** 2620 * Multiplies all lane elements of this vector, selecting lane elements 2621 * controlled by a mask. 2622 * <p> 2623 #if[FP] 2624 * This is a vector reduction operation where the 2625 * multiplication operation ({@code *}) is applied to lane elements, 2626 * and the identity value is {@code 1.0}. 2627 * 2628 * <p>The order of multiplication operations of this method 2629 * is intentionally not defined to allow for JVM to generate optimal machine 2630 * code for the underlying platform at runtime. If the platform supports a vector 2631 * instruction to multiply all values in the vector, or if there is some other efficient machine 2632 * code sequence, then the JVM has the option of generating this machine code. Otherwise, 2633 * the default implementation of multiplying vectors sequentially from left to right is used. 2634 * For this reason, the output of this method may vary on the same input values. 2635 #else[FP] 2636 * This is an associative vector reduction operation where the 2637 * multiplication operation ({@code *}) is applied to lane elements, 2638 * and the identity value is {@code 1}. 2639 #end[FP] 2640 * 2641 * @param m the mask controlling lane selection 2642 * @return the multiplication of all the lane elements of this vector 2643 */ 2644 public abstract $type$ mulAll(Mask<$Boxtype$> m); 2645 2646 /** 2647 * Returns the minimum lane element of this vector. 2648 * <p> 2649 * This is an associative vector reduction operation where the operation 2650 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, 2651 * and the identity value is 2652 #if[FP] 2653 * {@link $Boxtype$#POSITIVE_INFINITY}. 2654 #else[FP] 2655 * {@link $Boxtype$#MAX_VALUE}. 2656 #end[FP] 2657 * 2658 * @return the minimum lane element of this vector 2659 */ 2660 public abstract $type$ minAll(); 2661 2662 /** 2663 * Returns the minimum lane element of this vector, selecting lane elements 2664 * controlled by a mask. 2665 * <p> 2666 * This is an associative vector reduction operation where the operation 2667 * {@code (a, b) -> Math.min(a, b)} is applied to lane elements, 2668 * and the identity value is 2669 #if[FP] 2670 * {@link $Boxtype$#POSITIVE_INFINITY}. 2671 #else[FP] 2672 * {@link $Boxtype$#MAX_VALUE}. 2673 #end[FP] 2674 * 2675 * @param m the mask controlling lane selection 2676 * @return the minimum lane element of this vector 2677 */ 2678 public abstract $type$ minAll(Mask<$Boxtype$> m); 2679 2680 /** 2681 * Returns the maximum lane element of this vector. 2682 * <p> 2683 * This is an associative vector reduction operation where the operation 2684 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, 2685 * and the identity value is 2686 #if[FP] 2687 * {@link $Boxtype$#NEGATIVE_INFINITY}. 2688 #else[FP] 2689 * {@link $Boxtype$#MIN_VALUE}. 2690 #end[FP] 2691 * 2692 * @return the maximum lane element of this vector 2693 */ 2694 public abstract $type$ maxAll(); 2695 2696 /** 2697 * Returns the maximum lane element of this vector, selecting lane elements 2698 * controlled by a mask. 2699 * <p> 2700 * This is an associative vector reduction operation where the operation 2701 * {@code (a, b) -> Math.max(a, b)} is applied to lane elements, 2702 * and the identity value is 2703 #if[FP] 2704 * {@link $Boxtype$#NEGATIVE_INFINITY}. 2705 #else[FP] 2706 * {@link $Boxtype$#MIN_VALUE}. 2707 #end[FP] 2708 * 2709 * @param m the mask controlling lane selection 2710 * @return the maximum lane element of this vector 2711 */ 2712 public abstract $type$ maxAll(Mask<$Boxtype$> m); 2713 2714 #if[BITWISE] 2715 /** 2716 * Logically ORs all lane elements of this vector. 2717 * <p> 2718 * This is an associative vector reduction operation where the logical OR 2719 * operation ({@code |}) is applied to lane elements, 2720 * and the identity value is {@code 0}. 2721 * 2722 * @return the logical OR all the lane elements of this vector 2723 */ 2724 public abstract $type$ orAll(); 2725 2726 /** 2727 * Logically ORs all lane elements of this vector, selecting lane elements 2728 * controlled by a mask. 2729 * <p> 2730 * This is an associative vector reduction operation where the logical OR 2731 * operation ({@code |}) is applied to lane elements, 2732 * and the identity value is {@code 0}. 2733 * 2734 * @param m the mask controlling lane selection 2735 * @return the logical OR all the lane elements of this vector 2736 */ 2737 public abstract $type$ orAll(Mask<$Boxtype$> m); 2738 2739 /** 2740 * Logically ANDs all lane elements of this vector. 2741 * <p> 2742 * This is an associative vector reduction operation where the logical AND 2743 * operation ({@code |}) is applied to lane elements, 2744 * and the identity value is {@code -1}. 2745 * 2746 * @return the logical AND all the lane elements of this vector 2747 */ 2748 public abstract $type$ andAll(); 2749 2750 /** 2751 * Logically ANDs all lane elements of this vector, selecting lane elements 2752 * controlled by a mask. 2753 * <p> 2754 * This is an associative vector reduction operation where the logical AND 2755 * operation ({@code |}) is applied to lane elements, 2756 * and the identity value is {@code -1}. 2757 * 2758 * @param m the mask controlling lane selection 2759 * @return the logical AND all the lane elements of this vector 2760 */ 2761 public abstract $type$ andAll(Mask<$Boxtype$> m); 2762 2763 /** 2764 * Logically XORs all lane elements of this vector. 2765 * <p> 2766 * This is an associative vector reduction operation where the logical XOR 2767 * operation ({@code ^}) is applied to lane elements, 2768 * and the identity value is {@code 0}. 2769 * 2770 * @return the logical XOR all the lane elements of this vector 2771 */ 2772 public abstract $type$ xorAll(); 2773 2774 /** 2775 * Logically XORs all lane elements of this vector, selecting lane elements 2776 * controlled by a mask. 2777 * <p> 2778 * This is an associative vector reduction operation where the logical XOR 2779 * operation ({@code ^}) is applied to lane elements, 2780 * and the identity value is {@code 0}. 2781 * 2782 * @param m the mask controlling lane selection 2783 * @return the logical XOR all the lane elements of this vector 2784 */ 2785 public abstract $type$ xorAll(Mask<$Boxtype$> m); 2786 #end[BITWISE] 2787 2788 // Type specific accessors 2789 2790 /** 2791 * Gets the lane element at lane index {@code i} 2792 * 2793 * @param i the lane index 2794 * @return the lane element at lane index {@code i} 2795 * @throws IllegalArgumentException if the index is is out of range 2796 * ({@code < 0 || >= length()}) 2797 */ 2798 public abstract $type$ get(int i); 2799 2800 /** 2801 * Replaces the lane element of this vector at lane index {@code i} with 2802 * value {@code e}. 2803 * <p> 2804 * This is a cross-lane operation and behaves as if it returns the result 2805 * of blending this vector with an input vector that is the result of 2806 * broadcasting {@code e} and a mask that has only one lane set at lane 2807 * index {@code i}. 2808 * 2809 * @param i the lane index of the lane element to be replaced 2810 * @param e the value to be placed 2811 * @return the result of replacing the lane element of this vector at lane 2812 * index {@code i} with value {@code e}. 2813 * @throws IllegalArgumentException if the index is is out of range 2814 * ({@code < 0 || >= length()}) 2815 */ 2816 public abstract $abstractvectortype$ with(int i, $type$ e); 2817 2818 // Type specific extractors 2819 2820 /** 2821 * Returns an array containing the lane elements of this vector. 2822 * <p> 2823 * This method behaves as if it {@link #intoArray($type$[], int)} stores} 2824 * this vector into an allocated array and returns the array as follows: 2825 * <pre>{@code 2826 * $type$[] a = new $type$[this.length()]; 2827 * this.intoArray(a, 0); 2828 * return a; 2829 * }</pre> 2830 * 2831 * @return an array containing the the lane elements of this vector 2832 */ 2833 @ForceInline 2834 public final $type$[] toArray() { 2835 $type$[] a = new $type$[species().length()]; 2836 intoArray(a, 0); 2837 return a; 2838 } 2839 2840 /** 2841 * Stores this vector into an array starting at offset. 2842 * <p> 2843 * For each vector lane, where {@code N} is the vector lane index, 2844 * the lane element at index {@code N} is stored into the array at index 2845 * {@code i + N}. 2846 * 2847 * @param a the array 2848 * @param i the offset into the array 2849 * @throws IndexOutOfBoundsException if {@code i < 0}, or 2850 * {@code i > a.length - this.length()} 2851 */ 2852 public abstract void intoArray($type$[] a, int i); 2853 2854 /** 2855 * Stores this vector into an array starting at offset and using a mask. 2856 * <p> 2857 * For each vector lane, where {@code N} is the vector lane index, 2858 * if the mask lane at index {@code N} is set then the lane element at 2859 * index {@code N} is stored into the array index {@code i + N}. 2860 * 2861 * @param a the array 2862 * @param i the offset into the array 2863 * @param m the mask 2864 * @throws IndexOutOfBoundsException if {@code i < 0}, or 2865 * for any vector lane index {@code N} where the mask at lane {@code N} 2866 * is set {@code i >= a.length - N} 2867 */ 2868 public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m); 2869 2870 /** 2871 * Stores this vector into an array using indexes obtained from an index 2872 * map. 2873 * <p> 2874 * For each vector lane, where {@code N} is the vector lane index, the 2875 * lane element at index {@code N} is stored into the array at index 2876 * {@code i + indexMap[j + N]}. 2877 * 2878 * @param a the array 2879 * @param i the offset into the array, may be negative if relative 2880 * indexes in the index map compensate to produce a value within the 2881 * array bounds 2882 * @param indexMap the index map 2883 * @param j the offset into the index map 2884 * @throws IndexOutOfBoundsException if {@code j < 0}, or 2885 * {@code j > indexMap.length - this.length()}, 2886 * or for any vector lane index {@code N} the result of 2887 * {@code i + indexMap[j + N]} is {@code < 0} or {@code >= a.length} 2888 */ 2889 #if[byteOrShort] 2890 public void intoArray($type$[] a, int i, int[] indexMap, int j) { 2891 forEach((n, e) -> a[i + indexMap[j + n]] = e); 2892 } 2893 #else[byteOrShort] 2894 public abstract void intoArray($type$[] a, int i, int[] indexMap, int j); 2895 #end[byteOrShort] 2896 2897 /** 2898 * Stores this vector into an array using indexes obtained from an index 2899 * map and using a mask. 2900 * <p> 2901 * For each vector lane, where {@code N} is the vector lane index, 2902 * if the mask lane at index {@code N} is set then the lane element at 2903 * index {@code N} is stored into the array at index 2904 * {@code i + indexMap[j + N]}. 2905 * 2906 * @param a the array 2907 * @param i the offset into the array, may be negative if relative 2908 * indexes in the index map compensate to produce a value within the 2909 * array bounds 2910 * @param m the mask 2911 * @param indexMap the index map 2912 * @param j the offset into the index map 2913 * @throws IndexOutOfBoundsException if {@code j < 0}, or 2914 * {@code j > indexMap.length - this.length()}, 2915 * or for any vector lane index {@code N} where the mask at lane 2916 * {@code N} is set the result of {@code i + indexMap[j + N]} is 2917 * {@code < 0} or {@code >= a.length} 2918 */ 2919 #if[byteOrShort] 2920 public void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j) { 2921 forEach(m, (n, e) -> a[i + indexMap[j + n]] = e); 2922 } 2923 #else[byteOrShort] 2924 public abstract void intoArray($type$[] a, int i, Mask<$Boxtype$> m, int[] indexMap, int j); 2925 #end[byteOrShort] 2926 // Species 2927 2928 @Override 2929 public abstract Species<$Boxtype$> species(); 2930 2931 /** 2932 * Class representing {@link $abstractvectortype$}'s of the same {@link Vector.Shape Shape}. 2933 */ 2934 static final class $Type$Species extends Vector.AbstractSpecies<$Boxtype$> { 2935 final Function<$type$[], $Type$Vector> vectorFactory; 2936 final Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory; 2937 2938 private $Type$Species(Vector.Shape shape, 2939 Class<?> boxType, 2940 Class<?> maskType, 2941 Function<$type$[], $Type$Vector> vectorFactory, 2942 Function<boolean[], Vector.Mask<$Boxtype$>> maskFactory) { 2943 super(shape, $type$.class, $Boxtype$.SIZE, boxType, maskType); 2944 this.vectorFactory = vectorFactory; 2945 this.maskFactory = maskFactory; 2946 } 2947 2948 interface FOp { 2949 $type$ apply(int i); 2950 } 2951 2952 interface FOpm { 2953 boolean apply(int i); 2954 } 2955 2956 $Type$Vector op(FOp f) { 2957 $type$[] res = new $type$[length()]; 2958 for (int i = 0; i < length(); i++) { 2959 res[i] = f.apply(i); 2960 } 2961 return vectorFactory.apply(res); 2962 } 2963 2964 $Type$Vector op(Vector.Mask<$Boxtype$> o, FOp f) { 2965 $type$[] res = new $type$[length()]; 2966 boolean[] mbits = ((AbstractMask<$Boxtype$>)o).getBits(); 2967 for (int i = 0; i < length(); i++) { 2968 if (mbits[i]) { 2969 res[i] = f.apply(i); 2970 } 2971 } 2972 return vectorFactory.apply(res); 2973 } 2974 2975 Vector.Mask<$Boxtype$> opm(IntVector.IntSpecies.FOpm f) { 2976 boolean[] res = new boolean[length()]; 2977 for (int i = 0; i < length(); i++) { 2978 res[i] = (boolean)f.apply(i); 2979 } 2980 return maskFactory.apply(res); 2981 } 2982 } 2983 2984 /** 2985 * Finds the preferred species for an element type of {@code $type$}. 2986 * <p> 2987 * A preferred species is a species chosen by the platform that has a 2988 * shape of maximal bit size. A preferred species for different element 2989 * types will have the same shape, and therefore vectors, masks, and 2990 * shuffles created from such species will be shape compatible. 2991 * 2992 * @return the preferred species for an element type of {@code $type$} 2993 */ 2994 private static $Type$Species preferredSpecies() { 2995 return ($Type$Species) Species.ofPreferred($type$.class); 2996 } 2997 2998 /** 2999 * Finds a species for an element type of {@code $type$} and shape. 3000 * 3001 * @param s the shape 3002 * @return a species for an element type of {@code $type$} and shape 3003 * @throws IllegalArgumentException if no such species exists for the shape 3004 */ 3005 static $Type$Species species(Vector.Shape s) { 3006 Objects.requireNonNull(s); 3007 switch (s) { 3008 case S_64_BIT: return ($Type$Species) SPECIES_64; 3009 case S_128_BIT: return ($Type$Species) SPECIES_128; 3010 case S_256_BIT: return ($Type$Species) SPECIES_256; 3011 case S_512_BIT: return ($Type$Species) SPECIES_512; 3012 case S_Max_BIT: return ($Type$Species) SPECIES_MAX; 3013 default: throw new IllegalArgumentException("Bad shape: " + s); 3014 } 3015 } 3016 3017 /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_64_BIT Shape.S_64_BIT}. */ 3018 public static final Species<$Boxtype$> SPECIES_64 = new $Type$Species(Shape.S_64_BIT, $Type$64Vector.class, $Type$64Vector.$Type$64Mask.class, 3019 $Type$64Vector::new, $Type$64Vector.$Type$64Mask::new); 3020 3021 /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_128_BIT Shape.S_128_BIT}. */ 3022 public static final Species<$Boxtype$> SPECIES_128 = new $Type$Species(Shape.S_128_BIT, $Type$128Vector.class, $Type$128Vector.$Type$128Mask.class, 3023 $Type$128Vector::new, $Type$128Vector.$Type$128Mask::new); 3024 3025 /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_256_BIT Shape.S_256_BIT}. */ 3026 public static final Species<$Boxtype$> SPECIES_256 = new $Type$Species(Shape.S_256_BIT, $Type$256Vector.class, $Type$256Vector.$Type$256Mask.class, 3027 $Type$256Vector::new, $Type$256Vector.$Type$256Mask::new); 3028 3029 /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_512_BIT Shape.S_512_BIT}. */ 3030 public static final Species<$Boxtype$> SPECIES_512 = new $Type$Species(Shape.S_512_BIT, $Type$512Vector.class, $Type$512Vector.$Type$512Mask.class, 3031 $Type$512Vector::new, $Type$512Vector.$Type$512Mask::new); 3032 3033 /** Species representing {@link $Type$Vector}s of {@link Vector.Shape#S_Max_BIT Shape.S_Max_BIT}. */ 3034 public static final Species<$Boxtype$> SPECIES_MAX = new $Type$Species(Shape.S_Max_BIT, $Type$MaxVector.class, $Type$MaxVector.$Type$MaxMask.class, 3035 $Type$MaxVector::new, $Type$MaxVector.$Type$MaxMask::new); 3036 3037 /** 3038 * Preferred species for {@link $Type$Vector}s. 3039 * A preferred species is a species of maximal bit size for the platform. 3040 */ 3041 public static final Species<$Boxtype$> SPECIES_PREFERRED = (Species<$Boxtype$>) preferredSpecies(); 3042 }