All Projects → JuliaArrays → HybridArrays.jl

JuliaArrays / HybridArrays.jl

Licence: MIT license
Arrays with both statically and dynamically sized axes in Julia

Programming Languages

julia
2034 projects

Labels

Projects that are alternatives of or similar to HybridArrays.jl

interview-cookbook
A playground for learning DataStructures, Algorithms, and Object-Oriented Concepts.
Stars: ✭ 25 (-35.9%)
Mutual labels:  arrays
final-form-arrays
Array Mutators for 🏁 Final Form
Stars: ✭ 64 (+64.1%)
Mutual labels:  arrays
StarWarsArrays.jl
Arrays indexed as the order of Star Wars movies
Stars: ✭ 93 (+138.46%)
Mutual labels:  arrays
Algorithm-Implementation
This is our effort to collect the best implementations to tough algorithms. All codes are written in c++.
Stars: ✭ 16 (-58.97%)
Mutual labels:  arrays
arrays
Yii Array Helper
Stars: ✭ 41 (+5.13%)
Mutual labels:  arrays
UniqueVectors.jl
Vectors of unique elements, with quick reverse lookups
Stars: ✭ 20 (-48.72%)
Mutual labels:  arrays
Array Explorer
⚡️ A resource to help figure out what JavaScript array method would be best to use at any given time
Stars: ✭ 2,512 (+6341.03%)
Mutual labels:  arrays
InterviewBit
Collection of solution for problems on InterviewBit
Stars: ✭ 77 (+97.44%)
Mutual labels:  arrays
SoftUni-Software-Engineering
SoftUni- Software Engineering
Stars: ✭ 47 (+20.51%)
Mutual labels:  arrays
ArrayInterface.jl
Designs for new Base array interface primitives, used widely through scientific machine learning (SciML) and other organizations
Stars: ✭ 111 (+184.62%)
Mutual labels:  arrays
DSA--GeeksForGeeks
DSA course solutions in C++ Jump to below directly for more problems
Stars: ✭ 47 (+20.51%)
Mutual labels:  arrays
loops-e-arrays
Repositório do curso Estruturas de Repetição e Arrays com Java. Curso este oferecido pela Digital Innovation one e ministrado por mim.
Stars: ✭ 1,029 (+2538.46%)
Mutual labels:  arrays
php-collections
A collection library for php
Stars: ✭ 34 (-12.82%)
Mutual labels:  arrays
slice
A JavaScript implementation of Python's negative indexing and extended slice syntax.
Stars: ✭ 53 (+35.9%)
Mutual labels:  arrays
react-cool-form
😎 📋 React hooks for forms state and validation, less code more performant.
Stars: ✭ 246 (+530.77%)
Mutual labels:  arrays
algoexpert
AlgoExpert is an online platform that helps software engineers to prepare for coding and technical interviews.
Stars: ✭ 8 (-79.49%)
Mutual labels:  arrays
VBA-Better-Array
An array class for VBA providing features found in more modern languages
Stars: ✭ 77 (+97.44%)
Mutual labels:  arrays
spark-hats
Nested array transformation helper extensions for Apache Spark
Stars: ✭ 21 (-46.15%)
Mutual labels:  arrays
HashMapC
A tiny library for using easily HashMap, arraylist in the C.
Stars: ✭ 21 (-46.15%)
Mutual labels:  arrays
C-Complete-practice
This repository will contains C programs from beginners to advance level
Stars: ✭ 59 (+51.28%)
Mutual labels:  arrays
Status Coverage
CI codecov.io

HybridArrays.jl

Arrays with both statically and dynamically sized axes in Julia. This is a convenient replacement for the commonly used Arrayss of SArrays 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 Arrayss of SArrays while mutation of single elements is possible, as well as other operations on the wrapped array.

Views are statically sized where possible for fast and convenient mutation of HybridArrays.

Example:

julia> using HybridArrays, StaticArrays

julia> A = HybridArray{Tuple{2,2,StaticArrays.Dynamic()}}(randn(2,2,100));

julia> A[1,1,10] = 12
12

julia> A[:,:,10]
2×2 SArray{Tuple{2,2},Float64,2,4} with indices SOneTo(2)×SOneTo(2):
 12.0       -1.39943
 -0.450564  -0.140096

julia> A[2,:,:]
2×100 HybridArray{Tuple{2,StaticArrays.Dynamic()},Float64,2,2,Array{Float64,2}} with indices SOneTo(2)×Base.OneTo(100):
 -0.262977  1.40715  -0.110194-1.67315    2.30679   0.931161
 -0.432229  3.04082  -0.00971933     -0.905037  -0.446818  0.777833

julia> A[:,:,10] .*= 2
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):
 24.0       -2.79886
 -0.901128  -0.280193

julia> A[:,:,10] = SMatrix{2,2}(1:4)
2×2 SArray{Tuple{2,2},Int64,2,4} with indices SOneTo(2)×SOneTo(2):
 1  3
 2  4

HybridArrays.jl is implements (optionally loaded) ArrayInterface methods for compatibility with LoopVectorization.

Tips:

  • 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.
  • 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.

Code of this package is based on the code of the StaticArrays.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].