LCOV - code coverage report
Current view: top level - src/convenience - maps.jl (source / functions) Hit Total Coverage
Test: on branch nothing Lines: 6 6 100.0 %
Date: 2025-07-10 13:12:25 Functions: 0 0 -

          Line data    Source code
       1             : module Maps
       2             : 
       3             : using StaticArrays
       4             : 
       5           2 : proj(indices::SVector{N, Int}) where {N} = x -> x[indices]
       6             : 
       7           2 : proj(indices::NTuple{N, Int}) where {N} = x -> x[SVector(indices...)]
       8             : 
       9           8 : proj(indices...) = x -> x[SVector(indices...)]
      10             : 
      11             : """
      12             :     xy = proj(1, 2)
      13             :     xy(@SVector [2.0, 3.0, 5.0]) # == SVector(2.0, 3.0)
      14             : 
      15             : Construct function `f(x)` that projects onto indexed elements of `x`.
      16             : 
      17             :     p = proj(SVector(i, j, ...))
      18             :     p = proj((i, j, ...))
      19             :     p = proj(i, j, ...)
      20             : 
      21             : For all
      22             : 
      23             :     p(x) == SVector(x[i], x[j], ...)
      24             : 
      25             : !!! note
      26             :     This method collects indices in `SVector`, and projections
      27             :     yield `SVector`s.
      28             : 
      29             : See also [`Π`](@ref)
      30             : """
      31             : proj
      32             : 
      33             : """
      34             : Synonym for [`proj`](@ref)
      35             : """
      36           5 : Π(args...) = proj(args...)
      37             : 
      38             : """
      39             : Synonym for `proj(1, 2, 3)`.
      40             : 
      41             : See also [`proj`](@ref)
      42             : """
      43           1 : xyz(arg) = SVector(arg[1], arg[2], arg[3])
      44             : 
      45             : """
      46             : Synonym for `proj(1, 2)`.
      47             : 
      48             : See also [`proj`](@ref)
      49             : """
      50           7 : xy(arg) = SVector(arg[1], arg[2])
      51             : 
      52             : end

Generated by: LCOV version 1.16