# Generic way to create repeating tiled views?

**URL:** <https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207>\
**Category:** Performance\
**Created:** [August 30, 2019, 11:37am UTC](https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207 "2019-08-30T11:37:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wsphillips](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wsphillips/32/6777_2.png) [@wsphillips](https://discourse.julialang.org/u/wsphillips)\
**Post date:** [August 30, 2019, 11:37am UTC](https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207/1 "2019-08-30T11:37:07Z")

</div>

LinearAlgebra implements Symmetric, which returns a mirrored view of the upper/lower triangle of a matrix.

If I wanted to do something more simple and generic, is it possible using `view()` or manipulation of `::SubArray` ?

For instance, if I have a 3x3 parent Array, could I generate a 2D subarray view of dimensions 9x9 that displays the parent array tiled 3 times vertical/horizontally?

Applying `repeat()` to a SubArray returns a collected version of the view (i.e. allocates), but it represents the type of transform I am thinking of. e.g. repeat(array, outer=(3,3)) =\> SubArray

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [August 30, 2019, 12:23pm UTC](https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207/2 "2019-08-30T12:23:35Z")

</div>

Here’s one way:

```julia
julia> mat = rand(1:20, 3,3)
3×3 Array{Int64,2}:
 5 19 4
 3 13 9
 2 12 13

julia> using LazyArrays, FillArrays

julia> Kron(Fill(1, 3,3), mat)
9×9 Kron{Int64,2,Tuple{Fill{Int64,2,Tuple{Base.OneTo{Int64},Base.OneTo{Int64}}},Array{Int64,2}}}:
 5 19 4 5 19 4 5 19 4
 3 13 9 3 13 9 3 13 9
 2 12 13 2 12 13 2 12 13
 ...

```
