100 101 abstract void forEach(VectorMask<Double> m, FUnCon f); 102 103 // Static factories 104 105 /** 106 * Returns a vector where all lane elements are set to the default 107 * primitive value. 108 * 109 * @param species species of desired vector 110 * @return a zero vector of given species 111 */ 112 @ForceInline 113 @SuppressWarnings("unchecked") 114 public static DoubleVector zero(VectorSpecies<Double> species) { 115 return VectorIntrinsics.broadcastCoerced((Class<DoubleVector>) species.vectorType(), double.class, species.length(), 116 Double.doubleToLongBits(0.0f), species, 117 ((bits, s) -> ((DoubleSpecies)s).op(i -> Double.longBitsToDouble((long)bits)))); 118 } 119 120 /** 121 * Loads a vector from a byte array starting at an offset. 122 * <p> 123 * Bytes are composed into primitive lane elements according to the 124 * native byte order of the underlying platform 125 * <p> 126 * This method behaves as if it returns the result of calling the 127 * byte buffer, offset, and mask accepting 128 * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: 129 * <pre>{@code 130 * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue()); 131 * }</pre> 132 * 133 * @param species species of desired vector 134 * @param a the byte array 135 * @param offset the offset into the array 136 * @return a vector loaded from a byte array 137 * @throws IndexOutOfBoundsException if {@code i < 0} or 138 * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} 139 */ | 100 101 abstract void forEach(VectorMask<Double> m, FUnCon f); 102 103 // Static factories 104 105 /** 106 * Returns a vector where all lane elements are set to the default 107 * primitive value. 108 * 109 * @param species species of desired vector 110 * @return a zero vector of given species 111 */ 112 @ForceInline 113 @SuppressWarnings("unchecked") 114 public static DoubleVector zero(VectorSpecies<Double> species) { 115 return VectorIntrinsics.broadcastCoerced((Class<DoubleVector>) species.vectorType(), double.class, species.length(), 116 Double.doubleToLongBits(0.0f), species, 117 ((bits, s) -> ((DoubleSpecies)s).op(i -> Double.longBitsToDouble((long)bits)))); 118 } 119 120 @ForceInline 121 @SuppressWarnings("unchecked") 122 static VectorShuffle<Double> shuffleIotaHelper(VectorSpecies<Double> species, int step) { 123 switch (species.bitSize()) { 124 case 64: return VectorIntrinsics.shuffleIota(double.class, Double64Vector.Double64Shuffle.class, species, 125 64 / Double.SIZE, step, 126 (val, l) -> new Double64Vector.Double64Shuffle(i -> ((i + val) & (l-1)))); 127 case 128: return VectorIntrinsics.shuffleIota(double.class, Double128Vector.Double128Shuffle.class, species, 128 128/ Double.SIZE, step, 129 (val, l) -> new Double128Vector.Double128Shuffle(i -> ((i + val) & (l-1)))); 130 case 256: return VectorIntrinsics.shuffleIota(double.class, Double256Vector.Double256Shuffle.class, species, 131 256/ Double.SIZE, step, 132 (val, l) -> new Double256Vector.Double256Shuffle(i -> ((i + val) & (l-1)))); 133 case 512: return VectorIntrinsics.shuffleIota(double.class, Double512Vector.Double512Shuffle.class, species, 134 512 / Double.SIZE, step, 135 (val, l) -> new Double512Vector.Double512Shuffle(i -> ((i + val) & (l-1)))); 136 default: throw new IllegalArgumentException(Integer.toString(species.bitSize())); 137 } 138 } 139 140 /** 141 * Loads a vector from a byte array starting at an offset. 142 * <p> 143 * Bytes are composed into primitive lane elements according to the 144 * native byte order of the underlying platform 145 * <p> 146 * This method behaves as if it returns the result of calling the 147 * byte buffer, offset, and mask accepting 148 * {@link #fromByteBuffer(VectorSpecies, ByteBuffer, int, VectorMask) method} as follows: 149 * <pre>{@code 150 * return fromByteBuffer(species, ByteBuffer.wrap(a), offset, VectorMask.allTrue()); 151 * }</pre> 152 * 153 * @param species species of desired vector 154 * @param a the byte array 155 * @param offset the offset into the array 156 * @return a vector loaded from a byte array 157 * @throws IndexOutOfBoundsException if {@code i < 0} or 158 * {@code offset > a.length - (species.length() * species.elementSize() / Byte.SIZE)} 159 */ |