Browse Source

Use a custom flag for NETSTANDARD support

build
Ignas Anikevicius 9 years ago
parent
commit
606e038a01
  1. 4
      src/Numerics/Compatibility.cs
  2. 2
      src/Numerics/Complex32.cs
  3. 6
      src/Numerics/ComplexExtensions.cs
  4. 2
      src/Numerics/Euclid.cs
  5. 12
      src/Numerics/Exceptions.cs
  6. 2
      src/Numerics/GlobalizationHelper.cs
  7. 2
      src/Numerics/LinearAlgebra/Matrix.BCL.cs
  8. 2
      src/Numerics/LinearAlgebra/Matrix.cs
  9. 8
      src/Numerics/LinearAlgebra/Solvers/SolverSetup.cs
  10. 2
      src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs
  11. 2
      src/Numerics/LinearAlgebra/Vector.BCL.cs
  12. 2
      src/Numerics/LinearAlgebra/Vector.cs
  13. 2
      src/Numerics/Numerics-2017.csproj
  14. 2
      src/Numerics/Properties/AssemblyInfo.cs
  15. 2
      src/Numerics/Properties/Resources.Designer.cs
  16. 8
      src/Numerics/Statistics/Histogram.cs
  17. 2
      src/Numerics/Threading/CommonParallel.cs

4
src/Numerics/Compatibility.cs

@ -1,4 +1,4 @@
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
namespace MathNet.Numerics namespace MathNet.Numerics
{ {
using System; using System;
@ -139,7 +139,7 @@ namespace MathNet.Numerics
} }
#endif #endif
#if (PORTABLE || NET35 || NETSTANDARD1_6) #if (PORTABLE || NET35 || NETSTANDARD)
namespace MathNet.Numerics namespace MathNet.Numerics
{ {
using System; using System;

2
src/Numerics/Complex32.cs

@ -1030,7 +1030,7 @@ namespace MathNet.Numerics
} }
} }
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
var value = GlobalizationHelper.ParseSingle(ref token); var value = GlobalizationHelper.ParseSingle(ref token);
#else #else
var value = GlobalizationHelper.ParseSingle(ref token, format.GetCultureInfo()); var value = GlobalizationHelper.ParseSingle(ref token, format.GetCultureInfo());

6
src/Numerics/ComplexExtensions.cs

@ -32,7 +32,7 @@ namespace MathNet.Numerics
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
using System.Runtime; using System.Runtime;
#endif #endif
@ -607,7 +607,7 @@ namespace MathNet.Numerics
} }
} }
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
var value = GlobalizationHelper.ParseDouble(ref token); var value = GlobalizationHelper.ParseDouble(ref token);
#else #else
var value = GlobalizationHelper.ParseDouble(ref token, format.GetCultureInfo()); var value = GlobalizationHelper.ParseDouble(ref token, format.GetCultureInfo());
@ -765,4 +765,4 @@ namespace MathNet.Numerics
return Complex32.TryParse(value, formatProvider, out result); return Complex32.TryParse(value, formatProvider, out result);
} }
} }
} }

2
src/Numerics/Euclid.cs

@ -430,7 +430,7 @@ namespace MathNet.Numerics
while (b != 0) while (b != 0)
{ {
long rem; long rem;
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
rem = a % b; rem = a % b;
var quot = a / b; var quot = a / b;
#else #else

12
src/Numerics/Exceptions.cs

@ -20,7 +20,7 @@ namespace MathNet.Numerics
public NonConvergenceException(string message, Exception innerException) : base(message, innerException) public NonConvergenceException(string message, Exception innerException) : base(message, innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected NonConvergenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected NonConvergenceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {
@ -48,7 +48,7 @@ namespace MathNet.Numerics
: base(message, innerException) : base(message, innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected NumericalBreakdownException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected NumericalBreakdownException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {
@ -75,7 +75,7 @@ namespace MathNet.Numerics
: base(message, innerException) : base(message, innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected NativeInterfaceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected NativeInterfaceException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {
@ -103,7 +103,7 @@ namespace MathNet.Numerics
: base(string.Format(Resources.InvalidParameterWithNumber, parameter), innerException) : base(string.Format(Resources.InvalidParameterWithNumber, parameter), innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected InvalidParameterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected InvalidParameterException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {
@ -126,7 +126,7 @@ namespace MathNet.Numerics
: base(Resources.MemoryAllocation, innerException) : base(Resources.MemoryAllocation, innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected MemoryAllocationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected MemoryAllocationException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {
@ -154,7 +154,7 @@ namespace MathNet.Numerics
: base(string.Format(Resources.SingularUMatrixWithElement, element), innerException) : base(string.Format(Resources.SingularUMatrixWithElement, element), innerException)
{ {
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
protected SingularUMatrixException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) protected SingularUMatrixException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
: base(info, context) : base(info, context)
{ {

2
src/Numerics/GlobalizationHelper.cs

@ -131,7 +131,7 @@ namespace MathNet.Numerics
} }
} }
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
/// <summary> /// <summary>
/// Globalized Parsing: Parse a double number /// Globalized Parsing: Parse a double number
/// </summary> /// </summary>

2
src/Numerics/LinearAlgebra/Matrix.BCL.cs

@ -77,7 +77,7 @@ namespace MathNet.Numerics.LinearAlgebra
return Storage.GetHashCode(); return Storage.GetHashCode();
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
/// <summary> /// <summary>
/// Creates a new object that is a copy of the current instance. /// Creates a new object that is a copy of the current instance.

2
src/Numerics/LinearAlgebra/Matrix.cs

@ -44,7 +44,7 @@ namespace MathNet.Numerics.LinearAlgebra
[Serializable] [Serializable]
public abstract partial class Matrix<T> : public abstract partial class Matrix<T> :
IFormattable, IEquatable<Matrix<T>> IFormattable, IEquatable<Matrix<T>>
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
, ICloneable , ICloneable
#endif #endif
where T : struct, IEquatable<T>, IFormattable where T : struct, IEquatable<T>, IFormattable

8
src/Numerics/LinearAlgebra/Solvers/SolverSetup.cs

@ -44,7 +44,7 @@ namespace MathNet.Numerics.LinearAlgebra.Solvers
/// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param> /// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param>
public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(Assembly assembly, bool ignoreFailed = true, params Type[] typesToExclude) public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(Assembly assembly, bool ignoreFailed = true, params Type[] typesToExclude)
{ {
#if NET45REFLECTION || NETSTANDARD1_6 #if NET45REFLECTION || NETSTANDARD
TypeInfo setupInterfaceType = typeof(IIterativeSolverSetup<T>).GetTypeInfo(); TypeInfo setupInterfaceType = typeof(IIterativeSolverSetup<T>).GetTypeInfo();
IEnumerable<Type> candidates = assembly.DefinedTypes IEnumerable<Type> candidates = assembly.DefinedTypes
.Where(typeInfo => !typeInfo.IsAbstract && !typeInfo.IsEnum && !typeInfo.IsInterface && typeInfo.IsVisible) .Where(typeInfo => !typeInfo.IsAbstract && !typeInfo.IsEnum && !typeInfo.IsInterface && typeInfo.IsVisible)
@ -73,7 +73,7 @@ namespace MathNet.Numerics.LinearAlgebra.Solvers
} }
} }
#if NET45REFLECTION || NETSTANDARD1_6 #if NET45REFLECTION || NETSTANDARD
var excludedTypes = new List<TypeInfo>(typesToExclude.Select(type => type.GetTypeInfo())); var excludedTypes = new List<TypeInfo>(typesToExclude.Select(type => type.GetTypeInfo()));
return setups return setups
.Where(s => !excludedTypes.Any(t => t.IsAssignableFrom(s.SolverType.GetTypeInfo()) || t.IsAssignableFrom(s.PreconditionerType.GetTypeInfo()))) .Where(s => !excludedTypes.Any(t => t.IsAssignableFrom(s.SolverType.GetTypeInfo()) || t.IsAssignableFrom(s.PreconditionerType.GetTypeInfo())))
@ -94,7 +94,7 @@ namespace MathNet.Numerics.LinearAlgebra.Solvers
/// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param> /// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param>
public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(Type typeInAssembly, bool ignoreFailed = true, params Type[] typesToExclude) public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(Type typeInAssembly, bool ignoreFailed = true, params Type[] typesToExclude)
{ {
#if NET45REFLECTION || NETSTANDARD1_6 #if NET45REFLECTION || NETSTANDARD
return LoadFromAssembly(typeInAssembly.GetTypeInfo().Assembly, ignoreFailed, typesToExclude); return LoadFromAssembly(typeInAssembly.GetTypeInfo().Assembly, ignoreFailed, typesToExclude);
#else #else
return LoadFromAssembly(typeInAssembly.Assembly, ignoreFailed, typesToExclude); return LoadFromAssembly(typeInAssembly.Assembly, ignoreFailed, typesToExclude);
@ -109,7 +109,7 @@ namespace MathNet.Numerics.LinearAlgebra.Solvers
/// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param> /// <param name="typesToExclude">The <see cref="IIterativeSolver{T}"/> types that should not be loaded.</param>
public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(AssemblyName assemblyName, bool ignoreFailed = true, params Type[] typesToExclude) public static IEnumerable<IIterativeSolverSetup<T>> LoadFromAssembly(AssemblyName assemblyName, bool ignoreFailed = true, params Type[] typesToExclude)
{ {
#if NET45REFLECTION || NETSTANDARD1_6 #if NET45REFLECTION || NETSTANDARD
return LoadFromAssembly(Assembly.Load(assemblyName), ignoreFailed, typesToExclude); return LoadFromAssembly(Assembly.Load(assemblyName), ignoreFailed, typesToExclude);
#else #else
return LoadFromAssembly(Assembly.Load(assemblyName.FullName), ignoreFailed, typesToExclude); return LoadFromAssembly(Assembly.Load(assemblyName.FullName), ignoreFailed, typesToExclude);

2
src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs

@ -115,7 +115,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
/// </summary> /// </summary>
void RowColumnAtIndex(int index, out int row, out int column) void RowColumnAtIndex(int index, out int row, out int column)
{ {
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
row = index % RowCount; row = index % RowCount;
column = index / RowCount; column = index / RowCount;
#else #else

2
src/Numerics/LinearAlgebra/Vector.BCL.cs

@ -77,7 +77,7 @@ namespace MathNet.Numerics.LinearAlgebra
return Storage.GetHashCode(); return Storage.GetHashCode();
} }
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
/// <summary> /// <summary>
/// Creates a new object that is a copy of the current instance. /// Creates a new object that is a copy of the current instance.

2
src/Numerics/LinearAlgebra/Vector.cs

@ -43,7 +43,7 @@ namespace MathNet.Numerics.LinearAlgebra
[Serializable] [Serializable]
public abstract partial class Vector<T> : public abstract partial class Vector<T> :
IFormattable, IEquatable<Vector<T>>, IList, IList<T> IFormattable, IEquatable<Vector<T>>, IList, IList<T>
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
, ICloneable , ICloneable
#endif #endif
where T : struct, IEquatable<T>, IFormattable where T : struct, IEquatable<T>, IFormattable

2
src/Numerics/Numerics-2017.csproj

@ -6,7 +6,7 @@
<PackageId>Math.Numerics</PackageId> <PackageId>Math.Numerics</PackageId>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.6'"> <PropertyGroup Condition="'$(TargetFramework)'=='netstandard1.6'">
<DefineConstants>NOSERIALIZATION</DefineConstants> <DefineConstants>NETSTANDARD</DefineConstants>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<OutputPath>..\..\out\test\Net35\</OutputPath> <OutputPath>..\..\out\test\Net35\</OutputPath>

2
src/Numerics/Properties/AssemblyInfo.cs

@ -49,7 +49,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyFileVersion("3.20.0.0")] [assembly: AssemblyFileVersion("3.20.0.0")]
[assembly: AssemblyInformationalVersion("3.20.0")] [assembly: AssemblyInformationalVersion("3.20.0")]
#if PORTABLE || NETSTANDARD1_6 #if PORTABLE || NETSTANDARD
[assembly: AssemblyTitle("Math.NET Numerics - Portable Edition")] [assembly: AssemblyTitle("Math.NET Numerics - Portable Edition")]
[assembly: InternalsVisibleTo("MathNet.Numerics.UnitTests")] [assembly: InternalsVisibleTo("MathNet.Numerics.UnitTests")]

2
src/Numerics/Properties/Resources.Designer.cs

@ -40,7 +40,7 @@ namespace MathNet.Numerics.Properties {
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
public static global::System.Resources.ResourceManager ResourceManager { public static global::System.Resources.ResourceManager ResourceManager {
get { get {
#if NET45REFLECTION || NETSTANDARD1_6 #if NET45REFLECTION || NETSTANDARD
if (object.ReferenceEquals(resourceMan, null)) if (object.ReferenceEquals(resourceMan, null))
{ {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathNet.Numerics.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MathNet.Numerics.Properties.Resources", typeof(Resources).GetTypeInfo().Assembly);

8
src/Numerics/Statistics/Histogram.cs

@ -47,11 +47,9 @@ namespace MathNet.Numerics.Statistics
/// </remarks> /// </remarks>
[Serializable] [Serializable]
[DataContract(Namespace = "urn:MathNet/Numerics")] [DataContract(Namespace = "urn:MathNet/Numerics")]
public class Bucket : public class Bucket : IComparable<Bucket>
#if PORTABLE || NETSTANDARD1_6 #if !(PORTABLE || NETSTANDARD)
IComparable<Bucket> , ICloneable
#else
IComparable<Bucket>, ICloneable
#endif #endif
{ {
/// <summary> /// <summary>

2
src/Numerics/Threading/CommonParallel.cs

@ -36,7 +36,7 @@ namespace MathNet.Numerics.Threading
#if NET35 #if NET35
using Partitioner = MathNet.Numerics.Partitioner; using Partitioner = MathNet.Numerics.Partitioner;
#endif #endif
#if !PORTABLE && !NETSTANDARD1_6 #if !PORTABLE && !NETSTANDARD
using System.Collections.Concurrent; using System.Collections.Concurrent;
#endif #endif

Loading…
Cancel
Save