Skip to content

Commit

Permalink
Docs for Scalar
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Ferris committed Oct 12, 2016
1 parent df69c1f commit 5d7026c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,18 @@ easier to define the types without the extra tuple characters (compare
because it is so easy to define new `StaticArray` subtypes, and they naturally
work together.

### `Scalar`

Sometimes you want broadcast an operations, but not over one of your inputs.
A classic example is attempting to displace a collection of vectors by the
same vector. We can now do this with the `Scalar` type:

```julia
[[1,2,3], [4,5,6]] .+ Scalar([1,0,-1]) # [[2,2,2], [5,5,5]]
```

`Scalar` is simply an implementation of an immutable, 0-dimensional `StaticArray`.

### Mutable arrays: `MVector`, `MMatrix` and `MArray`

These statically sized arrays are identical to the above, but are defined as
Expand Down

0 comments on commit 5d7026c

Please sign in to comment.