Skip to content

Commit dd01296

Browse files
Fix typos (#315)
1 parent ac5e719 commit dd01296

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

docs/src/index.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Overview of StructArrays.jl
22

3-
This package introduces the type `StructArray` which is an `AbstractArray` whose elements are `struct` (for example `NamedTuples`, or `ComplexF64`, or a custom user defined `struct`). While a `StructArray` iterates `structs`, the layout uses separate arrays for each field of the `struct`. This is often called [Structure-Of-Arrays (SOA)](https://en.wikipedia.org/wiki/AoS_and_SoA); the concepts will be explained in greater detail below. `struct` entries of a StructArray are constructed on-the-fly. This contrasts with the "Array-Of-Structs" (AOS) layout where individual array elements are explicitly stored as `struct`s.
3+
This package introduces the type `StructArray` which is an `AbstractArray` whose elements are `struct` (for example `NamedTuple`s, or `ComplexF64`, or a custom user defined `struct`). While a `StructArray` iterates `struct`s, the layout uses separate arrays for each field of the `struct`. This is often called [Structure-Of-Arrays (SOA)](https://en.wikipedia.org/wiki/AoS_and_SoA); the concepts will be explained in greater detail below. `struct` entries of a `StructArray` are constructed on-the-fly. This contrasts with the "Array-Of-Structs" (AOS) layout where individual array elements are explicitly stored as `struct`s.
44

5-
`Base.getproperty` or the dot syntax can be used to access struct fields of element of a `StructArray`, whereas elements can be accessed with `getindex` (`[]`).
5+
`Base.getproperty` or the dot syntax can be used to access `struct` fields of element of a `StructArray`, whereas elements can be accessed with `getindex` (`[]`).
66

77
The package was largely inspired by the `Columns` type in [IndexedTables](https://github.com/JuliaComputing/IndexedTables.jl) which it now replaces.
88

99
## Collection and initialization
1010

11-
One can create a `StructArray` by providing the struct type and a tuple or NamedTuple of field arrays:
11+
One can create a `StructArray` by providing the `struct` type and a `Tuple` or `NamedTuple` of field arrays:
1212
```@repl intro
1313
using StructArrays
1414
struct Foo{T}
@@ -19,26 +19,26 @@ adata = [1 2; 3 4]; bdata = [10 20; 30 40];
1919
x = StructArray{Foo}((adata, bdata))
2020
```
2121

22-
You can also initialze a StructArray by passing in a NamedTuple, in which case the name (rather than the order) specifies how the input arrays are assigned to fields:
22+
You can also initialize a `StructArray` by passing in a `NamedTuple`, in which case the name (rather than the order) specifies how the input arrays are assigned to fields:
2323

2424
```@repl intro
25-
x = StructArray{Foo}((b = adata, a = bdata)) # initialize a with bdata and vice versa
25+
x = Array{Foo}((b = adata, a = bdata)) # initialize a with bdata and vice versa
2626
```
2727

28-
If a struct is not specified, a StructArray with Tuple or NamedTuple elements will be created:
28+
If a `struct` is not specified, a `StructArray` with `Tuple `or `NamedTuple` elements will be created:
2929
```@repl intro
3030
x = StructArray((adata, bdata))
3131
x = StructArray((a = adata, b = bdata))
3232
```
3333

34-
It's also possible to create a `StructArray` by choosing a particular dimension to interpret as the components of a struct:
34+
It's also possible to create a `StructArray` by choosing a particular dimension to interpret as the components of a `struct`:
3535

3636
```@repl intro
3737
x = StructArray{Complex{Int}}(adata; dims=1) # along dimension 1, the first item `re` and the second is `im`
3838
x = StructArray{Complex{Int}}(adata; dims=2) # along dimension 2, the first item `re` and the second is `im`
3939
```
4040

41-
One can also create a `StructArray` from an iterable of structs without creating an intermediate `Array`:
41+
One can also create a `StructArray` from an iterable of `struct`s without creating an intermediate `Array`:
4242

4343
```@repl intro
4444
StructArray(log(j+2.0*im) for j in 1:10)
@@ -58,7 +58,7 @@ julia> rand!(s)
5858
0.92407+0.929336im 0.267358+0.804478im
5959
```
6060

61-
Finally, it is possible to create a StructArray from an array-of-structs:
61+
Finally, it is possible to create a `StructArray` from an array-of-structs:
6262

6363
```jldoctest; setup=:(using StructArrays)
6464
julia> aos = [1+2im, 3+4im]
@@ -86,7 +86,7 @@ julia> soa.re
8686

8787
## Using custom array types
8888

89-
StructArrays supports using custom array types. It is always possible to pass field arrays of a custom type. The "custom array of structs to struct of custom arrays" transformation will use the `similar` method of the custom array type. This can be useful when working on the GPU for example:
89+
`StructArray`s supports using custom array types. It is always possible to pass field arrays of a custom type. The "custom array of `struct`s to `struct` of custom arrays" transformation will use the `similar` method of the custom array type. This can be useful when working on the GPU for example:
9090

9191
```julia
9292
julia> using StructArrays, CuArrays
@@ -140,7 +140,7 @@ julia> replace_storage(CuArray, s)
140140

141141
## Lazy row iteration
142142

143-
StructArrays also provides a `LazyRow` wrapper for lazy row iteration. `LazyRow(t, i)` does not materialize the i-th row but returns a lazy wrapper around it on which `getproperty` does the correct thing. This is useful when the row has many fields only some of which are necessary. It also allows changing columns in place.
143+
`StructArray`s also provides a `LazyRow` wrapper for lazy row iteration. `LazyRow(t, i)` does not materialize the i-th row but returns a lazy wrapper around it on which `getproperty` does the correct thing. This is useful when the row has many fields only some of which are necessary. It also allows changing columns in place.
144144

145145
```julia
146146
julia> t = StructArray((a = [1, 2], b = ["x", "y"]));

0 commit comments

Comments
 (0)