In Julia
there are some subtypes of AbstractMatrix
, which are used as "lazy wrapper" objects for objects of type AbstractMatrix
. These inlcude Transpose, Adjoint, Symmetric, Hermitian, UpperTriangular, LowerTriangular, UnitUpperTriangular, UnitLowerTriangular
and maybe others.
The purpose of those objects is primarily to avoid unnecessary moving or reorganizing element data of the underlying matrices and instead give a different view to the parent data. The use of the wrappers can improve performance, if there are specialized algorithms, which implicitly make use of the reorganized data, as is the case for the BLAS
library or some methods for sparse matrices.
It is possible to construct arbitrary nestings of such wrapped objects. Two nested wrapped matrices may be different in a strict sense - i.e. they have different types - while the mathematical meaning is identical.
For example we have Transpose(UpperTriangular(A)) == LowerTriangular(Transpose(A))
.
Idea is to enable dispatch of Julia
methods depending not only on the type (including type parameters), but on special properties of argument types.
As we want to extend the method dispatching system, which is based on type hierarchies, the mentioned properties are expressed as function calls with the type as single argument. The return value of the function must be an abstract or concrete type by itself.
The syntax of the where clause is extended by allowing the type variable to be replaced by a function call to the variable. It may be restricted by upper - and lower bounds.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
```julia | |
using BenchmarkTools | |
julia> nx = [randpower(maxex = 20) for _ in 1:10^6]; | |
julia> D = stat_ulps(nx); | |
julia> overview(D) | |
1000000 |