Internals

Internals

AbstractStridedLayout

is an abstract type whose subtypes are returned by MemoryLayout(A) if an array A has storage laid out at regular offsets in memory, and which can therefore be passed to external C and Fortran functions expecting this memory layout.

Julia's internal linear algebra machinery will automatically (and invisibly) dispatch to BLAS and LAPACK routines if the memory layout is BLAS compatible and the element type is a Float32, Float64, ComplexF32, or ComplexF64. In this case, one must implement the strided array interface, which requires overrides of strides(A::MyMatrix) and unknown_convert(::Type{Ptr{T}}, A::MyMatrix).

source
LazyArrays.AddMethod.
Add(A1, A2, …, AN)

A lazy representation of A1 + A2 + … + AN; i.e., a shorthand for applied(+, A1, A2, …, AN).

source
BroadcastLayout(f, layouts)

is returned by MemoryLayout(A) if a matrix A is a BroadcastArray. f is a function that broadcast operation is applied and layouts is a tuple of MemoryLayout of the broadcasted arguments.

source
ColumnMajor()

is returned by MemoryLayout(A) if an array A has storage in memory as a column major array, so that stride(A,1) == 1 and stride(A,i) ≥ size(A,i-1) * stride(A,i-1) for 2 ≤ i ≤ ndims(A).

Arrays with ColumnMajor memory layout must conform to the DenseArray interface.

source
DecreasingStrides()

is returned by MemoryLayout(A) if an array A has storage in memory as a strided array with decreasing strides, so that stride(A,ndims(A)) ≥ 1 and stride(A,i) ≥ size(A,i+1) * stride(A,i+1)for1 ≤ i ≤ ndims(A)-1`.

source
DenseColumnMajor()

is returned by MemoryLayout(A) if an array A has storage in memory equivalent to an Array, so that stride(A,1) == 1 and stride(A,i) ≡ size(A,i-1) * stride(A,i-1) for 2 ≤ i ≤ ndims(A). In particular, if A is a matrix then strides(A) ==(1, size(A,1))`.

Arrays with DenseColumnMajor memory layout must conform to the DenseArray interface.

source
DenseRowMajor()

is returned by MemoryLayout(A) if an array A has storage in memory as a row major array with dense entries, so that stride(A,ndims(A)) == 1 and stride(A,i) ≡ size(A,i+1) * stride(A,i+1) for 1 ≤ i ≤ ndims(A)-1. In particular, if A is a matrix then strides(A) ==(size(A,2), 1)`.

source
HermitianLayout(layout, uplo)

is returned by MemoryLayout(A) if a matrix A has storage in memory as a hermitianized version of layout, where the entries used are dictated by the uplo, which can be 'U' or L'.

A matrix that has memory layout HermitianLayout(layout, uplo) must overrided hermitiandata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] == B[k,j] for j ≥ k if uplo == 'U' (j ≤ k if uplo == 'L') and A[k,j] == conj(B[j,k]) for j < k if uplo == 'U' (j > k if uplo == 'L').

source
IncreasingStrides()

is returned by MemoryLayout(A) if an array A has storage in memory as a strided array with increasing strides, so that stride(A,1) ≥ 1 and stride(A,i) ≥ size(A,i-1) * stride(A,i-1) for 2 ≤ i ≤ ndims(A).

source
LowerTriangularLayout(layout)

is returned by MemoryLayout(A) if a matrix A has storage in memory equivalent to a LowerTriangular(B) where B satisfies MemoryLayout(B) == layout.

A matrix that has memory layout LowerTriangularLayout(layout) must overrided triangulardata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] ≡ zero(eltype(A)) for j > k and A[k,j] ≡ B[k,j] for j ≤ k.

Moreover, transpose(A) and adjoint(A) must return a matrix that has memory layout UpperTriangularLayout.

source
MemoryLayout(A)

specifies the layout in memory for an array A. When you define a new AbstractArray type, you can choose to override MemoryLayout to indicate how an array is stored in memory. For example, if your matrix is column major with stride(A,2) == size(A,1), then override as follows:

MemoryLayout(::MyMatrix) = DenseColumnMajor()

The default is UnknownLayout() to indicate that the layout in memory is unknown.

Julia's internal linear algebra machinery will automatically (and invisibly) dispatch to BLAS and LAPACK routines if the memory layout is compatible.

source
RowMajor()

is returned by MemoryLayout(A) if an array A has storage in memory as a row major array, so that stride(A,ndims(A)) == 1 and stride(A,i) ≥ size(A,i+1) * stride(A,i+1)for1 ≤ i ≤ ndims(A)-1`.

If A is a matrix with RowMajor memory layout, then transpose(A) should return a matrix whose layout is ColumnMajor.

source
ScalarLayout()

is returned by MemoryLayout(A) if A is a scalar, which does not live in memory

source
StridedLayout()

is returned by MemoryLayout(A) if an array A has storage laid out at regular offsets in memory. Arrays with StridedLayout must conform to the DenseArray interface.

source
SymmetricLayout(layout, uplo)

is returned by MemoryLayout(A) if a matrix A has storage in memory as a symmetrized version of layout, where the entries used are dictated by the uplo, which can be 'U' or L'.

A matrix that has memory layout SymmetricLayout(layout, uplo) must overrided symmetricdata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] == B[k,j] for j ≥ k if uplo == 'U' (j ≤ k if uplo == 'L') and A[k,j] == B[j,k] for j < k if uplo == 'U' (j > k if uplo == 'L').

source
UnitLowerTriangularLayout(ML::MemoryLayout)

is returned by MemoryLayout(A) if a matrix A has storage in memory equivalent to a UnitLowerTriangular(B) where B satisfies MemoryLayout(B) == layout.

A matrix that has memory layout UnitLowerTriangularLayout(layout) must overrided triangulardata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] ≡ zero(eltype(A)) for j > k, A[k,j] ≡ one(eltype(A)) for j == k, A[k,j] ≡ B[k,j] for j < k.

Moreover, transpose(A) and adjoint(A) must return a matrix that has memory layout UnitUpperTriangularLayout.

source
UnitUpperTriangularLayout(ML::MemoryLayout)

is returned by MemoryLayout(A) if a matrix A has storage in memory equivalent to a UpperTriangularLayout(B) where B satisfies MemoryLayout(B) == ML.

A matrix that has memory layout UnitUpperTriangularLayout(layout) must overrided triangulardata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] ≡ B[k,j] for j > k, A[k,j] ≡ one(eltype(A)) for j == k, A[k,j] ≡ zero(eltype(A)) for j < k.

Moreover, transpose(A) and adjoint(A) must return a matrix that has memory layout UnitLowerTriangularLayout.

source
UnknownLayout()

is returned by MemoryLayout(A) if it is unknown how the entries of an array A are stored in memory.

source
UpperTriangularLayout(ML::MemoryLayout)

is returned by MemoryLayout(A) if a matrix A has storage in memory equivalent to a UpperTriangularLayout(B) where B satisfies MemoryLayout(B) == ML.

A matrix that has memory layout UpperTriangularLayout(layout) must overrided triangulardata(A) to return a matrix B such that MemoryLayout(B) == layout and A[k,j] ≡ B[k,j] for j ≥ k and A[k,j] ≡ zero(eltype(A)) for j < k.

Moreover, transpose(A) and adjoint(A) must return a matrix that has memory layout LowerTriangularLayout.

source

" colsupport(A, j)

gives an iterator containing the possible non-zero entries in the j-th column of A.

source

lmaterialize(M::Mul)

materializes arrays iteratively, left-to-right.

source

" rowsupport(A, k)

gives an iterator containing the possible non-zero entries in the k-th row of A.

source