Skip to content

Releases: emmt/TypeUtils.jl

v1.14.0

06 Jan 15:06

Choose a tag to compare

TypeUtils v1.14.0

Diff since v1.13.0

This new minor version essentially provides lazymap (see below).

Added

  • B = lazymap([T::Type,], f, A[, f_inv]) yields an object B that lazily maps function f to array or iterator A. Optional argument T is the element-type of B which is automatically inferred if not specified. If A is an (abstract) array, f_inv may be provided to specify the inverse of f. Related type alias LazyMap{T,N,F,typeof(A)} can be used to specialize on the type B with N = ndims(A) and F = typeof(f).

Change

  • The former function as_eltype(T,A) is now a shortcut for lazymap(T,identity,A) unless T == eltype(A) holds in which case A is returned.

  • Private type TypeUtils.AsEltype (formerly used by as_eltytpe) no longer exists.

v1.13.0

19 Dec 15:24

Choose a tag to compare

TypeUtils v1.13.0

Diff since v1.12.0

Added

  • units_of(x) and units_of(typeof(x)) yield the units of the number x. The units are a trait which only depends on the type of the argument. This function is a replacement for Unitful.unit when this package is not yet loaded.

Merged pull requests:

v1.12.0

21 Oct 06:44

Choose a tag to compare

TypeUtils v1.12.0

Diff since v1.11.0

Fixed

  • get_precision on n-tuples yields a correct result and is inferable.

Added

  • get_precision() yields AbtractFloat instead of throwing a MethodError.

v1.11.0

16 Oct 15:08

Choose a tag to compare

TypeUtils v1.11.0

Diff since v1.10.0

Fixed

  • Fix tests for Julia 1.12 and above.

  • Syntax @public a, b, c is allowed.

Merged pull requests:

v1.10.0

25 Jul 10:59

Choose a tag to compare

TypeUtils v1.10.0

Diff since v1.9.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

20 Jun 06:57

Choose a tag to compare

TypeUtils v1.9.0

Diff since v1.8.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 of x.

  • adapt_precision(T, x) yields a version of x with numerical precision T.

  • destructure(Vector, x) and destructure(Vector{T}, x) yield a vector while destructure(Tuple, x) yields a tuple as destructure(x).

v1.8.0

19 Jun 03:54

Choose a tag to compare

TypeUtils v1.8.0

Diff since v1.7.1

Added

  • convert_eltype(T,A) for A an instance of LinearAgebra.Factorization.

  • Tests with Aqua.jl.

Fixed

  • A few minor things detected by Aqua.jl have been fixed.

  • Better rule for element type conversion of AbstractUnitRange instances.

  • Fix specialization of Base.return_types which shall return a vector of types.

v1.7.1

19 May 22:06

Choose a tag to compare

TypeUtils v1.7.1

Diff since v1.7.0

Fixed

  • is_signed(x) is false if x is a complex number with unsigned rational parts.

v1.7.0

13 May 14:39

Choose a tag to compare

TypeUtils v1.7.0

Diff since v1.6.0

  • New is_signed method to infer whether a value of a given numeric type can be negated while retaining the same type.
  • Extend similar for the type of arrays returned by as_eltype.

v1.6.0

15 Apr 11:04

Choose a tag to compare

TypeUtils v1.6.0

Diff since v1.5.1

Added

  • Macro @assert_floating_point to assert whether arguments or variables of a function do use floating-point for storing their value(s).

  • New function assert_floating_point to 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

  • @public can take macro names (prefixed by @) as argument.