Theory¶
Arrays¶
In MOA everything is an array or operations on arrays. To help with discussion we will be using the following notation. More detailed
Constants are defined as a zero dimensional array \(\emptyset\) or \(< \;\; >\)
A vector \(\vccc123\) is a a one dimensional array.
A multidimensional array \(\aaccIcc1212\). Notice that brackets are used to designate a two dimensional array. We can build higher dimensional arrays by composing bracket and angled brackets together.
Warning
\(\accc123\) is NOT a vector it is an array of dimension two
Shape \(\rho\) rho¶
The shape of a multidimensional array is an important concept. It is similar to thinking of the shape in numpy. In moa the symbol for shape is \(\shape\) and it is a unary operator on arrays. Let’s look at the examples of arrays above and inspect their shapes.
Dimension \(delta\) delta¶
We skipped ahead of ourselves earlier when we talked about the dimensionality of an array. For example we said that \(\vccc123\) is a one dimensional array. How do we define this? Let us formally define the unary operation dimension \(\delta\).
Definition: \(\delta A = \rho ( \rho A )\)
The following definition can rigorously define dimensionality even though it may appear trivial. For example \(\delta \vccc123 = \rho ( \rho \vccc123 ) = \rho \vc3 = \vc1\).
Pi \(\pi\)¶
The following unary operation pi \(\pi\) only applies to vectors (otherwise known as arrays of dimension one). This operation will be needed for future derivations.
\(\pi \emptyset = 1\)
\(\pi \vcccc1234 = 24\)
Total \(\tau\) tau¶
It is from the following definition that we can define total \(tau\) which is the total number of elements in an array. Detailed description can be found on
Definition: \(\tau A = \pi ( \rho A )\)
Using this definition we develop the total number of elements in an array. For example \(\tau \vccc123 = \pi ( \shape \acccc1234 ) = \pi \vcc14 = 4\).
\(\dims \emptyset = \pi ( \shape \emptyset ) = \pi \vc0 = 0\)
\(\dims \avcc{}{} = \pi ( \shape \avcc{}{} ) = \pi \vccc120 = 0\)
Note
There are an infinite number of empty arrays. This concept may seem weird at first.