Catalog: precision tags and casts
Library · Source module
Catalog: precision tags and casts
A precision tag is a copy of a group of operations. NLAlib.Ops.Tagged π G is the group G at the tag π (a type used as a name: Single, Double). A signature with two precisions contains Tagged Lo ScalarOp and Tagged Hi ScalarOp; a call of add at the tag π is the operation NLAlib.Ops.Tagged.inj π ScalarOp.add.
* Counts are per tag: the count of a run is keyed by the operation, and the operations of two tags are different names (NLAlib.Ops.Tagged.inj_ne). * Contracts are per tag: NLAlib.Ops.IsScalarAt π M I says the scalar operations at the tag π are the functions of the machine M; a mixed-precision algorithm has one machine, one standard model and one parameter record per tag. * Nothing is rewritten for a tag. An algorithm, an implementation or a table is written for any signature with the groups it uses ([Has G Op]). At a tag it is the same definition with the instance NLAlib.Ops.Tagged.has π, and its certificate is the same theorem (NLAlib.Ops.IsScalarAt.isScalar). The untagged group is the default precision. * Casts between two tags are the group NLAlib.Ops.CastOp π ρ, with the functional contract NLAlib.Ops.IsCast and the model NLAlib.Ops.CastModel (rounding to the target precision; a widening cast is exact, u = 0).
Memory is counted in cells of one size: a workspace per tag would need the tag on alloc and in the state of the counted run, which is a change of the evaluator and is not made here.
Main results
* NLAlib.Ops.Tagged, NLAlib.Ops.Tagged.has, NLAlib.Ops.Tagged.inj: tags. * NLAlib.Ops.IsScalarAt, NLAlib.Ops.IsScalarAt.isScalar: scalar arithmetic at a tag. * NLAlib.Ops.CastOp, NLAlib.Ops.IsCast, NLAlib.Ops.CastModel: casts.