diff --git a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs index 717b67a8..1cd31c5a 100644 --- a/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/DenseMatrix.cs @@ -28,14 +28,15 @@ // OTHER DEALINGS IN THE SOFTWARE. // +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using MathNet.Numerics.Distributions; using MathNet.Numerics.LinearAlgebra.Storage; using MathNet.Numerics.Properties; using MathNet.Numerics.Providers.LinearAlgebra; using MathNet.Numerics.Threading; -using System; -using System.Collections.Generic; -using System.Diagnostics; namespace MathNet.Numerics.LinearAlgebra.Complex { @@ -162,6 +163,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnMajorEnumerable(rows, columns, columnMajor)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -198,6 +210,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs index 51c6fd5c..c19ceff1 100644 --- a/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex/SparseMatrix.cs @@ -28,10 +28,11 @@ // OTHER DEALINGS IN THE SOFTWARE. // -using MathNet.Numerics.LinearAlgebra.Storage; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using MathNet.Numerics.LinearAlgebra.Storage; namespace MathNet.Numerics.LinearAlgebra.Complex { @@ -151,6 +152,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnMajorList(rows, columns, columnMajor)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -187,6 +199,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs index b65906ed..357c789c 100644 --- a/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/DenseMatrix.cs @@ -28,14 +28,15 @@ // OTHER DEALINGS IN THE SOFTWARE. // +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using MathNet.Numerics.Distributions; using MathNet.Numerics.LinearAlgebra.Storage; using MathNet.Numerics.Properties; using MathNet.Numerics.Providers.LinearAlgebra; using MathNet.Numerics.Threading; -using System; -using System.Collections.Generic; -using System.Diagnostics; namespace MathNet.Numerics.LinearAlgebra.Complex32 { @@ -157,6 +158,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnMajorEnumerable(rows, columns, columnMajor)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -193,6 +205,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs index e85ca541..87d27ce5 100644 --- a/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Complex32/SparseMatrix.cs @@ -28,10 +28,11 @@ // OTHER DEALINGS IN THE SOFTWARE. // -using MathNet.Numerics.LinearAlgebra.Storage; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using MathNet.Numerics.LinearAlgebra.Storage; namespace MathNet.Numerics.LinearAlgebra.Complex32 { @@ -146,6 +147,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnMajorList(rows, columns, columnMajor)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -182,6 +194,17 @@ namespace MathNet.Numerics.LinearAlgebra.Complex32 return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs index 3ec14b68..4aa404a1 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseMatrix.cs @@ -28,14 +28,15 @@ // OTHER DEALINGS IN THE SOFTWARE. // +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using MathNet.Numerics.Distributions; using MathNet.Numerics.LinearAlgebra.Storage; using MathNet.Numerics.Properties; using MathNet.Numerics.Providers.LinearAlgebra; using MathNet.Numerics.Threading; -using System; -using System.Collections.Generic; -using System.Diagnostics; namespace MathNet.Numerics.LinearAlgebra.Double { @@ -155,6 +156,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnMajorEnumerable(rows, columns, columnMajor)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -191,6 +203,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs index 7eba1eae..56ca254a 100644 --- a/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Double/SparseMatrix.cs @@ -28,10 +28,11 @@ // OTHER DEALINGS IN THE SOFTWARE. // -using MathNet.Numerics.LinearAlgebra.Storage; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using MathNet.Numerics.LinearAlgebra.Storage; namespace MathNet.Numerics.LinearAlgebra.Double { @@ -144,6 +145,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnMajorList(rows, columns, columnMajor)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -180,6 +192,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs b/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs index b074d26d..091dce4b 100644 --- a/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/DenseMatrix.cs @@ -28,14 +28,15 @@ // OTHER DEALINGS IN THE SOFTWARE. // +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using MathNet.Numerics.Distributions; using MathNet.Numerics.LinearAlgebra.Storage; using MathNet.Numerics.Properties; using MathNet.Numerics.Providers.LinearAlgebra; using MathNet.Numerics.Threading; -using System; -using System.Collections.Generic; -using System.Diagnostics; namespace MathNet.Numerics.LinearAlgebra.Single { @@ -155,6 +156,17 @@ namespace MathNet.Numerics.LinearAlgebra.Single return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnMajorEnumerable(rows, columns, columnMajor)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable columns. /// Each enumerable in the master enumerable specifies a column. @@ -191,6 +203,17 @@ namespace MathNet.Numerics.LinearAlgebra.Single return new DenseMatrix(DenseColumnMajorMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static DenseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new dense matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row. diff --git a/src/Numerics/LinearAlgebra/Single/SparseMatrix.cs b/src/Numerics/LinearAlgebra/Single/SparseMatrix.cs index d1354885..30602258 100644 --- a/src/Numerics/LinearAlgebra/Single/SparseMatrix.cs +++ b/src/Numerics/LinearAlgebra/Single/SparseMatrix.cs @@ -28,10 +28,11 @@ // OTHER DEALINGS IN THE SOFTWARE. // -using MathNet.Numerics.LinearAlgebra.Storage; using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; +using MathNet.Numerics.LinearAlgebra.Storage; namespace MathNet.Numerics.LinearAlgebra.Single { @@ -143,6 +144,17 @@ namespace MathNet.Numerics.LinearAlgebra.Single { return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnMajorList(rows, columns, columnMajor)); } + + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. + /// Each enumerable in the master enumerable specifies a column. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfColumns(IEnumerable> data) + { + return OfColumnArrays(data.Select(v => v.ToArray()).ToArray()); + } /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable columns. @@ -180,6 +192,17 @@ namespace MathNet.Numerics.LinearAlgebra.Single return new SparseMatrix(SparseCompressedRowMatrixStorage.OfColumnVectors(storage)); } + /// + /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. + /// Each enumerable in the master enumerable specifies a row. + /// This new matrix will be independent from the enumerables. + /// A new memory block will be allocated for storing the matrix. + /// + public static SparseMatrix OfRows(IEnumerable> data) + { + return OfRowArrays(data.Select(v => v.ToArray()).ToArray()); + } + /// /// Create a new sparse matrix as a copy of the given enumerable of enumerable rows. /// Each enumerable in the master enumerable specifies a row.