Browse Source

tweaked vector scale routines

la-knuth
Marcus Cuda 16 years ago
parent
commit
b4c8440e57
  1. 6
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs
  2. 6
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs
  3. 6
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs
  4. 6
      src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs

6
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs

@ -67,7 +67,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha.IsZero()) if (alpha.IsZero())
{ {
CommonParallel.ElementFor(0, y.Length, y.Length, index => result[index] = y[index]); Array.Copy(y, result, y.Length);
} }
else if (alpha.IsOne()) else if (alpha.IsOne())
{ {
@ -95,11 +95,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha.IsZero()) if (alpha.IsZero())
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = Complex.Zero); Array.Clear(result, 0, result.Length);
} }
else if (alpha.IsOne()) else if (alpha.IsOne())
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = x[index]); Array.Copy(x, result, x.Length);
} }
else else
{ {

6
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs

@ -61,7 +61,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha.IsZero()) if (alpha.IsZero())
{ {
CommonParallel.ElementFor(0, y.Length, y.Length, index => result[index] = y[index]); Array.Copy(y, result, y.Length);
} }
else if (alpha.IsOne()) else if (alpha.IsOne())
{ {
@ -89,11 +89,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha.IsZero()) if (alpha.IsZero())
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = Complex32.Zero); Array.Clear(result, 0, result.Length);
} }
else if (alpha.IsOne()) else if (alpha.IsOne())
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = x[index]); Array.Copy(x, result, x.Length);
} }
else else
{ {

6
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Double.cs

@ -61,7 +61,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha == 0.0) if (alpha == 0.0)
{ {
CommonParallel.ElementFor(0, y.Length, y.Length, index => result[index] = y[index]); Buffer.BlockCopy(y, 0, result, 0, y.Length * Constants.SizeOfDouble);
} }
else if (alpha == 1.0) else if (alpha == 1.0)
{ {
@ -89,11 +89,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha == 0.0) if (alpha == 0.0)
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = 0.0); Array.Clear(result, 0, result.Length);
} }
else if (alpha == 1.0) else if (alpha == 1.0)
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = x[index]); Buffer.BlockCopy(x, 0, result, 0, x.Length * Constants.SizeOfDouble);
} }
else else
{ {

6
src/Numerics/Algorithms/LinearAlgebra/ManagedLinearAlgebraProvider.Single.cs

@ -61,7 +61,7 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha == 0.0) if (alpha == 0.0)
{ {
CommonParallel.ElementFor(0, y.Length, y.Length, index => result[index] = y[index]); Buffer.BlockCopy(y, 0, result, 0, y.Length * Constants.SizeOfFloat);
} }
else if (alpha == 1.0) else if (alpha == 1.0)
{ {
@ -89,11 +89,11 @@ namespace MathNet.Numerics.Algorithms.LinearAlgebra
if (alpha == 0.0) if (alpha == 0.0)
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = 0.0f); Array.Clear(result, 0, result.Length);
} }
else if (alpha == 1.0) else if (alpha == 1.0)
{ {
CommonParallel.ElementFor(0, x.Length, x.Length, index => result[index] = x[index]); Buffer.BlockCopy(x, 0, result, 0, x.Length * Constants.SizeOfFloat);
} }
else else
{ {

Loading…
Cancel
Save