Releases: emmt/TypeUtils.jl
v1.14.0
TypeUtils v1.14.0
This new minor version essentially provides lazymap (see below).
Added
B = lazymap([T::Type,], f, A[, f_inv])yields an objectBthat lazily maps functionfto array or iteratorA. Optional argumentTis the element-type ofBwhich is automatically inferred if not specified. IfAis an (abstract) array,f_invmay be provided to specify the inverse off. Related type aliasLazyMap{T,N,F,typeof(A)}can be used to specialize on the typeBwithN = ndims(A)andF = typeof(f).
Change
-
The former function
as_eltype(T,A)is now a shortcut forlazymap(T,identity,A)unlessT == eltype(A)holds in which caseAis returned. -
Private type
TypeUtils.AsEltype(formerly used byas_eltytpe) no longer exists.
v1.13.0
TypeUtils v1.13.0
Added
units_of(x)andunits_of(typeof(x))yield the units of the numberx. The units are a trait which only depends on the type of the argument. This function is a replacement forUnitful.unitwhen this package is not yet loaded.
Merged pull requests:
- Bump actions/checkout from 5 to 6 (#4) (@dependabot[bot])
v1.12.0
TypeUtils v1.12.0
Fixed
get_precisionon n-tuples yields a correct result and is inferable.
Added
get_precision()yieldsAbtractFloatinstead of throwing aMethodError.
v1.11.0
TypeUtils v1.11.0
Fixed
-
Fix tests for Julia 1.12 and above.
-
Syntax
@public a, b, cis allowed.
Merged pull requests:
- Bump actions/checkout from 4 to 5 (#3) (@dependabot[bot])
v1.10.0
TypeUtils v1.10.0
Added
-
With multiple arguments,
get_precision(x, y...)yields the best precision of all the given arguments. -
nearest(T, x)can deal with dimensionful numbers and types.
v1.9.0
TypeUtils v1.9.0
This new minor version adds methods to deal with the numerical precision of numbers and objects.
Added
-
get_precision(x)yields the numerical precision ofx. -
adapt_precision(T, x)yields a version ofxwith numerical precisionT. -
destructure(Vector, x)anddestructure(Vector{T}, x)yield a vector whiledestructure(Tuple, x)yields a tuple asdestructure(x).
v1.8.0
TypeUtils v1.8.0
Added
-
convert_eltype(T,A)forAan instance ofLinearAgebra.Factorization. -
Tests with
Aqua.jl.
Fixed
-
A few minor things detected by
Aqua.jlhave been fixed. -
Better rule for element type conversion of
AbstractUnitRangeinstances. -
Fix specialization of
Base.return_typeswhich shall return a vector of types.
v1.7.1
TypeUtils v1.7.1
Fixed
is_signed(x)is false ifxis a complex number with unsigned rational parts.
v1.7.0
TypeUtils v1.7.0
- New
is_signedmethod to infer whether a value of a given numeric type can be negated while retaining the same type. - Extend
similarfor the type of arrays returned byas_eltype.
v1.6.0
TypeUtils v1.6.0
Added
-
Macro
@assert_floating_pointto assert whether arguments or variables of a function do use floating-point for storing their value(s). -
New function
assert_floating_pointto assert whether an object does use floating-point for storing its value(s). This method is a trait: its result only depend on the type of its argument and this type may be directly specified.
Fixed
@publiccan take macro names (prefixed by@) as argument.