# Broadcasting across a nested array

**URL:** https://discourse.julialang.org/t/broadcasting-across-a-nested-array/21700
**Category:** General Usage
**Tags:** broadcasting
**Created:** [March 10, 2019, 12:21pm UTC](https://discourse.julialang.org/t/broadcasting-across-a-nested-array/21700 "2019-03-10T12:21:48Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [March 11, 2019, 1:19pm UTC](https://discourse.julialang.org/t/broadcasting-across-a-nested-array/21700/8 "2019-03-11T13:19:39Z")

</div>

The key to understanding Julia’s design choice is that _neither arithmetic operators nor number types get “special treatment”_:

1. `*` is just an operator like any other. It is usually defined for rings, ie objects for which some notion of multiplication (commutative or non-commutative) makes sense. This includes real and complex numbers, `ForwardDiff.Dual` numbers, matrices, strings… the list is literally endless since you can always define new methods.

2. Subtypes of `<:Number` or `<:AbstractMatrix` are types like any other. So if you prefer, you can write completely generic code, eg for a power calculation by doubling, without knowing which type you are dealing with — it is enough to know that `*` is supported.

The broadcasting machinery is designed to take care of your use case. At the moment, you have to use something like the solution by @ffevotte, which may look cumbersome but has the advantage of being transparent and consistent with the language.

Other design choices, eg like R’s, are certainly possible, but they break the generic interfaces which are highly valued by experienced Julia users.

---

_[View the full topic](https://discourse.julialang.org/t/broadcasting-across-a-nested-array/21700)._
