# Creating looping matrixes (Torus-like) with type inheritance

**URL:** <https://discourse.julialang.org/t/creating-looping-matrixes-torus-like-with-type-inheritance/135475>\
**Category:** General Usage\
**Tags:** type, inheritance, matrix\
**Created:** [February 5, 2026, 1:02pm UTC](https://discourse.julialang.org/t/creating-looping-matrixes-torus-like-with-type-inheritance/135475 "2026-02-05T13:02:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [February 5, 2026, 4:02pm UTC](https://discourse.julialang.org/t/creating-looping-matrixes-torus-like-with-type-inheritance/135475/3 "2026-02-05T16:02:23Z")

</div>

This type of thing has been discussed before, but I usually advocate “ghost cells” (periodic padding) rather than paying the price of wrapping indices on every array access. See e.g. [Arrays with periodic boundaries - #4 by stevengj](https://discourse.julialang.org/t/arrays-with-periodic-boundaries/4015/4)

---

_[View the full topic](https://discourse.julialang.org/t/creating-looping-matrixes-torus-like-with-type-inheritance/135475)._
