Mesh

In Iverson notation, Mesh ($$\backslash{}a,u,b\backslash$$) is a three-argument operation which merges two equal-rank arguments according to a Boolean vector. The relationship between Mask and Mesh is similar to that between Compress and Expand. A related function also named Mesh is implemented in NARS2000 as a case of Compose:  combines   and   using an integer (not Boolean) control vector.

In Iverson notation
Mesh in Iverson notation combines or interleaves two arguments according to a Boolean control. The result has the same shape as the control array, and contains entries taken from the left argument when the control is 0 and from the right when it is 1.

A Programming Language defines the Mesh $$\backslash{}a,u,b\backslash$$ for vectors $$a$$ and $$b$$ and Boolean vector $$u$$, where $$+/\overline{u}=\nu(a)$$, and $$+/u=\nu(b)$$, to be the vector $$c$$ whose compressions by $$u$$ and its negation yield the other arguments: $$\overline{u}/c=a$$ and $$u/c=b$$. Conformability requirements give $$\nu(c)=\nu(u)$$; because $$\nu(u)=(+/\overline{u})+(+/u)$$ we have $$\nu(c)=\nu(a)+\nu(b)$$.

Mesh $$\backslash{}a,u,b\backslash$$ is a generalization of Catenate $$a\oplus b$$, since meshing with a suffix vector $$\backslash{}a,\omega^{\nu(b)},b\backslash$$ produces $$a\oplus b$$.

Iverson notes the following relationships between Mask, Mesh, Compress, and Expand: $$ \begin{align} /a,u,b/ &= \backslash{}\overline{u}/a,u,u/b\backslash \\ \backslash{}a,u,b\backslash &= /\overline{u}\backslash{}a,u,u\backslash{}b/ \end{align} $$

The following forms of Mesh with matrices are defined. Below, matrices are denoted with capital letters while vectors use lowercase letters.
 * $$\backslash{}A,u,B\backslash$$ meshes matrices along rows.
 * $$\backslash{}A,U,B\backslash$$, where $$+/U=\nu(A)+\nu(B)$$ in each component, meshes differently for each row.
 * $$\backslash{}a,U,b\backslash$$ meshes vectors in multiple ways, like the previous with repeated rows in $$A$$ and $$B$$.
 * $$\backslash\backslash{}A,u,B\backslash\backslash$$ meshes matrices along columns.
 * $$\backslash\backslash{}A,U,B\backslash\backslash$$, where $$+//U=\mu(A)+\mu(B)$$ in each component, meshes differently for each column.
 * $$\backslash\backslash{}a,U,b\backslash\backslash$$, meshes vectors differently in each column.

Documentation

 * NARS2000