protected void VerifyOp <K>(OpKind opKind, UnaryOp <K> subject, UnaryOp <K> baseline, bool nonzero = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int?line = null) where K : struct { var kind = PrimalKinds.kind <K>(); var opid = opKind.PrimalGOpId <K>(); var src = RandArray <K>(nonzero); var timing = stopwatch(); for (var i = 0; i < src.Length; i++) { Claim.eq(baseline(src[i]), subject(src[i]), caller, file, line); } }
protected void VerifyOp <K>(OpKind opKind, BinaryPredicate <K> baseline, BinaryPredicate <K> op, bool nonzero = false, [CallerMemberName] string caller = null, [CallerFilePath] string file = null, [CallerLineNumber] int?line = null) where K : struct { var kind = PrimalKinds.kind <K>(); var opid = opKind.PrimalGOpId <K>(); var lhs = RandArray <K>(); var rhs = RandArray <K>(nonzero); var len = length(lhs, rhs); var timing = stopwatch(); for (var i = 0; i < len; i++) { Claim.eq(baseline(lhs[i], rhs[i]), op(lhs[i], rhs[i]), caller, file, line); } }