Skip to content

Commit 8943ca8

Browse files
authored
Readme update (#30)
* readme update * bump version
1 parent 40663ca commit 8943ca8

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "HybridArrays"
22
uuid = "1baab800-613f-4b0a-84e4-9cd3431bfbb9"
33
authors = ["Mateusz Baran <mateuszbaran89@gmail.com>"]
4-
version = "0.4.1"
4+
version = "0.4.2"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
@@ -10,7 +10,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
1010

1111
[compat]
1212
Requires = "1"
13-
StaticArrays = "=1.0.0"
13+
StaticArrays = "=1.0.1"
1414
julia = "1"
1515

1616
[extras]

README.md

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66

77
Arrays with both statically and dynamically sized axes in Julia. This is a convenient replacement for the commonly used `Arrays`s of `SArray`s which are fast but not easy to mutate. `HybridArray` makes this easier: any `AbstractArray` can be wrapped in a structure that specifies which axes are statically sized. Based on this information code for `getindex`, `setindex!` and broadcasting is (or should soon be, not all cases have been optimized yet) as efficient as for `Arrays`s of `SArray`s while mutation of single elements is possible, as well as other operations on the wrapped array.
88

9-
There are also statically sized views for fast and convenient mutation of `HybridArray`s.
9+
Views are statically sized where possible for fast and convenient mutation of `HybridArray`s.
1010

1111
Example:
12+
1213
```julia
1314
julia> using HybridArrays, StaticArrays
1415

@@ -19,26 +20,30 @@ julia> A[1,1,10] = 12
1920

2021
julia> A[:,:,10]
2122
2×2 SArray{Tuple{2,2},Float64,2,4} with indices SOneTo(2)×SOneTo(2):
22-
12.0 -0.264816
23-
0.615372 -1.00042
23+
12.0 -1.39943
24+
-0.450564 -0.140096
2425

2526
julia> A[2,:,:]
2627
2×100 HybridArray{Tuple{2,StaticArrays.Dynamic()},Float64,2,2,Array{Float64,2}} with indices SOneTo(2)×Base.OneTo(100):
27-
1.26017 -0.401046 1.46593 1.01009 0.862791 -0.0928537 -1.60457
28-
-1.00588 0.581524 0.639293 -0.445845 2.0826 -1.40952 0.166665
28+
-0.262977 1.40715 -0.110194 -1.67315 2.30679 0.931161
29+
-0.432229 3.04082 -0.00971933 -0.905037 -0.446818 0.777833
2930

3031
julia> A[:,:,10] .*= 2
31-
2×2 HybridArrays.SSubArray{Tuple{2,2},Float64,2,HybridArray{Tuple{2,2,StaticArrays.Dynamic()},Float64,3,3,Array{Float64,3}},Tuple{Base.Slice{SOneTo{2}},Base.Slice{SOneTo{2}},Int64},false} with indices SOneTo(2)×SOneTo(2):
32-
24.0 -0.529633
33-
1.23074 -2.00083
32+
2×2 SizedArray{Tuple{2,2},Float64,2,2,SubArray{Float64,2,HybridArray{Tuple{2,2,StaticArrays.Dynamic()},Float64,3,3,Array{Float64,3}},Tuple{Base.Slice{SOneTo{2}},Base.Slice{SOneTo{2}},Int64},true}} with indices SOneTo(2)×SOneTo(2):
33+
24.0 -2.79886
34+
-0.901128 -0.280193
3435

3536
julia> A[:,:,10] = SMatrix{2,2}(1:4)
3637
2×2 SArray{Tuple{2,2},Int64,2,4} with indices SOneTo(2)×SOneTo(2):
3738
1 3
3839
2 4
3940
```
4041

42+
`HybridArrays.jl` is implements (optionally loaded) [`ArrayInterface`](https://github.com/SciML/ArrayInterface.jl/) methods for compatibility with [`LoopVectorization`](https://github.com/chriselrod/LoopVectorization.jl).
43+
4144
Tips:
42-
- If possible, statically known dimensions should come first. This way the most common access pattern where indices of dynamic dimensions are specified will be faster.
4345

44-
Code of this package is based on the code of the [`StaticArrays`](https://github.com/JuliaArrays/StaticArrays.jl) package and the `SubArray` type from Julia base.
46+
- If possible, statically known dimensions should come first. This way the most common access pattern where indices of dynamic dimensions are specified will be faster.
47+
- Since version 0.4 of `HybridArrays`, Julia 1.5 or newer is required for best performance (most importantly the memory layout changes). It still works correctly on earlier versions of Julia but versions from the 0.3.x line may be faster in some cases on Julia <=1.4.
48+
49+
Code of this package is based on the code of the [`StaticArrays`](https://github.com/JuliaArrays/StaticArrays.jl).

0 commit comments

Comments
 (0)