httk.core.vectors.vector_frac_view

A view presenting any vector backend as a FracVector (the exact-rational representation).

Classes

VectorFracView

A view presenting an underlying vector backend as an exact

Module Contents

class httk.core.vectors.vector_frac_view.VectorFracView(obj, **hints)

Bases: httk.core.vectors.vector_view.VectorView, httk.core.vectors.fracvector.FracVector

A view presenting an underlying vector backend as an exact FracVector.

This view is a genuine FracVector, so it can be passed anywhere a FracVector is accepted, and it exposes the full exact-rational algebra (det/inv/*/…). It is built lazily on first access — adopting a frac backend’s FracVector directly, otherwise converting from the backend’s exact fractions interchange — so the round-trip is exactness-preserving for the frac and native backends. (numpy values are binary rationals, so a numpy source round-trips to the exact float64 rational, not necessarily the original decimal fraction.)

Because inherited FracVector algebra builds its results with the low-level self.__class__._of(noms, denom) constructor, results built that way are plain (backend-less) FracVector values presented through this class.

Parameters:
property fractions_exact: bool

Return whether this view’s Fraction interchange is exact.

property noms: httk.core.vectors.fracvector.Noms

Return the materialized numerator data.

property denom: int

Return the materialized common denominator.

unwrap()

Return the underlying unwrapped vector, or this value when no backend remains.

unview()

Return a plain FracVector containing this view’s presented data.