Skip to content

Commit

Permalink
Release 3.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aalmada committed Mar 21, 2024
1 parent 5a6f639 commit da06ace
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 19 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,25 @@ For variables `x`, `y`, and `result`, all of type `Span<float>` and of the same
Tensor.Add(x, y, result);
```

Beyond per element operations, the library extends support to aggregations. For a `values` variable of type `Span<float>`, the following code snippet calculates the sum, the minimum and the minimum magnitude of all its elements:
In addition to per-element operations, the library also supports various aggregation operations, including:

```csharp
var sum = Tensor.Sum(values);
var min = Tensor.Min(values);
var minMagnitude = Tensor.MinMagnitude(values);
var sum = TensorOperations.Sum(values);
var average = TensorOperations.Average(values);
var product = TensorOperations.Product(values);
var min = TensorOperations.Min(values);
var max = TensorOperations.Max(values);
var (min, max) = TensorOperations.MinMax(values);
```

The library offers functionality to retrieve the index of the first element meeting a specific condition:

```csharp
var indexOfEqual = IndexOfEquals(values, 0);
var indexOfGreaterThan = IndexOfGreaterThan(values, 0);
var indexOfGreaterThanOrEqual = IndexOfGreaterThanOrEqual(values, 0);
var indexOfLessThan = IndexOfLessThan(values, 0);
var indexOfLessThanOrEqual = IndexOfLessThanOrEqual(values, 0);
```

### Custom Operations
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/Getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var average = TensorOperations.Average(values);
var product = TensorOperations.Product(values);
var min = TensorOperations.Min(values);
var max = TensorOperations.Max(values);
(var min, var max) = TensorOperations.MinMax(values);
var (min, max) = TensorOperations.MinMax(values);
```

The library offers functionality to retrieve the index of the first element meeting a specific condition:
Expand Down
18 changes: 6 additions & 12 deletions src/NetFabric.Numerics.Tensors/NetFabric.Numerics.Tensors.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,18 @@
This library, based on .NET generic math, provides methods for performing mathematical operations over spans of value types.
These operations can be accelerated using SIMD operations supported by the CPU where available.
</Description>
<Version>3.0.0</Version>
<Version>3.1.0</Version>
<PackageIcon>Icon.png</PackageIcon>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>math, performance, intrinsics, simd, span</PackageTags>
<PackageProjectUrl>https://netfabric.github.io/NetFabric.Numerics.Tensors/</PackageProjectUrl>
<PackageReleaseNotes>
- Changed the namespace to NetFabric.Numerics.Tensors.
- Refactoring of the IAggregationOperation interface.
- Added support for transform operation on Aggregate.
- Added AggreagatePropagateNaN.
- Renamed IGenericBinaryOperation to IBinaryScalarOperation and ApplyGeneric to ApplyScalar.
- Fixed Min and Max behavior.
- Added SinCos operations returning the result in two separate spans.
- Added operations: MinMagnitude, MaxMagnitude, and Sigmoid.
- Added aggregation operations: Sum, Product, Min, Max, and MinMax.
- Vectorized Aggregate2D, Aggregate3D, and Aggregate4D.
- Vectorized operators: ScaleB.
- Improved performance of Aggregate2D, Aggregate3D, and Aggregate4D.
- Made the operators public.
- Added interfaces IUnaryToScalarOperator, IBinaryToScalarOperator, and ITernaryToScalarOperator.
- Added IndexOfPredicate method.
- Added operations: IndexOfEquals, IndexOfGreaterThan, IndexOfGreaterThanOrEqual, IndexOfLessThan, and IndexOfLessThanOrEqual.
</PackageReleaseNotes>
<RootNamespace>NetFabric.Numerics.Tensors</RootNamespace>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
14 changes: 12 additions & 2 deletions src/NetFabric.Numerics.Tensors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,25 @@ Given variables `x`, `y`, and `result`, all of type `Span<float>` and of the sam
TensorOperations.Add(x, y, result);
```

Beyond per element operations, the library extends support to aggregations. For a `values` variable of type `Span<float>`, the following code snippet calculates the sum, the minimum and the minimum magnitude of all its elements:
In addition to per-element operations, the library also supports various aggregation operations, including:

```csharp
var sum = TensorOperations.Sum(values);
var average = TensorOperations.Average(values);
var product = TensorOperations.Product(values);
var min = TensorOperations.Min(values);
var max = TensorOperations.Max(values);
(var min, var max) = TensorOperations.MinMax(values);
var (min, max) = TensorOperations.MinMax(values);
```

The library offers functionality to retrieve the index of the first element meeting a specific condition:

```csharp
var indexOfEqual = IndexOfEquals(values, 0);
var indexOfGreaterThan = IndexOfGreaterThan(values, 0);
var indexOfGreaterThanOrEqual = IndexOfGreaterThanOrEqual(values, 0);
var indexOfLessThan = IndexOfLessThan(values, 0);
var indexOfLessThanOrEqual = IndexOfLessThanOrEqual(values, 0);
```

Please consult the [documentation](https://netfabric.github.io/NetFabric.Numerics.Tensors/api/NetFabric.Numerics.TensorOperations.html) to get the complete list of pre-defined operations.
Expand Down

0 comments on commit da06ace

Please sign in to comment.