|
|
|
@ -78,43 +78,23 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
} |
|
|
|
else if (alpha.IsOne()) |
|
|
|
{ |
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = y[i] + x[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = y[index] + x[index]; |
|
|
|
result[i] = y[i] + x[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = y[i] + (alpha*x[i]); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = y[index] + (alpha*x[index]); |
|
|
|
result[i] = y[i] + (alpha * x[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
@ -143,23 +123,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, x.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = alpha*x[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, x.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = alpha*x[index]; |
|
|
|
result[i] = alpha * x[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -175,23 +145,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
throw new ArgumentNullException("x"); |
|
|
|
} |
|
|
|
|
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, x.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = x[i].Conjugate(); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, x.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = x[index].Conjugate(); |
|
|
|
result[i] = x[i].Conjugate(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -260,23 +220,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
throw new ArgumentException(Resources.ArgumentVectorsSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = x[i] + y[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = x[index] + y[index]; |
|
|
|
result[i] = x[i] + y[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -311,23 +261,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
throw new ArgumentException(Resources.ArgumentVectorsSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = x[i] - y[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = x[index] - y[index]; |
|
|
|
result[i] = x[i] - y[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -362,23 +302,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
throw new ArgumentException(Resources.ArgumentVectorsSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = x[i]*y[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = x[index]*y[index]; |
|
|
|
result[i] = x[i] * y[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -413,23 +343,13 @@ namespace MathNet.Numerics.Providers.LinearAlgebra |
|
|
|
throw new ArgumentException(Resources.ArgumentVectorsSameLength); |
|
|
|
} |
|
|
|
|
|
|
|
if (Control.ParallelizeOperation(x.Length)) |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
CommonParallel.For(0, y.Length, 4096, (a, b) => |
|
|
|
{ |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[i] = x[i]/y[i]; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
for (var index = 0; index < x.Length; index++) |
|
|
|
for (int i = a; i < b; i++) |
|
|
|
{ |
|
|
|
result[index] = x[index]/y[index]; |
|
|
|
result[i] = x[i] / y[i]; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|