void next_check <T>() where T : unmanaged { for (var i = 0; i < SampleSize; i++) { var x = Random.CpuVec128 <T>(); var xn = x.Next(); var xp = x.Prior(); var units128 = Vec128Pattern.Units <T>(); Claim.yea(ginx.add <T>(xp, units128).Equals(x)); Claim.yea(ginx.sub <T>(xn, units128).Equals(x)); for (var j = 0; j < x.Length(); j++) { Claim.eq(xn[j], gmath.inc(x[j])); Claim.eq(xp[j], gmath.dec(x[j])); } var y = Random.CpuVec256 <T>(); var yn = y.Next(); var yp = y.Prior(); var units256 = Vec256Pattern.Units <T>(); Claim.yea(ginx.add <T>(yp, units256).Equals(y)); Claim.yea(ginx.sub <T>(yn, units256).Equals(y)); for (var j = 0; j < x.Length(); j++) { Claim.eq(yn[j], gmath.inc(y[j])); Claim.eq(yp[j], gmath.dec(y[j])); } } }
/// <summary> /// Creates a vector with decrementing components v[0] = last and v[i-1] = v[i] - 1 for i=1...N-1 /// </summary> /// <param name="last">The value of the first component</param> /// <param name="swaps">Transpositions applied to decrements prior to vector creation</param> /// <typeparam name="T">The primal component type</typeparam> public static Vec256 <T> Decrements <T>(T last = default, params Swap[] swaps) where T : unmanaged => Vec256Pattern <T> .Decrements(last, swaps);
/// <summary> /// Creates a vector with incrementing components, v[0] = first and v[i+1] = v[i] + 1 for i=1...N-1 /// </summary> /// <param name="first">The value of the first component</param> /// <typeparam name="T">The primal component type</typeparam> public static Vec256 <T> Increments <T>(T first = default, params Swap[] swaps) where T : unmanaged => Vec256Pattern <T> .Increments(first, swaps);