127 references to As
System.Numerics.Tensors (95)
System\Numerics\Tensors\netcore\TensorPrimitives.Cbrt.cs (2)
50return ExpOperator<float>.Invoke(LogOperator<float>.Invoke(x.AsSingle()) / Vector256.Create(3f)).As<float, T>(); 55return ExpOperator<double>.Invoke(LogOperator<double>.Invoke(x.AsDouble()) / Vector256.Create(3d)).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Ceiling.cs (2)
48return Vector256.Ceiling(x.AsSingle()).As<float, T>(); 53return Vector256.Ceiling(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertToInteger.cs (4)
61if (typeof(TTo) == typeof(int)) return Vector256.ConvertToInt32(x.AsSingle()).As<int, TTo>(); 62if (typeof(TTo) == typeof(uint)) return Vector256.ConvertToUInt32(x.AsSingle()).As<uint, TTo>(); 67if (typeof(TTo) == typeof(long)) return Vector256.ConvertToInt64(x.AsDouble()).As<long, TTo>(); 68if (typeof(TTo) == typeof(ulong)) return Vector256.ConvertToUInt64(x.AsDouble()).As<ulong, TTo>();
System\Numerics\Tensors\netcore\TensorPrimitives.ConvertToIntegerNative.cs (4)
61if (typeof(TTo) == typeof(int)) return Vector256.ConvertToInt32Native(x.AsSingle()).As<int, TTo>(); 62if (typeof(TTo) == typeof(uint)) return Vector256.ConvertToUInt32Native(x.AsSingle()).As<uint, TTo>(); 67if (typeof(TTo) == typeof(long)) return Vector256.ConvertToInt64Native(x.AsDouble()).As<long, TTo>(); 68if (typeof(TTo) == typeof(ulong)) return Vector256.ConvertToUInt64Native(x.AsDouble()).As<ulong, TTo>();
System\Numerics\Tensors\netcore\TensorPrimitives.Cos.cs (2)
98return Vector256.Cos(x.AsDouble()).As<double, T>(); 103return Vector256.Cos(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Cosh.cs (2)
102return (Vector256.Create((float)Single_HALFV) * (z + (Vector256.Create((float)Single_INVV2) / z))).As<float, T>(); 111return (Vector256.Create(Double_HALFV) * (z + (Vector256.Create(Double_INVV2) / z))).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.CosPi.cs (2)
72return ApplyScalar<CosPiOperator<float>>(x.AsSingle()).As<float, T>(); 80return ApplyScalar<CosPiOperator<double>>(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.DegreesToRadians.cs (2)
54return Vector256.DegreesToRadians(x.AsDouble()).As<double, T>(); 59return Vector256.DegreesToRadians(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Exp.cs (2)
72return Vector256.Exp(x.AsDouble()).As<double, T>(); 77return Vector256.Exp(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Floor.cs (2)
48return Vector256.Floor(x.AsSingle()).As<float, T>(); 53return Vector256.Floor(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.FusedMultiplyAdd.cs (2)
159return Vector256.FusedMultiplyAdd(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>(); 164return Vector256.FusedMultiplyAdd(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Hypot.cs (2)
58return Vector256.Hypot(x.AsDouble(), y.AsDouble()).As<double, T>(); 63return Vector256.Hypot(x.AsSingle(), y.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMax.cs (21)
73Vector256<T> sameSign = Vector256.Equals(IsNegative(result).AsInt32(), currentNegative.AsInt32()).As<int, T>(); 245sizeof(T) == sizeof(long) ? Vector256.Create((long)i).As<long, T>() : 246sizeof(T) == sizeof(int) ? Vector256.Create(i).As<int, T>() : 247sizeof(T) == sizeof(short) ? Vector256.Create((short)i).As<short, T>() : 248Vector256.Create((byte)i).As<byte, T>(); 253sizeof(T) == sizeof(long) ? Vector256<long>.Indices.As<long, T>() : 254sizeof(T) == sizeof(int) ? Vector256<int>.Indices.As<int, T>() : 255sizeof(T) == sizeof(short) ? Vector256<short>.Indices.As<short, T>() : 256Vector256<byte>.Indices.As<byte, T>(); 318(int)(long)(object)currentIndex.As<T, long>()[indexInVectorOfFirstMatch] : 319(int)(object)currentIndex.As<T, int>()[indexInVectorOfFirstMatch]; 454sizeof(T) == sizeof(long) ? Vector256.LessThan(indices1.AsInt64(), indices2.AsInt64()).As<long, T>() : 455sizeof(T) == sizeof(int) ? Vector256.LessThan(indices1.AsInt32(), indices2.AsInt32()).As<int, T>() : 456sizeof(T) == sizeof(short) ? Vector256.LessThan(indices1.AsInt16(), indices2.AsInt16()).As<short, T>() : 457Vector256.LessThan(indices1.AsByte(), indices2.AsByte()).As<byte, T>(); 491if (typeof(T) == typeof(float)) return Avx2.BlendVariable(left.AsSingle(), right.AsSingle(), (~mask).AsSingle()).As<float, T>(); 492if (typeof(T) == typeof(double)) return Avx2.BlendVariable(left.AsDouble(), right.AsDouble(), (~mask).AsDouble()).As<double, T>(); 494if (sizeof(T) == 1) return Avx2.BlendVariable(left.AsByte(), right.AsByte(), (~mask).AsByte()).As<byte, T>(); 495if (sizeof(T) == 2) return Avx2.BlendVariable(left.AsUInt16(), right.AsUInt16(), (~mask).AsUInt16()).As<ushort, T>(); 496if (sizeof(T) == 4) return Avx2.BlendVariable(left.AsUInt32(), right.AsUInt32(), (~mask).AsUInt32()).As<uint, T>(); 497if (sizeof(T) == 8) return Avx2.BlendVariable(left.AsUInt64(), right.AsUInt64(), (~mask).AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMaxMagnitude.cs (1)
72Vector256<T> sameSign = Vector256.Equals(IsNegative(result).AsInt32(), currentNegative.AsInt32()).As<int, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMin.cs (1)
70Vector256<T> sameSign = Vector256.Equals(resultNegative.AsInt32(), IsNegative(current).AsInt32()).As<int, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMinMagnitude.cs (1)
72Vector256<T> sameSign = Vector256.Equals(resultNegative.AsInt32(), IsNegative(current).AsInt32()).As<int, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.LeadingZeroCount.cs (4)
104return Avx512Vbmi.VL.PermuteVar32x8(lookupVector, indexVector).As<byte, T>(); 117return Avx2.Or(lz_bot16, lz_top16_shift).AsUInt16().As<ushort, T>(); 122return Avx512CD.VL.LeadingZeroCount(x.AsUInt32()).As<uint, T>(); 127return Avx512CD.VL.LeadingZeroCount(x.AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Lerp.cs (2)
102return Vector256.Lerp(x.AsDouble(), y.AsDouble(), amount.AsDouble()).As<double, T>(); 107return Vector256.Lerp(x.AsSingle(), y.AsSingle(), amount.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Log.cs (2)
114return Vector256.Log(x.AsDouble()).As<double, T>(); 119return Vector256.Log(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Log2.cs (2)
74return Vector256.Log2(x.AsDouble()).As<double, T>(); 79return Vector256.Log2(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.MultiplyAddEstimate.cs (2)
162return Vector256.MultiplyAddEstimate(x.AsDouble(), y.AsDouble(), z.AsDouble()).As<double, T>(); 166return Vector256.MultiplyAddEstimate(x.AsSingle(), y.AsSingle(), z.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.PopCount.cs (3)
151return ((tmp + (tmp.AsUInt16() >> 4).AsByte()) & c3).As<byte, T>(); 165return tmp.As<ushort, T>(); 179return tmp.As<uint, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Pow.cs (2)
83return ExpOperator<float>.Invoke(y.AsSingle() * LogOperator<float>.Invoke(x.AsSingle())).As<float, T>(); 88return ExpOperator<double>.Invoke(y.AsDouble() * LogOperator<double>.Invoke(x.AsDouble())).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.RadiansToDegrees.cs (2)
54return Vector256.RadiansToDegrees(x.AsDouble()).As<double, T>(); 59return Vector256.RadiansToDegrees(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Reciprocal.cs (6)
129if (typeof(T) == typeof(float)) return Avx512F.VL.Reciprocal14(x.AsSingle()).As<float, T>(); 130if (typeof(T) == typeof(double)) return Avx512F.VL.Reciprocal14(x.AsDouble()).As<double, T>(); 136if (typeof(T) == typeof(float)) return Avx.Reciprocal(x.AsSingle()).As<float, T>(); 195if (typeof(T) == typeof(float)) return Avx512F.VL.ReciprocalSqrt14(x.AsSingle()).As<float, T>(); 196if (typeof(T) == typeof(double)) return Avx512F.VL.ReciprocalSqrt14(x.AsDouble()).As<double, T>(); 202if (typeof(T) == typeof(float)) return Avx.ReciprocalSqrt(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Remainder.cs (2)
82typeof(T) == typeof(float) ? x - (TruncateOperator<float>.Invoke((x / y).AsSingle()).As<float, T>() * y) : 83typeof(T) == typeof(double) ? x - (TruncateOperator<double>.Invoke((x / y).AsDouble()).As<double, T>() * y) :
System\Numerics\Tensors\netcore\TensorPrimitives.Round.cs (4)
203return Vector256.Round(x.AsDouble()).As<double, T>(); 208return Vector256.Round(x.AsSingle()).As<float, T>(); 271return TruncateOperator<float>.Invoke(x.AsSingle() + CopySignOperator<float>.Invoke(Vector256.Create(0.49999997f), x.AsSingle())).As<float, T>(); 276return TruncateOperator<double>.Invoke(x.AsDouble() + CopySignOperator<double>.Invoke(Vector256.Create(0.49999999999999994), x.AsDouble())).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Sin.cs (2)
88return Vector256.Sin(x.AsDouble()).As<double, T>(); 93return Vector256.Sin(x.AsSingle()).As<float, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Sinh.cs (2)
90return (sign ^ result.AsUInt32()).As<uint, T>(); 101return (sign ^ result.AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.SinPi.cs (2)
72return ApplyScalar<SinPiOperator<float>>(x.AsSingle()).As<float, T>(); 80return ApplyScalar<SinPiOperator<double>>(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Tan.cs (2)
78return TanOperatorSingle.Invoke(x.AsSingle()).As<float, T>(); 83return TanOperatorDouble.Invoke(x.AsDouble()).As<double, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Tanh.cs (2)
94return (sign ^ (-z / (z + Vector256.Create(2f))).AsUInt32()).As<uint, T>(); 103return (sign ^ (-z / (z + Vector256.Create(2d))).AsUInt64()).As<ulong, T>();
System\Numerics\Tensors\netcore\TensorPrimitives.Truncate.cs (2)
74return Vector256.Truncate(x.AsDouble()).As<double, T>(); 79return Vector256.Truncate(x.AsSingle()).As<float, T>();
System.Private.CoreLib (32)
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (30)
175public static Vector256<byte> AsByte<T>(this Vector256<T> vector) => vector.As<T, byte>(); 183public static Vector256<double> AsDouble<T>(this Vector256<T> vector) => vector.As<T, double>(); 191public static Vector256<short> AsInt16<T>(this Vector256<T> vector) => vector.As<T, short>(); 199public static Vector256<int> AsInt32<T>(this Vector256<T> vector) => vector.As<T, int>(); 207public static Vector256<long> AsInt64<T>(this Vector256<T> vector) => vector.As<T, long>(); 215public static Vector256<nint> AsNInt<T>(this Vector256<T> vector) => vector.As<T, nint>(); 224public static Vector256<nuint> AsNUInt<T>(this Vector256<T> vector) => vector.As<T, nuint>(); 233public static Vector256<sbyte> AsSByte<T>(this Vector256<T> vector) => vector.As<T, sbyte>(); 241public static Vector256<float> AsSingle<T>(this Vector256<T> vector) => vector.As<T, float>(); 250public static Vector256<ushort> AsUInt16<T>(this Vector256<T> vector) => vector.As<T, ushort>(); 259public static Vector256<uint> AsUInt32<T>(this Vector256<T> vector) => vector.As<T, uint>(); 268public static Vector256<ulong> AsUInt64<T>(this Vector256<T> vector) => vector.As<T, ulong>(); 1963return VectorMath.IsEvenIntegerSingle<Vector256<float>, Vector256<uint>>(vector.AsSingle()).As<float, T>(); 1967return VectorMath.IsEvenIntegerDouble<Vector256<double>, Vector256<ulong>>(vector.AsDouble()).As<double, T>(); 1979return ~IsZero(AndNot(Create<uint>(float.PositiveInfinityBits), vector.AsUInt32())).As<uint, T>(); 1983return ~IsZero(AndNot(Create<ulong>(double.PositiveInfinityBits), vector.AsUInt64())).As<ulong, T>(); 2039return LessThan(vector.AsInt32(), Vector256<int>.Zero).As<int, T>(); 2043return LessThan(vector.AsInt64(), Vector256<long>.Zero).As<long, T>(); 2058return Equals(vector, Create(float.NegativeInfinity).As<float, T>()); 2062return Equals(vector, Create(double.NegativeInfinity).As<double, T>()); 2074return LessThan(Abs(vector).AsUInt32() - Create<uint>(float.SmallestNormalBits), Create<uint>(float.PositiveInfinityBits - float.SmallestNormalBits)).As<uint, T>(); 2078return LessThan(Abs(vector).AsUInt64() - Create<ulong>(double.SmallestNormalBits), Create<ulong>(double.PositiveInfinityBits - double.SmallestNormalBits)).As<ulong, T>(); 2090return VectorMath.IsOddIntegerSingle<Vector256<float>, Vector256<uint>>(vector.AsSingle()).As<float, T>(); 2094return VectorMath.IsOddIntegerDouble<Vector256<double>, Vector256<ulong>>(vector.AsDouble()).As<double, T>(); 2114return GreaterThanOrEqual(vector.AsInt32(), Vector256<int>.Zero).As<int, T>(); 2118return GreaterThanOrEqual(vector.AsInt64(), Vector256<long>.Zero).As<long, T>(); 2133return Equals(vector, Create(float.PositiveInfinity).As<float, T>()); 2137return Equals(vector, Create(double.PositiveInfinity).As<double, T>()); 2149return LessThan(Abs(vector).AsUInt32() - Vector256<uint>.One, Create<uint>(float.MaxTrailingSignificand)).As<uint, T>(); 2153return LessThan(Abs(vector).AsUInt64() - Vector256<ulong>.One, Create<ulong>(double.MaxTrailingSignificand)).As<ulong, T>();
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256_1.cs (2)
343return vector ^ Vector256.Create(-0.0f).As<float, T>(); 347return vector ^ Vector256.Create(-0.0).As<double, T>();