{"id":19093734,"url":"https://github.com/juliaarrays/fillarrays.jl","last_synced_at":"2026-05-25T19:30:21.319Z","repository":{"id":29866338,"uuid":"111399098","full_name":"JuliaArrays/FillArrays.jl","owner":"JuliaArrays","description":"Julia package for lazily representing matrices filled with a single entry","archived":false,"fork":false,"pushed_at":"2024-04-28T02:38:43.000Z","size":947,"stargazers_count":174,"open_issues_count":48,"forks_count":37,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-05-02T01:25:26.955Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://juliaarrays.github.io/FillArrays.jl/","language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JuliaArrays.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-20T11:02:13.000Z","updated_at":"2024-05-04T17:26:07.237Z","dependencies_parsed_at":"2023-02-14T06:45:20.838Z","dependency_job_id":"d0641d2d-a45d-4f89-801d-7cc3c116537d","html_url":"https://github.com/JuliaArrays/FillArrays.jl","commit_stats":{"total_commits":188,"total_committers":30,"mean_commits":6.266666666666667,"dds":0.473404255319149,"last_synced_commit":"4ad663d1a410cf179ea23c5c04abd28532db4595"},"previous_names":[],"tags_count":95,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FFillArrays.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FFillArrays.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FFillArrays.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JuliaArrays%2FFillArrays.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JuliaArrays","download_url":"https://codeload.github.com/JuliaArrays/FillArrays.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240142895,"owners_count":19754643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:25:52.512Z","updated_at":"2026-05-25T19:30:21.287Z","avatar_url":"https://github.com/JuliaArrays.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FillArrays.jl\n\n[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaArrays.github.io/FillArrays.jl/stable)\n[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://JuliaArrays.github.io/FillArrays.jl/dev)\n[![Build Status](https://github.com/JuliaArrays/FillArrays.jl/workflows/CI/badge.svg)](https://github.com/JuliaArrays/FillArrays.jl/actions)\n[![codecov](https://codecov.io/gh/JuliaArrays/FillArrays.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/JuliaArrays/FillArrays.jl)\n[![deps](https://juliahub.com/docs/FillArrays/deps.svg)](https://juliahub.com/ui/Packages/FillArrays/2Dg1l?t=2)\n[![version](https://juliahub.com/docs/FillArrays/version.svg)](https://juliahub.com/ui/Packages/FillArrays/2Dg1l)\n[![pkgeval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/F/FillArrays.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html)\n[![Aqua](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)\n\nJulia package to lazily represent matrices filled with a single entry,\nas well as identity matrices.  This package exports the following types:\n`Eye`, `Fill`, `Ones`, `Zeros`, `Trues`, `Falses`, and `OneElement`.\n\n\nThe primary purpose of this package is to present a unified way of constructing\nmatrices. \nFor example, to construct a 5-by-5 `BandedMatrix` of all zeros with bandwidths `(1,2)`, one would use  \n```julia\njulia\u003e BandedMatrix(Zeros(5,5), (1, 2))\n```\n\n## Usage\n\nHere are the matrix types:\n```julia\njulia\u003e Zeros(5, 6)\n5×6 Zeros{Float64}\n\njulia\u003e Zeros{Int}(2, 3)\n2×3 Zeros{Int64}\n\njulia\u003e Zeros(Int, 2, 3) # can also specify the type as an argument\n2×3 Zeros{Int64}\n\njulia\u003e Ones{Int}(5)\n5-element Ones{Int64}\n\njulia\u003e Eye{Int}(5)\n 5×5 Diagonal{Int64,Ones{Int64,1,Tuple{Base.OneTo{Int64}}}}:\n  1  ⋅  ⋅  ⋅  ⋅\n  ⋅  1  ⋅  ⋅  ⋅\n  ⋅  ⋅  1  ⋅  ⋅\n  ⋅  ⋅  ⋅  1  ⋅\n  ⋅  ⋅  ⋅  ⋅  1\n\njulia\u003e Fill(7.0f0, 3, 2)\n3×2 Fill{Float32}: entries equal to 7.0\n\njulia\u003e Trues(2, 3)\n2×3 Ones{Bool}\n\njulia\u003e Falses(2)\n2-element Zeros{Bool}\n\njulia\u003e OneElement(3.0, (2,1), (5,6))\n5×6 OneElement{Float64, 2, Tuple{Int64, Int64}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}:\n  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ \n 3.0   ⋅    ⋅    ⋅    ⋅    ⋅ \n  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ \n  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ \n  ⋅    ⋅    ⋅    ⋅    ⋅    ⋅ \n```\n\nThey support conversion to other matrix types like `Array`, `SparseVector`, `SparseMatrix`, and `Diagonal`:\n```julia\njulia\u003e Matrix(Zeros(5, 5))\n5×5 Array{Float64,2}:\n 0.0  0.0  0.0  0.0  0.0\n 0.0  0.0  0.0  0.0  0.0\n 0.0  0.0  0.0  0.0  0.0\n 0.0  0.0  0.0  0.0  0.0\n 0.0  0.0  0.0  0.0  0.0\n\njulia\u003e SparseMatrixCSC(Zeros(5, 5))\n5×5 SparseMatrixCSC{Float64,Int64} with 0 stored entries\n\njulia\u003e Array(Fill(7, (2,3)))\n2×3 Array{Int64,2}:\n 7  7  7\n 7  7  7\n```\n\nThere is also support for offset index ranges,\nand the type includes the `axes`:\n```julia\njulia\u003e Ones((-3:2, 1:2))\n6×2 Ones{Float64,2,Tuple{UnitRange{Int64},UnitRange{Int64}}} with indices -3:2×1:2\n\njulia\u003e Fill(7, ((0:2), (-1:0)))\n3×2 Fill{Int64,2,Tuple{UnitRange{Int64},UnitRange{Int64}}} with indices 0:2×-1:0: entries equal to 7\n\njulia\u003e typeof(Zeros(5,6))\nZeros{Float64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}}\n```\n\nThese types have methods that perform many operations efficiently,\nincluding elementary algebra operations like multiplication and addition,\nas well as linear algebra methods like\n`norm`, `adjoint`, `transpose` and `vec`.\n\n## Warning!\n\nBroadcasting operations and `map`, `mapreduce` are also done efficiently, by evaluating the function being applied only once:\n\n```julia\njulia\u003e map(sqrt, Fill(4, 2,5))  # one evaluation, not 10, to save time\n2×5 Fill{Float64}: entries equal to 2.0\n\njulia\u003e println.(Fill(pi, 10))\nπ\n10-element Fill{Nothing}: entries equal to nothing\n```\n\nNotice that this will only match the behaviour of a dense matrix from `fill` if the function is pure. And that this shortcut is taken *before* any other fused broadcast:\n\n```julia\njulia\u003e map(_ -\u003e rand(), Fill(\"pi\", 2,5))  # not a pure function!\n2×5 Fill{Float64}: entries equal to 0.7201617100284206\n\njulia\u003e map(_ -\u003e rand(), fill(\"4\", 2,5))  # 10 evaluations, different answer!\n2×5 Matrix{Float64}:\n 0.43675   0.270809  0.56536   0.0948089  0.24655\n 0.959363  0.79598   0.238662  0.401909   0.317716\n\njulia\u003e ones(1,5) .+ (_ -\u003e rand()).(Fill(\"vec\", 2))  # Fill broadcast is done first\n2×5 Matrix{Float64}:\n 1.51796  1.51796  1.51796  1.51796  1.51796\n 1.51796  1.51796  1.51796  1.51796  1.51796\n\njulia\u003e ones(1,5) .+ (_ -\u003e rand()).(fill(\"vec\", 2))  # fused, 10 evaluations\n2×5 Matrix{Float64}:\n 1.51337  1.17578  1.19815  1.43035  1.2987\n 1.30253  1.21909  1.61755  1.02645  1.77681\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaarrays%2Ffillarrays.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliaarrays%2Ffillarrays.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliaarrays%2Ffillarrays.jl/lists"}