From b2e9445a881c59fb9c8d782a3b8f7dd72d0c1370 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Sat, 3 Oct 2015 12:02:36 +0200 Subject: [PATCH] Minor optimization how we call Array.Copy Reasoning and motivation see dotnet/corefx#3615 --- src/Numerics/ArrayExtensions.cs | 2 +- .../LinearAlgebra/Complex/DiagonalMatrix.cs | 26 +++++++++---------- .../Complex/Factorization/DenseCholesky.cs | 6 ++--- .../Complex/Factorization/DenseLU.cs | 6 ++--- .../LinearAlgebra/Complex/SparseVector.cs | 8 +++--- .../LinearAlgebra/Complex32/DiagonalMatrix.cs | 26 +++++++++---------- .../Complex32/Factorization/DenseCholesky.cs | 6 ++--- .../Complex32/Factorization/DenseLU.cs | 6 ++--- .../LinearAlgebra/Complex32/SparseVector.cs | 8 +++--- .../LinearAlgebra/Double/DiagonalMatrix.cs | 14 +++++----- .../LinearAlgebra/Double/SparseVector.cs | 6 ++--- .../LinearAlgebra/Single/DiagonalMatrix.cs | 14 +++++----- .../LinearAlgebra/Single/SparseVector.cs | 6 ++--- .../Storage/DenseColumnMajorMatrixStorage.cs | 4 +-- .../Storage/DenseVectorStorage.cs | 2 +- .../Storage/DiagonalMatrixStorage.cs | 2 +- .../SparseCompressedRowMatrixStorage.cs | 4 +-- .../Storage/SparseVectorStorage.cs | 2 +- .../ManagedLinearAlgebraProvider.Complex.cs | 8 +++--- .../ManagedLinearAlgebraProvider.Complex32.cs | 10 +++---- src/Numerics/RootFinding/Broyden.cs | 10 +++---- src/Numerics/Statistics/ArrayStatistics.cs | 2 +- src/Numerics/Statistics/MCMC/HybridMC.cs | 6 ++--- src/Numerics/Statistics/Statistics.cs | 2 +- .../Statistics/StreamingStatistics.cs | 2 +- .../Complex/LinearAlgebraProviderTests.cs | 8 +++--- 26 files changed, 98 insertions(+), 98 deletions(-) diff --git a/src/Numerics/ArrayExtensions.cs b/src/Numerics/ArrayExtensions.cs index dbf885f6..f4e70dba 100644 --- a/src/Numerics/ArrayExtensions.cs +++ b/src/Numerics/ArrayExtensions.cs @@ -71,7 +71,7 @@ namespace MathNet.Numerics { Array.Copy(source, 0, dest, 0, source.Length); } - + /// /// Copies the values from on array to another. /// diff --git a/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs index 0688a802..ca593468 100644 --- a/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DiagonalMatrix.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -353,8 +353,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var thisDataCopy = new Complex[diagonalResult._data.Length]; var otherDataCopy = new Complex[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -406,8 +406,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var thisDataCopy = new Complex[diagonalResult._data.Length]; var otherDataCopy = new Complex[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -450,8 +450,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var thisDataCopy = new Complex[diagonalResult._data.Length]; var otherDataCopy = new Complex[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); // TODO: merge/MulByConj Control.LinearAlgebraProvider.ConjugateArray(otherDataCopy, otherDataCopy); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); @@ -496,8 +496,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var thisDataCopy = new Complex[diagonalResult._data.Length]; var otherDataCopy = new Complex[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -549,8 +549,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex { var thisDataCopy = new Complex[diagonalResult._data.Length]; var otherDataCopy = new Complex[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); // TODO: merge/MulByConj Control.LinearAlgebraProvider.ConjugateArray(thisDataCopy, thisDataCopy); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); @@ -746,7 +746,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); } - Array.Copy(source, _data, source.Length); + Array.Copy(source, 0, _data, 0, source.Length); } /// @@ -772,7 +772,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source"); } - Array.Copy(denseSource.Values, _data, denseSource.Values.Length); + Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length); } /// Calculates the induced L1 norm of this matrix. diff --git a/src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs b/src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs index 0bc207d1..e939c4a0 100644 --- a/src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs +++ b/src/Numerics/LinearAlgebra/Complex/Factorization/DenseCholesky.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -112,7 +112,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // Cholesky solve by overwriting result. var dfactor = (DenseMatrix) Factor; @@ -149,7 +149,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // Cholesky solve by overwriting result. var dfactor = (DenseMatrix) Factor; diff --git a/src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs b/src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs index 5ee983b3..40a02756 100644 --- a/src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs +++ b/src/Numerics/LinearAlgebra/Complex/Factorization/DenseLU.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -131,7 +131,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // LU solve by overwriting result. var dfactors = (DenseMatrix) Factors; @@ -180,7 +180,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // LU solve by overwriting result. var dfactors = (DenseMatrix) Factors; diff --git a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs index 46aa7502..9cdaeb24 100644 --- a/src/Numerics/LinearAlgebra/Complex/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex/SparseVector.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -397,7 +397,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount*Constants.SizeOfInt); sparseResult._storage.Values = new Complex[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(-Complex.One, sparseResult._storage.Values, sparseResult._storage.Values); @@ -418,7 +418,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount*Constants.SizeOfInt); sparseResult._storage.Values = new Complex[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ConjugateArray(sparseResult._storage.Values, sparseResult._storage.Values); @@ -460,7 +460,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new Complex[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(scalar, sparseResult._storage.Values, sparseResult._storage.Values); diff --git a/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs index b06bad4d..989632f4 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DiagonalMatrix.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -347,8 +347,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 { var thisDataCopy = new Complex32[diagonalResult._data.Length]; var otherDataCopy = new Complex32[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -400,8 +400,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 { var thisDataCopy = new Complex32[diagonalResult._data.Length]; var otherDataCopy = new Complex32[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -444,8 +444,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 { var thisDataCopy = new Complex32[diagonalResult._data.Length]; var otherDataCopy = new Complex32[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); // TODO: merge/MulByConj Control.LinearAlgebraProvider.ConjugateArray(otherDataCopy, otherDataCopy); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); @@ -490,8 +490,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 { var thisDataCopy = new Complex32[diagonalResult._data.Length]; var otherDataCopy = new Complex32[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -543,8 +543,8 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 { var thisDataCopy = new Complex32[diagonalResult._data.Length]; var otherDataCopy = new Complex32[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); // TODO: merge/MulByConj Control.LinearAlgebraProvider.ConjugateArray(thisDataCopy, thisDataCopy); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); @@ -740,7 +740,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 throw new ArgumentException(Resources.ArgumentArraysSameLength, "source"); } - Array.Copy(source, _data, source.Length); + Array.Copy(source, 0, _data, 0, source.Length); } /// @@ -766,7 +766,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 throw new ArgumentException(Resources.ArgumentVectorsSameLength, "source"); } - Array.Copy(denseSource.Values, _data, denseSource.Values.Length); + Array.Copy(denseSource.Values, 0, _data, 0, denseSource.Values.Length); } /// Calculates the induced L1 norm of this matrix. diff --git a/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs b/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs index dd6f0d2b..3c82e277 100644 --- a/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs +++ b/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseCholesky.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -107,7 +107,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // Cholesky solve by overwriting result. var dfactor = (DenseMatrix) Factor; @@ -144,7 +144,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // Cholesky solve by overwriting result. var dfactor = (DenseMatrix) Factor; diff --git a/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs b/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs index ea5482e9..9199bede 100644 --- a/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs +++ b/src/Numerics/LinearAlgebra/Complex32/Factorization/DenseLU.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -126,7 +126,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // LU solve by overwriting result. var dfactors = (DenseMatrix) Factors; @@ -175,7 +175,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32.Factorization } // Copy the contents of input to result. - Array.Copy(dinput.Values, dresult.Values, dinput.Values.Length); + Array.Copy(dinput.Values, 0, dresult.Values, 0, dinput.Values.Length); // LU solve by overwriting result. var dfactors = (DenseMatrix) Factors; diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs index d888c315..bfe1fc77 100644 --- a/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Complex32/SparseVector.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -392,7 +392,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount*Constants.SizeOfInt); sparseResult._storage.Values = new Complex32[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(-Complex32.One, sparseResult._storage.Values, sparseResult._storage.Values); @@ -413,7 +413,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount*Constants.SizeOfInt); sparseResult._storage.Values = new Complex32[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ConjugateArray(sparseResult._storage.Values, sparseResult._storage.Values); @@ -455,7 +455,7 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new Complex32[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(scalar, sparseResult._storage.Values, sparseResult._storage.Values); diff --git a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs index adf278e7..79189fef 100644 --- a/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DiagonalMatrix.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -326,8 +326,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double { var thisDataCopy = new double[diagonalResult._data.Length]; var otherDataCopy = new double[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -379,8 +379,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double { var thisDataCopy = new double[diagonalResult._data.Length]; var otherDataCopy = new double[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -423,8 +423,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double { var thisDataCopy = new double[diagonalResult._data.Length]; var otherDataCopy = new double[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } diff --git a/src/Numerics/LinearAlgebra/Double/SparseVector.cs b/src/Numerics/LinearAlgebra/Double/SparseVector.cs index 08b79519..8b769d96 100644 --- a/src/Numerics/LinearAlgebra/Double/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Double/SparseVector.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -392,7 +392,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new double[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(-1.0d, sparseResult._storage.Values, sparseResult._storage.Values); @@ -426,7 +426,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new double[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(scalar, sparseResult._storage.Values, sparseResult._storage.Values); diff --git a/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs b/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs index 7c058b58..6828cf12 100644 --- a/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/DiagonalMatrix.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -326,8 +326,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single { var thisDataCopy = new float[diagonalResult._data.Length]; var otherDataCopy = new float[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -379,8 +379,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single { var thisDataCopy = new float[diagonalResult._data.Length]; var otherDataCopy = new float[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } @@ -423,8 +423,8 @@ namespace MathNet.Numerics.LinearAlgebra.Single { var thisDataCopy = new float[diagonalResult._data.Length]; var otherDataCopy = new float[diagonalResult._data.Length]; - Array.Copy(_data, thisDataCopy, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); - Array.Copy(diagonalOther._data, otherDataCopy, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); + Array.Copy(_data, 0, thisDataCopy, 0, (diagonalResult._data.Length > _data.Length) ? _data.Length : diagonalResult._data.Length); + Array.Copy(diagonalOther._data, 0, otherDataCopy, 0, (diagonalResult._data.Length > diagonalOther._data.Length) ? diagonalOther._data.Length : diagonalResult._data.Length); Control.LinearAlgebraProvider.PointWiseMultiplyArrays(thisDataCopy, otherDataCopy, diagonalResult._data); return; } diff --git a/src/Numerics/LinearAlgebra/Single/SparseVector.cs b/src/Numerics/LinearAlgebra/Single/SparseVector.cs index e6efc9e0..78517832 100644 --- a/src/Numerics/LinearAlgebra/Single/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Single/SparseVector.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2013 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -393,7 +393,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new float[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(-1.0f, sparseResult._storage.Values, sparseResult._storage.Values); @@ -427,7 +427,7 @@ namespace MathNet.Numerics.LinearAlgebra.Single sparseResult._storage.Indices = new int[_storage.ValueCount]; Buffer.BlockCopy(_storage.Indices, 0, sparseResult._storage.Indices, 0, _storage.ValueCount * Constants.SizeOfInt); sparseResult._storage.Values = new float[_storage.ValueCount]; - Array.Copy(_storage.Values, sparseResult._storage.Values, _storage.ValueCount); + Array.Copy(_storage.Values, 0, sparseResult._storage.Values, 0, _storage.ValueCount); } Control.LinearAlgebraProvider.ScaleArray(scalar, sparseResult._storage.Values, sparseResult._storage.Values); diff --git a/src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs index 6ce1045a..4f9cc1c8 100644 --- a/src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/DenseColumnMajorMatrixStorage.cs @@ -332,7 +332,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (arrayData != null) { var copy = new T[arrayData.Length]; - Array.Copy(arrayData, copy, arrayData.Length); + Array.Copy(arrayData, 0, copy, 0, arrayData.Length); return new DenseColumnMajorMatrixStorage(rows, columns, copy); } @@ -588,7 +588,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage public override T[] ToColumnMajorArray() { var ret = new T[Data.Length]; - Array.Copy(Data, ret, Data.Length); + Array.Copy(Data, 0, ret, 0, Data.Length); return ret; } diff --git a/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs b/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs index c52b0f82..e6bd6e0a 100644 --- a/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/DenseVectorStorage.cs @@ -158,7 +158,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (arrayData != null) { var copy = new T[arrayData.Length]; - Array.Copy(arrayData, copy, arrayData.Length); + Array.Copy(arrayData, 0, copy, 0, arrayData.Length); return new DenseVectorStorage(copy.Length, copy); } diff --git a/src/Numerics/LinearAlgebra/Storage/DiagonalMatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/DiagonalMatrixStorage.cs index 8ec61019..fb4ab694 100644 --- a/src/Numerics/LinearAlgebra/Storage/DiagonalMatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/DiagonalMatrixStorage.cs @@ -228,7 +228,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (arrayData != null) { var copy = new T[arrayData.Length]; - Array.Copy(arrayData, copy, arrayData.Length); + Array.Copy(arrayData, 0, copy, 0, arrayData.Length); return new DiagonalMatrixStorage(rows, columns, copy); } diff --git a/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs index 5c42e85d..e9b9bbd1 100644 --- a/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/SparseCompressedRowMatrixStorage.cs @@ -880,7 +880,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (ValueCount != 0) { - Array.Copy(Values, target.Values, ValueCount); + Array.Copy(Values, 0, target.Values, 0, ValueCount); Buffer.BlockCopy(ColumnIndices, 0, target.ColumnIndices, 0, ValueCount*Constants.SizeOfInt); Buffer.BlockCopy(RowPointers, 0, target.RowPointers, 0, (RowCount + 1)*Constants.SizeOfInt); } @@ -2037,7 +2037,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage { if (!ReferenceEquals(state, target)) { - Array.Copy(state, target, state.Length); + Array.Copy(state, 0, target, 0, state.Length); } if (zeros == Zeros.AllowSkip) { diff --git a/src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs b/src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs index 8e78c3cd..b9ac6e1f 100644 --- a/src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/SparseVectorStorage.cs @@ -463,7 +463,7 @@ namespace MathNet.Numerics.LinearAlgebra.Storage if (ValueCount != 0) { - Array.Copy(Values, target.Values, ValueCount); + Array.Copy(Values, 0, target.Values, 0, ValueCount); Buffer.BlockCopy(Indices, 0, target.Indices, 0, ValueCount * Constants.SizeOfInt); } } diff --git a/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs b/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs index a6a1fe37..319a7237 100644 --- a/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs +++ b/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex.cs @@ -1794,7 +1794,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra var sol = new Complex[b.Length]; // Copy B matrix to "sol", so B data will not be changed - Array.Copy(b, sol, b.Length); + Array.Copy(b, 0, sol, 0, b.Length); // Compute Y = transpose(Q)*B var column = new Complex[rowsA]; @@ -1896,7 +1896,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra } var work = new Complex[rowsA]; - + const int maxiter = 1000; var e = new Complex[columnsA]; @@ -2507,7 +2507,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra // Copy stemp to s with size adjustment. We are using ported copy of linpack's svd code and it uses // a singular vector of length rows+1 when rows < columns. The last element is not used and needs to be removed. // We should port lapack's svd routine to remove this problem. - Array.Copy(stemp, s, Math.Min(rowsA, columnsA)); + Array.Copy(stemp, 0, s, 0, Math.Min(rowsA, columnsA)); } /// @@ -2704,7 +2704,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra throw new ArgumentException(String.Format(Resources.ArgumentArrayWrongLength, order*order), "matrixD"); } var matrixCopy = new Complex[matrix.Length]; - Array.Copy(matrix, matrixCopy, matrix.Length); + Array.Copy(matrix, 0, matrixCopy, 0, matrix.Length); if (isSymmetric) { diff --git a/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs b/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs index d68b9142..1bc21fd8 100644 --- a/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs +++ b/src/Numerics/Providers/LinearAlgebra/ManagedLinearAlgebraProvider.Complex32.cs @@ -1499,7 +1499,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra } var work = new Complex32[rowsA*columnsA]; - + var minmn = Math.Min(rowsA, columnsA); for (var i = 0; i < minmn; i++) { @@ -1789,7 +1789,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra var sol = new Complex32[b.Length]; // Copy B matrix to "sol", so B data will not be changed - Array.Copy(b, sol, b.Length); + Array.Copy(b, 0, sol, 0, b.Length); // Compute Y = transpose(Q)*B var column = new Complex32[rowsA]; @@ -1891,7 +1891,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra } var work = new Complex32[rowsA]; - + const int maxiter = 1000; var e = new Complex32[columnsA]; @@ -2502,7 +2502,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra // Copy stemp to s with size adjustment. We are using ported copy of linpack's svd code and it uses // a singular vector of length rows+1 when rows < columns. The last element is not used and needs to be removed. // We should port lapack's svd routine to remove this problem. - Array.Copy(stemp, s, Math.Min(rowsA, columnsA)); + Array.Copy(stemp, 0, s, 0, Math.Min(rowsA, columnsA)); } /// @@ -2700,7 +2700,7 @@ namespace MathNet.Numerics.Providers.LinearAlgebra } var matrixCopy = new Complex32[matrix.Length]; - Array.Copy(matrix, matrixCopy, matrix.Length); + Array.Copy(matrix, 0, matrixCopy, 0, matrix.Length); var v = new DenseVector(order); if (isSymmetric) { diff --git a/src/Numerics/RootFinding/Broyden.cs b/src/Numerics/RootFinding/Broyden.cs index c147c004..4f7ee504 100644 --- a/src/Numerics/RootFinding/Broyden.cs +++ b/src/Numerics/RootFinding/Broyden.cs @@ -3,9 +3,9 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com -// +// // Copyright (c) 2009-2013 Math.NET -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -14,10 +14,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND @@ -130,7 +130,7 @@ namespace MathNet.Numerics.RootFinding var B = new DenseMatrix(dim); var x = new double[dim]; - Array.Copy(x0, x, dim); + Array.Copy(x0, 0, x, 0, dim); for (int j = 0; j < dim; j++) { diff --git a/src/Numerics/Statistics/ArrayStatistics.cs b/src/Numerics/Statistics/ArrayStatistics.cs index 11df7ba3..80ff3023 100644 --- a/src/Numerics/Statistics/ArrayStatistics.cs +++ b/src/Numerics/Statistics/ArrayStatistics.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation diff --git a/src/Numerics/Statistics/MCMC/HybridMC.cs b/src/Numerics/Statistics/MCMC/HybridMC.cs index 5457edee..0c917d97 100644 --- a/src/Numerics/Statistics/MCMC/HybridMC.cs +++ b/src/Numerics/Statistics/MCMC/HybridMC.cs @@ -203,7 +203,7 @@ namespace MathNet.Numerics.Statistics.Mcmc protected override double[] Copy(double[] source) { var destination = new double[_length]; - Array.Copy(source, destination, _length); + Array.Copy(source, 0, destination, 0, _length); return destination; } @@ -270,8 +270,8 @@ namespace MathNet.Numerics.Statistics.Mcmc var increment = new double[length]; var decrement = new double[length]; - Array.Copy(x, increment, length); - Array.Copy(x, decrement, length); + Array.Copy(x, 0, increment, 0, length); + Array.Copy(x, 0, decrement, 0, length); for (int i = 0; i < length; i++) { diff --git a/src/Numerics/Statistics/Statistics.cs b/src/Numerics/Statistics/Statistics.cs index 9a92fafe..610a51e4 100644 --- a/src/Numerics/Statistics/Statistics.cs +++ b/src/Numerics/Statistics/Statistics.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation diff --git a/src/Numerics/Statistics/StreamingStatistics.cs b/src/Numerics/Statistics/StreamingStatistics.cs index ae9a2886..d0ba11ec 100644 --- a/src/Numerics/Statistics/StreamingStatistics.cs +++ b/src/Numerics/Statistics/StreamingStatistics.cs @@ -4,7 +4,7 @@ // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com // -// Copyright (c) 2009-2014 Math.NET +// Copyright (c) 2009-2015 Math.NET // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation diff --git a/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs index bc60a10e..59b60919 100644 --- a/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs +++ b/src/UnitTests/LinearAlgebraProviderTests/Complex/LinearAlgebraProviderTests.cs @@ -3,9 +3,9 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com -// +// // Copyright (c) 2009-2015 Math.NET -// +// // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation // files (the "Software"), to deal in the Software without @@ -14,10 +14,10 @@ // copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following // conditions: -// +// // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES // OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND