Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Integrating StaticArrays(Documentation) #6

@shivin9

Description

@shivin9

We decided to implement stencil_coefs of the PDEOperator as a StaticVector as they are stored on stack rather than on the heap and are hence fast.

But for optimum performance they need to be initialized with both Type and Length like SVector{Length, Type} which made the constructor for LinearOperator look ugly. A = LinearOperator{Float64, SVector{1000, Float64}} for an operator working on 1000 dimensional vectors.

So we fixed it by creating an internal constructor

    (::Type{LinearOperator{T}}){T<:Real}(dorder::Int, aorder::Int, dim::Int) =
    LinearOperator{T, SVector{dorder+aorder-1,T}}(dorder, aorder, dim)

which decides the length of the SVector at runtime using the given input parameters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions