httk.core.vectors.mutablefracvector¶
A mutable, list-backed variant of FracVector.
Classes¶
Same as |
Module Contents¶
- class httk.core.vectors.mutablefracvector.MutableFracVector(noms: Any, denom: int = 1)[source]¶
Bases:
httk.core.vectors.fracvector.FracVectorSame as
FracVector, only this version allows assignment of elements, e.g.:mfracvec[2, 7] = 5
and, e.g.:
mfracvec[:, 7] = [1, 2, 3, 4]
Other than this, the FracVector methods exist and do the same, i.e., they return copies of the fracvector, rather than modifying it.
Methods with
set_*prefixes perform mutating operations, e.g.:A.set_T()
replaces A with its own transpose, whereas:
A.T()
just returns a new MutableFracVector that is the transpose of A, leaving A unmodified.
- nested_map: ClassVar[collections.abc.Callable[Ellipsis, Any]][source]¶
- nested_inmap: ClassVar[collections.abc.Callable[Ellipsis, Any]][source]¶
- nested_map_fractions: ClassVar[collections.abc.Callable[Ellipsis, Any]][source]¶
- classmethod use(old: Any) httk.core.vectors.fracvector.FracVector[source]¶
Make sure the variable is a MutableFracVector, and if not, convert it.
- to_FracVector() httk.core.vectors.fracvector.FracVector[source]¶
Return a FracVector with the values of this MutableFracVector.
- classmethod from_FracVector(other: httk.core.vectors.fracvector.FracVector) MutableFracVector[source]¶
Create a MutableFracVector from a FracVector.
- invalidate() None[source]¶
Internal method to call when the MutableFracVector is changed in such a way that cached properties are invalidated (e.g.,
_dim).
- set_negative() None[source]¶
Change the MutableFracVector inline into its own negative:
self -> -self.
- set_simplify() None[source]¶
Change the MutableFracVector; reduces any common factor between the denominator and all nominators.
- set_set_denominator(resolution: int = 1000000000) None[source]¶
Change the MutableFracVector; reduces resolution.
- Parameters:
resolution – the new denominator; each element becomes the closest numerical approximation using this denominator.