Skip to content

Commit bdcb2c5

Browse files
committed
Change PrimitiveDataFrameColumnComputations to use Generic Math
1 parent ff3b1b9 commit bdcb2c5

10 files changed

+401
-5927
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
4+
5+
using System.Runtime.Versioning;
6+
7+
[assembly: RequiresPreviewFeatures]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+

2+
3+
// Licensed to the .NET Foundation under one or more agreements.
4+
// The .NET Foundation licenses this file to you under the MIT license.
5+
// See the LICENSE file in the project root for more information.
6+
7+
// Generated from PrimitiveColumnComputations.tt. Do not modify directly
8+
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Runtime.Versioning;
12+
13+
namespace Microsoft.Data.Analysis
14+
{
15+
[RequiresPreviewFeatures]
16+
internal class DecimalMathComputation : NumberMathComputation<decimal>
17+
{
18+
public override void Round(PrimitiveColumnContainer<decimal> column)
19+
{
20+
Apply(column, decimal.Round);
21+
}
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+

2+
3+
// Licensed to the .NET Foundation under one or more agreements.
4+
// The .NET Foundation licenses this file to you under the MIT license.
5+
// See the LICENSE file in the project root for more information.
6+
7+
// Generated from PrimitiveColumnComputations.tt. Do not modify directly
8+
9+
using System;
10+
using System.Collections.Generic;
11+
using System.Runtime.Versioning;
12+
13+
namespace Microsoft.Data.Analysis
14+
{
15+
[RequiresPreviewFeatures]
16+
internal class FloatingPointMathComputation<T> : NumberMathComputation<T>
17+
where T : unmanaged, INumber<T>, IFloatingPoint<T>
18+
{
19+
public override void Round(PrimitiveColumnContainer<T> column)
20+
{
21+
Apply(column, T.Round);
22+
}
23+
}
24+
}

src/Microsoft.Data.Analysis/Microsoft.Data.Analysis.csproj

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<Import Project="$(RepoRoot)eng/pkg/Pack.props" />
33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<EnablePreviewFeatures>True</EnablePreviewFeatures>
56
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
67
<SuppressFinalPackageVersion>false</SuppressFinalPackageVersion>
78
<Description>This package contains easy-to-use and high-performance libraries for data analysis and transformation.</Description>
89
<PackageReleaseNotes>Initial preview of robust and extensible types and algorithms for manipulating structured data that supports aggregations, statistical funtions, sorting, grouping, joins, merges, handling missing values and more. </PackageReleaseNotes>
910
<PackageTags>ML.NET ML Machine Learning Data Science DataFrame Preparation DataView Analytics Exploration</PackageTags>
1011
<GenerateDocumentationFile>true</GenerateDocumentationFile>
12+
13+
1114
<!--
1215
1591: Documentation warnings
1316
NU5100: Warning that gets triggered because a .dll is not placed under lib folder on package. This is by design as we want MDAI to be under interactive-extensions folder.
@@ -47,6 +50,7 @@
4750
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
4851
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="$(SystemRuntimeCompilerServicesUnsafeVersion)" />
4952
<PackageReference Include="System.Buffers" Version="$(SystemBuffersVersion)" />
53+
<PackageReference Include="System.Runtime.Experimental" Version="6.0.2" />
5054
</ItemGroup>
5155

5256
<ItemGroup>
@@ -119,10 +123,6 @@
119123
<Generator>TextTemplatingFileGenerator</Generator>
120124
<LastGenOutput>PrimitiveColumnArithmetic.cs</LastGenOutput>
121125
</None>
122-
<None Update="PrimitiveDataFrameColumnComputations.tt">
123-
<Generator>TextTemplatingFileGenerator</Generator>
124-
<LastGenOutput>PrimitiveDataFrameColumnComputations.cs</LastGenOutput>
125-
</None>
126126
<None Update="PrimitiveColumnContainer.BinaryOperations.tt">
127127
<Generator>TextTemplatingFileGenerator</Generator>
128128
<LastGenOutput>PrimitiveColumnContainer.BinaryOperations.cs</LastGenOutput>
@@ -212,11 +212,6 @@
212212
<AutoGen>True</AutoGen>
213213
<DependentUpon>PrimitiveColumnArithmetic.tt</DependentUpon>
214214
</Compile>
215-
<Compile Update="PrimitiveDataFrameColumnComputations.cs">
216-
<DesignTime>True</DesignTime>
217-
<AutoGen>True</AutoGen>
218-
<DependentUpon>PrimitiveDataFrameColumnComputations.tt</DependentUpon>
219-
</Compile>
220215
<Compile Update="PrimitiveColumnContainer.BinaryOperations.cs">
221216
<DesignTime>True</DesignTime>
222217
<AutoGen>True</AutoGen>

0 commit comments

Comments
 (0)