Skip to content

Commit

Permalink
Small documentation fixes. Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmada committed Feb 17, 2024
1 parent ff1cfd2 commit 3891892
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/articles/Working-structured-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public readonly record struct MyVector2<T>(T X, T Y)
=> new(left.X + right.X, left.Y + right.Y);
}
```
However, `NetFabric` relies on `Vector<T>` for vectorization, which supports only primitive numeric types. This limitation prevents vectorization when using other types.
However, `NetFabric.Numerics.Tensors` relies on `Vector<T>` for vectorization, which supports only primitive numeric types. This limitation prevents vectorization when using other types.

It's worth mentioning that because `MyVector2<T>` consists of two fields of the same type and is always a value type, the contiguous storage in memory facilitates easy conversion from a span of `MyVector2<T>` to a span of `T` using `MemoryMarshal.Cast<MyVector2<T>, T>()`. This operation returns a span containing all the vector coordinates laid out contiguously. The `Apply()` and `Aggregate()` methods offer overloads that accommodate up to 4 elements of the same type.
It's worth mentioning that because `MyVector2<T>` consists of two fields of the same type and is always a value type, the contiguous storage in memory facilitates easy conversion from a span of `MyVector2<T>` to a span of `T` using `MemoryMarshal.Cast<MyVector2<T>, T>()`. This operation returns a span containing all the vector coordinates laid out contiguously. The `Apply()` and `Aggregate()` methods offer overloads that accommodate elements of up to 4 elements of the same type.

This capability facilitates the implementation of the `Sum` operation for a span of `MyVector2<T>`:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ static void Add_Should_Succeed<T>(int count)
{
// arrange
var x = new MyVector2<T>[count];
var y = new MyVector2<T>(T.CreateChecked(42), T.CreateChecked(24));
var y = (T.CreateChecked(42), T.CreateChecked(24));
var result = new MyVector2<T>[count];
var expected = new MyVector2<T>[count];
var random = new Random(42);
Expand Down

0 comments on commit 3891892

Please sign in to comment.