public static short2x4 operator %(short2x4 left, short right) { if (Avx2.IsAvx2Supported) { if (!Constant.IsConstantExpression(right)) { short8 rem = new short8(left.c0, left.c1, left.c2, left.c3) % right; return(new short2x4(rem.v2_0, rem.v2_2, rem.v2_4, rem.v2_6)); } } else if (Sse2.IsSse2Supported) { if (!Constant.IsConstantExpression(right)) { short4 divisor = right; short4 lo = new short4(left.c0, left.c1) % divisor; short4 hi = new short4(left.c2, left.c3) % divisor; return(new short2x4(lo.xy, lo.zw, hi.xy, hi.zw)); } } return(new short2x4(left.c0 % right, left.c1 % right, left.c2 % right, left.c3 % right)); }
public short4x4(short v) { this.c0 = v; this.c1 = v; this.c2 = v; this.c3 = v; }
public static short2x4 operator /(short2x4 left, short right) { if (Avx2.IsAvx2Supported) { if (!Constant.IsConstantExpression(right)) { short8 div = new short8(left.c0, left.c1, left.c2, left.c3) / right; return(new short2x4(div.v2_0, div.v2_2, div.v2_4, div.v2_6)); } } else if (Sse2.IsSse2Supported) { if (!Constant.IsConstantExpression(right)) { short4 divisor = right; short4 lo = new short4(left.c0, left.c1) / divisor; short4 hi = new short4(left.c2, left.c3) / divisor; return(new short2x4(lo.xy, lo.zw, hi.xy, hi.zw)); } } return(new short2x4(left.c0 / right, left.c1 / right, left.c2 / right, left.c3 / right)); }
public static ushort4 lcm(short4 x, short4 y) { ushort4 absX = (ushort4)abs(x); ushort4 absY = (ushort4)abs(y); return((absX / gcd(absX, absY)) * absY); }
private static void RunManaged() { var abuf = new short4[2]; Array.Copy(a, abuf, 2); var bbuf = new short4[2]; Array.Copy(b, bbuf, 2); var rbuf = new short4[2]; // set work-item dimensions var global_work_size = new int[] { 2 }; // execute kernel Cl.RunKernel( global_work_size, new int[] { 1 }, (Action <short4[], short4[], short4[]>)TestKernel, abuf, bbuf, rbuf ); PrintArray(rbuf); }
public short4x4(short4 c0, short4 c1, short4 c2, short4 c3) { this.c0 = c0; this.c1 = c1; this.c2 = c2; this.c3 = c3; }
public void Short4_ParseFromString(short v0, short v1, short v2, short v3) { string s = NormalFormat.F(v0, v1, v2, v3); short4 n = new short4(v0, v1, v2, v3); short4 ns = short4.Parse(s); Assert.That(ns, Is.EqualTo(n)); }
public void Short4_WriteToString(short v0, short v1, short v2, short v3) { string s = NormalFormat.F(v0, v1, v2, v3); short4 n = new short4(v0, v1, v2, v3); string sn = n.ToString(); Assert.That(sn, Is.EqualTo(s)); }
public short4x2(short m00, short m01, short m10, short m11, short m20, short m21, short m30, short m31) { this.c0 = new short4(m00, m10, m20, m30); this.c1 = new short4(m01, m11, m21, m31); }
public void Short4_GetIndices(short v0, short v1, short v2, short v3) { short4 n = new short4(v0, v1, v2, v3); Assert.That(n[0], Is.EqualTo(v0)); Assert.That(n[1], Is.EqualTo(v1)); Assert.That(n[2], Is.EqualTo(v2)); Assert.That(n[3], Is.EqualTo(v3)); }
public void Short4_GetFields(short v0, short v1, short v2, short v3) { short4 n = new short4(v0, v1, v2, v3); Assert.That(n.x, Is.EqualTo(v0)); Assert.That(n.y, Is.EqualTo(v1)); Assert.That(n.z, Is.EqualTo(v2)); Assert.That(n.w, Is.EqualTo(v3)); }
public void Short4_TryParse(short v0, short v1, short v2, short v3) { string s = NormalFormat.F(v0, v1, v2, v3); short4 n = new short4(v0, v1, v2, v3); short4 ns; Assert.IsTrue(short4.TryParse(s, out ns)); Assert.That(ns, Is.EqualTo(n)); }
public static int cprod(short4 x) { int4 cast = x; cast *= cast.zwzw; cast *= cast.yyyy; return(cast.x); }
public short4x3(short m00, short m01, short m02, short m10, short m11, short m12, short m20, short m21, short m22, short m30, short m31, short m32) { this.c0 = new short4(m00, m10, m20, m30); this.c1 = new short4(m01, m11, m21, m31); this.c2 = new short4(m02, m12, m22, m32); }
public static bool4 isdivisible(short4 dividend, short4 divisor) { Assert.AreNotEqual(0, divisor.x); Assert.AreNotEqual(0, divisor.y); Assert.AreNotEqual(0, divisor.z); Assert.AreNotEqual(0, divisor.w); return(dividend % divisor == 0); }
public static int csum(sbyte4 x) { short4 cast = x; cast += cast.zwzw; cast += cast.yyyy; return(cast.x); }
public short4x4(short m00, short m01, short m02, short m03, short m10, short m11, short m12, short m13, short m20, short m21, short m22, short m23, short m30, short m31, short m32, short m33) { this.c0 = new short4(m00, m10, m20, m30); this.c1 = new short4(m01, m11, m21, m31); this.c2 = new short4(m02, m12, m22, m32); this.c3 = new short4(m03, m13, m23, m33); }
public void Short4_ParseFromString_ArbitarySpace(short v0, short v1, short v2, short v3) { foreach (string fmt in ArbitaryWhiteSpaceFormat) { string s = fmt.F(v0, v1, v2, v3); short4 n = new short4(v0, v1, v2, v3); short4 ns = short4.Parse(s); Assert.That(ns, Is.EqualTo(n)); } }
public static short4 subadd(short4 a, short4 b) { if (Ssse3.IsSsse3Supported) { return(a + Ssse3.sign_epi16(b, new ushort4(ushort.MaxValue, 1, ushort.MaxValue, 1))); } else { return(a - select(b, -b, new bool4(false, true, false, true))); } }
public static bool all(short4 x) { if (Sse2.IsSse2Supported) { return(0 == Sse2.cmpeq_epi16(x, default(v128)).ULong0); } else { return(math.all(x != 0)); } }
public static short4 sign(short4 x) { if (Ssse3.IsSsse3Supported) { return(Ssse3.sign_epi16(new short4(1), x)); } else { return((x >> 15) | (short4)((ushort4)(-x) >> 15)); } }
public static bool any(short4 x) { if (Sse2.IsSse2Supported) { return(0 != ((v128)x).ULong0); } else { return(math.any(x != 0)); } }
public static bool all_eq(short4 c) { if (Sse2.IsSse2Supported) { return(c.xxxx.Equals(c)); } else { return(c.x == c.y & c.x == c.z & c.x == c.w); } }
public static short4 max(short4 a, short4 b) { if (Sse2.IsSse2Supported) { return(Sse2.max_epi16(a, b)); } else { return(new short4((short)math.max(a.x, b.x), (short)math.max(a.y, b.y), (short)math.max(a.z, b.z), (short)math.max(a.w, b.w))); } }
public static void short4() { Random16 rng = new Random16(135); for (int i = 0; i < 64; i++) { short4 x = rng.NextShort4(); Assert.AreEqual(new short4((short)maxmath.lzcnt(x.x), (short)maxmath.lzcnt(x.y), (short)maxmath.lzcnt(x.z), (short)maxmath.lzcnt(x.w)), maxmath.lzcnt(x)); } }
public static void short4() { Random16 rng = new Random16(135); for (int i = 0; i < 64; i++) { short4 x = rng.NextShort4(); short4 y = rng.NextShort4(); Assert.AreEqual(new ushort4((ushort)_gcd(x.x, y.x), (ushort)_gcd(x.y, y.y), (ushort)_gcd(x.z, y.z), (ushort)_gcd(x.w, y.w)), maxmath.gcd(x, y)); } }
public static void short4() { Random16 rng = new Random16(135); for (int i = 0; i < 64; i++) { short4 x = rng.NextShort4(); ushort4 n = rng.NextUShort4(); Assert.AreEqual(new short4((short)_intpow(x.x, n.x), (short)_intpow(x.y, n.y), (short)_intpow(x.z, n.z), (short)_intpow(x.w, n.w)), maxmath.intpow(x, n)); } }
public static short4 divrem(short4 dividend, short divisor, out short4 remainder) { if (Constant.IsConstantExpression(divisor)) { remainder = dividend % divisor; return(dividend / divisor); } else { return(divrem(dividend, (short4)divisor, out remainder)); } }
public static short cmin(short4 x) { if (Sse2.IsSse2Supported) { x = min(x, x.zwzw); return(min(x, x.yyyy).x); } else { return((short)math.min((int)x.x, math.min((int)x.y, math.min((int)x.z, (int)x.w)))); } }
public byte4 NextByte4(byte4 max) { if (Ssse3.IsSsse3Supported) { short4 temp = (short4)max * new short4(NextState(), NextState(), NextState(), NextState()); return(Ssse3.shuffle_epi8(temp, new byte4(1, 3, 5, 7))); } else { return((byte4)(((short4)max * new short4(NextState(), NextState(), NextState(), NextState())) >> 8)); } }
public static extern CUResult cuMemcpyDtoH_v2(ref short4 dstHost, CUdeviceptr srcDevice, SizeT ByteCount);
public static extern short4 mono_return_short4 (short4 s, int addend);