Browse Source

Providers: generic access to allow fully generic operators

provider
Christoph Ruegg 12 years ago
parent
commit
dc92821e4d
  1. 6
      src/Numerics/Control.cs
  2. 14
      src/Numerics/LinearAlgebra/Complex/Vector.cs
  3. 14
      src/Numerics/LinearAlgebra/Complex32/Vector.cs
  4. 14
      src/Numerics/LinearAlgebra/Double/Vector.cs
  5. 14
      src/Numerics/LinearAlgebra/Single/Vector.cs
  6. 5
      src/Numerics/LinearAlgebra/Vector.Arithmetic.cs

6
src/Numerics/Control.cs

@ -178,6 +178,12 @@ namespace MathNet.Numerics
}
}
internal static IExperimentalLinearAlgebraProvider<T> ExperimentalLinearAlgebraProviderFor<T>()
where T : struct, IEquatable<T>, IFormattable
{
return (IExperimentalLinearAlgebraProvider<T>)_experimentalLinearAlgebraProvider;
}
/// <summary>
/// Gets or sets a value indicating how many parallel worker threads shall be used
/// when parallelization is applicable.

14
src/Numerics/LinearAlgebra/Complex/Vector.cs

@ -80,20 +80,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex
}
}
/// <summary>
/// Adds another vector to this vector and stores the result into the result vector.
/// </summary>
/// <param name="other">
/// The vector to add to this one.
/// </param>
/// <param name="result">
/// The vector to store the result of the addition.
/// </param>
protected override sealed void DoAdd(Vector<Complex> other, Vector<Complex> result)
{
Control.ExperimentalLinearAlgebraProvider.AddVectors(Storage, other.Storage, result.Storage);
}
/// <summary>
/// Subtracts a scalar from each element of the vector and stores the result in the result vector.
/// </summary>

14
src/Numerics/LinearAlgebra/Complex32/Vector.cs

@ -75,20 +75,6 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32
}
}
/// <summary>
/// Adds another vector to this vector and stores the result into the result vector.
/// </summary>
/// <param name="other">
/// The vector to add to this one.
/// </param>
/// <param name="result">
/// The vector to store the result of the addition.
/// </param>
protected override sealed void DoAdd(Vector<Complex32> other, Vector<Complex32> result)
{
Control.ExperimentalLinearAlgebraProvider.AddVectors(Storage, other.Storage, result.Storage);
}
/// <summary>
/// Subtracts a scalar from each element of the vector and stores the result in the result vector.
/// </summary>

14
src/Numerics/LinearAlgebra/Double/Vector.cs

@ -73,20 +73,6 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
}
/// <summary>
/// Adds another vector to this vector and stores the result into the result vector.
/// </summary>
/// <param name="other">
/// The vector to add to this one.
/// </param>
/// <param name="result">
/// The vector to store the result of the addition.
/// </param>
protected override sealed void DoAdd(Vector<double> other, Vector<double> result)
{
Control.ExperimentalLinearAlgebraProvider.AddVectors(Storage, other.Storage, result.Storage);
}
/// <summary>
/// Subtracts a scalar from each element of the vector and stores the result in the result vector.
/// </summary>

14
src/Numerics/LinearAlgebra/Single/Vector.cs

@ -73,20 +73,6 @@ namespace MathNet.Numerics.LinearAlgebra.Single
}
}
/// <summary>
/// Adds another vector to this vector and stores the result into the result vector.
/// </summary>
/// <param name="other">
/// The vector to add to this one.
/// </param>
/// <param name="result">
/// The vector to store the result of the addition.
/// </param>
protected override sealed void DoAdd(Vector<float> other, Vector<float> result)
{
Control.ExperimentalLinearAlgebraProvider.AddVectors(Storage, other.Storage, result.Storage);
}
/// <summary>
/// Subtracts a scalar from each element of the vector and stores the result in the result vector.
/// </summary>

5
src/Numerics/LinearAlgebra/Vector.Arithmetic.cs

@ -69,7 +69,10 @@ namespace MathNet.Numerics.LinearAlgebra
/// </summary>
/// <param name="other">The vector to add to this one.</param>
/// <param name="result">The vector to store the result of the addition.</param>
protected abstract void DoAdd(Vector<T> other, Vector<T> result);
void DoAdd(Vector<T> other, Vector<T> result)
{
Control.ExperimentalLinearAlgebraProviderFor<T>().AddVectors(Storage, other.Storage, result.Storage);
}
/// <summary>
/// Subtracts a scalar from each element of the vector and stores the result in the result vector.

Loading…
Cancel
Save