diff --git a/src/Numerics/LinearAlgebra/Double/Factorization/LU.cs b/src/Numerics/LinearAlgebra/Double/Factorization/LU.cs index b1c98350..d895d0b0 100644 --- a/src/Numerics/LinearAlgebra/Double/Factorization/LU.cs +++ b/src/Numerics/LinearAlgebra/Double/Factorization/LU.cs @@ -78,7 +78,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization { get { - Matrix result = mFactors.GetLowerTriangle(); + Matrix result = mFactors.LowerTriangle(); for (int i = 0; i < result.RowCount; i++) { result.At(i, i, 1); @@ -92,7 +92,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double.Factorization /// public virtual Matrix U { - get { return mFactors.GetUpperTriangle(); } + get { return mFactors.UpperTriangle(); } } /// diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs index ce120717..14cd1c04 100644 --- a/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs +++ b/src/Numerics/LinearAlgebra/Double/Matrix.Arithmetic.cs @@ -925,7 +925,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double this.ColumnCount, i => { - var coli = this.GetColumn(i); + var coli = this.Column(i); var norm = coli.NormP(p); for (var j = 0; j < this.RowCount; j++) { @@ -954,7 +954,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double this.ColumnCount, j => { - var rowj = this.GetRow(j); + var rowj = this.Row(j); var norm = rowj.NormP(p); for (var i = 0; i < this.RowCount; i++) { diff --git a/src/Numerics/LinearAlgebra/Double/Matrix.cs b/src/Numerics/LinearAlgebra/Double/Matrix.cs index c2f3d0f4..e624b098 100644 --- a/src/Numerics/LinearAlgebra/Double/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Double/Matrix.cs @@ -3,9 +3,7 @@ // http://numerics.mathdotnet.com // http://github.com/mathnet/mathnet-numerics // http://mathnetnumerics.codeplex.com -// // Copyright (c) 2009-2010 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 +12,8 @@ // 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 @@ -35,18 +31,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double using System.Text; using Properties; using Threading; - + /// /// Defines the base class for Matrix classes. /// #if !SILVERLIGHT [Serializable] #endif - public abstract partial class Matrix : + public abstract partial class Matrix : #if SILVERLIGHT IFormattable, IEquatable #else - IFormattable, IEquatable, ICloneable + IFormattable, IEquatable, ICloneable #endif { /// @@ -70,8 +66,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentOutOfRangeException(Resources.MatrixColumnsMustBePositive); } - RowCount = rows; - ColumnCount = columns; + this.RowCount = rows; + this.ColumnCount = columns; } /// @@ -87,21 +83,29 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentOutOfRangeException(Resources.MatrixRowsOrColumnsMustBePositive); } - RowCount = order; - ColumnCount = order; + this.RowCount = order; + this.ColumnCount = order; } /// /// Gets the number of columns. /// /// The number of columns. - public virtual int ColumnCount { get; private set; } + public virtual int ColumnCount + { + get; + private set; + } /// /// Gets the number of rows. /// /// The number of rows. - public virtual int RowCount { get; private set; } + public virtual int RowCount + { + get; + private set; + } /// /// Gets or sets the value at the given row and column. @@ -119,14 +123,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double { get { - RangeCheck(row, column); - return At(row, column); + this.RangeCheck(row, column); + return this.At(row, column); } set { - RangeCheck(row, column); - At(row, column, value); + this.RangeCheck(row, column); + this.At(row, column, value); } } @@ -166,8 +170,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public virtual Matrix Clone() { - var result = CreateMatrix(RowCount, ColumnCount); - CopyTo(result); + var result = this.CreateMatrix(this.RowCount, this.ColumnCount); + this.CopyTo(result); return result; } @@ -195,18 +199,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double return; } - if (RowCount != target.RowCount || ColumnCount != target.ColumnCount) + if (this.RowCount != target.RowCount || this.ColumnCount != target.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixDimensions, "target"); } // TODO this assumes that all entries matter; if "this" is a sparse matrix, // we might be able to optimize the copying a bit. - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { - target.At(i, j, At(i, j)); + target.At(i, j, this.At(i, j)); } } } @@ -248,7 +252,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public override string ToString() { - return ToString(null, null); + return this.ToString(null, null); } /// @@ -258,10 +262,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A containing the copied elements. /// If is negative, /// or greater than or equal to the number of rows. - public virtual Vector GetRow(int index) + public virtual Vector Row(int index) { - Vector ret = CreateVector(ColumnCount); - GetRow(index, 0, ColumnCount, ret); + var ret = this.CreateVector(this.ColumnCount); + this.Row(index, 0, this.ColumnCount, ret); return ret; } @@ -274,9 +278,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// If is negative, /// or greater than or equal to the number of rows. /// If this.Columns != result.Count. - public virtual void GetRow(int index, Vector result) + public virtual void Row(int index, Vector result) { - GetRow(index, 0, ColumnCount, result); + this.Row(index, 0, this.ColumnCount, result); } /// @@ -293,10 +297,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// or greater than or equal to the number of columns. /// (columnIndex + length) >= Columns. /// If is not positive. - public virtual Vector GetRow(int rowIndex, int columnIndex, int length) + public virtual Vector Row(int rowIndex, int columnIndex, int length) { - Vector ret = CreateVector(length); - GetRow(rowIndex, columnIndex, length, ret); + var ret = this.CreateVector(length); + this.Row(rowIndex, columnIndex, length, ret); return ret; } @@ -316,24 +320,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// is greater than or equal to the number of rows. /// If is not positive. /// If result.Count < length. - public virtual void GetRow(int rowIndex, int columnIndex, int length, Vector result) + public virtual void Row(int rowIndex, int columnIndex, int length, Vector result) { if (result == null) { throw new ArgumentNullException("result"); } - if (rowIndex >= RowCount || rowIndex < 0) + if (rowIndex >= this.RowCount || rowIndex < 0) { throw new ArgumentOutOfRangeException("rowIndex"); } - if (columnIndex >= ColumnCount || columnIndex < 0) + if (columnIndex >= this.ColumnCount || columnIndex < 0) { throw new ArgumentOutOfRangeException("columnIndex"); } - if (columnIndex + length > ColumnCount) + if (columnIndex + length > this.ColumnCount) { throw new ArgumentOutOfRangeException("length"); } @@ -350,7 +354,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double for (int i = columnIndex, j = 0; i < columnIndex + length; i++, j++) { - result[j] = At(rowIndex, i); + result[j] = this.At(rowIndex, i); } } @@ -361,10 +365,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A containing the copied elements. /// If is negative, /// or greater than or equal to the number of columns. - public virtual Vector GetColumn(int index) + public virtual Vector Column(int index) { - Vector result = CreateVector(RowCount); - GetColumn(index, 0, RowCount, result); + var result = this.CreateVector(this.RowCount); + this.Column(index, 0, this.RowCount, result); return result; } @@ -377,9 +381,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// If is negative, /// or greater than or equal to the number of columns. /// If this.Rows != result.Count. - public virtual void GetColumn(int index, Vector result) + public virtual void Column(int index, Vector result) { - GetColumn(index, 0, RowCount, result); + this.Column(index, 0, this.RowCount, result); } /// @@ -397,10 +401,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// (rowIndex + length) >= Rows. /// /// If is not positive. - public virtual Vector GetColumn(int columnIndex, int rowIndex, int length) + public virtual Vector Column(int columnIndex, int rowIndex, int length) { - Vector result = CreateVector(length); - GetColumn(columnIndex, rowIndex, length, result); + var result = this.CreateVector(length); + this.Column(columnIndex, rowIndex, length, result); return result; } @@ -420,24 +424,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// is greater than or equal to the number of rows. /// If is not positive. /// If result.Count < length. - public virtual void GetColumn(int columnIndex, int rowIndex, int length, Vector result) + public virtual void Column(int columnIndex, int rowIndex, int length, Vector result) { if (result == null) { throw new ArgumentNullException("result"); } - if (columnIndex >= ColumnCount || columnIndex < 0) + if (columnIndex >= this.ColumnCount || columnIndex < 0) { throw new ArgumentOutOfRangeException("columnIndex"); } - if (rowIndex >= RowCount || rowIndex < 0) + if (rowIndex >= this.RowCount || rowIndex < 0) { throw new ArgumentOutOfRangeException("rowIndex"); } - if (rowIndex + length > RowCount) + if (rowIndex + length > this.RowCount) { throw new ArgumentOutOfRangeException("length"); } @@ -454,7 +458,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double for (int i = rowIndex, j = 0; i < rowIndex + length; i++, j++) { - result[j] = At(i, columnIndex); + result[j] = this.At(i, columnIndex); } } @@ -462,17 +466,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Returns a new matrix containing the lower triangle of this matrix. /// /// The lower triangle of this matrix. - public virtual Matrix GetLowerTriangle() + public virtual Matrix LowerTriangle() { - Matrix ret = CreateMatrix(RowCount, ColumnCount); + var ret = this.CreateMatrix(this.RowCount, this.ColumnCount); CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, j => { - for (int i = j; i < RowCount; i++) + for (var i = j; i < this.RowCount; i++) { - ret.At(i, j, At(i, j)); + ret.At(i, j, this.At(i, j)); } }); return ret; @@ -484,47 +488,47 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Where to store the lower triangle. /// If is . /// If the result matrix's dimensions are not the same as this matrix. - public virtual void GetLowerTriangle(Matrix result) + public virtual void LowerTriangle(Matrix result) { if (result == null) { throw new ArgumentNullException("result"); } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) + if (result.RowCount != this.RowCount || result.ColumnCount != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, j => { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { result.At(i, j, i >= j ? this.At(i, j) : 0); } }); } - + /// /// Returns a new matrix containing the upper triangle of this matrix. /// /// The upper triangle of this matrix. - public virtual Matrix GetUpperTriangle() + public virtual Matrix UpperTriangle() { - Matrix ret = CreateMatrix(RowCount, ColumnCount); + var ret = this.CreateMatrix(this.RowCount, this.ColumnCount); CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, j => { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { if (i <= j) { - ret.At(i, j, At(i, j)); + ret.At(i, j, this.At(i, j)); } } }); @@ -537,24 +541,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Where to store the lower triangle. /// If is . /// If the result matrix's dimensions are not the same as this matrix. - public virtual void GetUpperTriangle(Matrix result) + public virtual void UpperTriangle(Matrix result) { if (result == null) { throw new ArgumentNullException("result"); } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) + if (result.RowCount != this.RowCount || result.ColumnCount != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, j => { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { result.At(i, j, i <= j ? this.At(i, j) : 0); } @@ -579,12 +583,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// is not positive. public virtual Matrix SubMatrix(int rowIndex, int rowLength, int columnIndex, int columnLength) { - if (rowIndex >= RowCount || rowIndex < 0) + if (rowIndex >= this.RowCount || rowIndex < 0) { throw new ArgumentOutOfRangeException("rowIndex"); } - if (columnIndex >= ColumnCount || columnIndex < 0) + if (columnIndex >= this.ColumnCount || columnIndex < 0) { throw new ArgumentOutOfRangeException("columnIndex"); } @@ -599,29 +603,29 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentException(Resources.ArgumentMustBePositive, "columnLength"); } - int colMax = columnIndex + columnLength; - int rowMax = rowIndex + rowLength; + var colMax = columnIndex + columnLength; + var rowMax = rowIndex + rowLength; - if (rowMax > RowCount) + if (rowMax > this.RowCount) { throw new ArgumentOutOfRangeException("rowLength"); } - if (colMax > ColumnCount) + if (colMax > this.ColumnCount) { throw new ArgumentOutOfRangeException("columnLength"); } - Matrix result = CreateMatrix(rowLength, columnLength); - + var result = this.CreateMatrix(rowLength, columnLength); + CommonParallel.For( - columnIndex, - colMax, + columnIndex, + colMax, j => { for (int i = rowIndex, ii = 0; i < rowMax; i++, ii++) { - result.At(ii, j - columnIndex, At(i, j)); + result.At(ii, j - columnIndex, this.At(i, j)); } }); return result; @@ -634,9 +638,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public virtual IEnumerable> ColumnEnumerator() { - for (int i = 0; i < ColumnCount; i++) + for (var i = 0; i < this.ColumnCount; i++) { - yield return new KeyValuePair(i, GetColumn(i)); + yield return new KeyValuePair(i, this.Column(i)); } } @@ -660,7 +664,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentOutOfRangeException("index"); } - if (index + length > ColumnCount) + if (index + length > this.ColumnCount) { throw new ArgumentOutOfRangeException("length"); } @@ -670,10 +674,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentException(Resources.ArgumentMustBePositive, "length"); } - int maxIndex = index + length; - for (int i = index; i < maxIndex; i++) + var maxIndex = index + length; + for (var i = index; i < maxIndex; i++) { - yield return new KeyValuePair(i, GetColumn(i)); + yield return new KeyValuePair(i, this.Column(i)); } } @@ -691,12 +695,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// If is not positive. public virtual IEnumerable> RowEnumerator(int index, int length) { - if (index >= RowCount || index < 0) + if (index >= this.RowCount || index < 0) { throw new ArgumentOutOfRangeException("index"); } - if (index + length > RowCount) + if (index + length > this.RowCount) { throw new ArgumentOutOfRangeException("length"); } @@ -706,10 +710,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentException(Resources.ArgumentMustBePositive, "length"); } - int maxi = index + length; - for (int i = index; i < maxi; i++) + var maxi = index + length; + for (var i = index; i < maxi; i++) { - yield return new KeyValuePair(i, GetRow(i)); + yield return new KeyValuePair(i, this.Row(i)); } } @@ -720,9 +724,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public virtual IEnumerable> RowEnumerator() { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { - yield return new KeyValuePair(i, GetRow(i)); + yield return new KeyValuePair(i, this.Row(i)); } } @@ -734,15 +738,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// i == j (i is the row index, and j is the column index). public virtual Vector Diagonal() { - int min = Math.Min(RowCount, ColumnCount); - Vector diagonal = CreateVector(min); + var min = Math.Min(this.RowCount, this.ColumnCount); + var diagonal = this.CreateVector(min); CommonParallel.For( - 0, - min, - i => - { - diagonal[i] = At(i, i); - }); + 0, + min, + i => { diagonal[i] = this.At(i, i); }); return diagonal; } @@ -753,17 +754,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The lower triangle of this matrix. public virtual Matrix StrictlyLowerTriangle() { - Matrix result = CreateMatrix(RowCount, ColumnCount); + var result = this.CreateMatrix(this.RowCount, this.ColumnCount); CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { if (i > j) { - result.At(i, j, At(i, j)); + result.At(i, j, this.At(i, j)); } } }); @@ -783,17 +784,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("result"); } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) + if (result.RowCount != this.RowCount || result.ColumnCount != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { result.At(i, j, i > j ? this.At(i, j) : 0); } @@ -807,17 +808,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The upper triangle of this matrix. public virtual Matrix StrictlyUpperTriangle() { - Matrix result = CreateMatrix(RowCount, ColumnCount); + var result = this.CreateMatrix(this.RowCount, this.ColumnCount); CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { if (i < j) { - result.At(i, j, At(i, j)); + result.At(i, j, this.At(i, j)); } } }); @@ -840,28 +841,28 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("column"); } - if (columnIndex < 0 || columnIndex > ColumnCount) + if (columnIndex < 0 || columnIndex > this.ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); } - if (column.Count != RowCount) + if (column.Count != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column"); } - Matrix result = CreateMatrix(RowCount, ColumnCount + 1); + var result = this.CreateMatrix(this.RowCount, this.ColumnCount + 1); - for (int i = 0; i < columnIndex; i++) + for (var i = 0; i < columnIndex; i++) { - result.SetColumn(i, GetColumn(i)); + result.SetColumn(i, this.Column(i)); } result.SetColumn(columnIndex, column); - - for (int i = columnIndex + 1; i < ColumnCount + 1; i++) + + for (var i = columnIndex + 1; i < this.ColumnCount + 1; i++) { - result.SetColumn(i, GetColumn(i - 1)); + result.SetColumn(i, this.Column(i - 1)); } return result; @@ -881,9 +882,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// equal the number of rows of this Matrix. public virtual void SetColumn(int columnIndex, double[] column) { - if (columnIndex < 0 || columnIndex >= ColumnCount) + if (columnIndex < 0 || columnIndex >= this.ColumnCount) { - throw new ArgumentOutOfRangeException("columnIndex"); + throw new ArgumentOutOfRangeException("columnIndex"); } if (column == null) @@ -891,14 +892,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("column"); } - if (column.Length != RowCount) + if (column.Length != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column"); } CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => this.At(i, columnIndex, column[i])); } @@ -914,7 +915,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// equal the number of rows of this Matrix. public virtual void SetColumn(int columnIndex, Vector column) { - if (columnIndex < 0 || columnIndex >= ColumnCount) + if (columnIndex < 0 || columnIndex >= this.ColumnCount) { throw new ArgumentOutOfRangeException("columnIndex"); } @@ -924,14 +925,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("column"); } - if (column.Count != RowCount) + if (column.Count != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "column"); } CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => this.At(i, columnIndex, column[i])); } @@ -951,28 +952,28 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("row"); } - if (rowIndex < 0 || rowIndex > RowCount) + if (rowIndex < 0 || rowIndex > this.RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); } - if (row.Count != ColumnCount) + if (row.Count != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row"); } - Matrix result = CreateMatrix(RowCount + 1, ColumnCount); + var result = this.CreateMatrix(this.RowCount + 1, this.ColumnCount); - for (int i = 0; i < rowIndex; i++) + for (var i = 0; i < rowIndex; i++) { - result.SetRow(i, GetRow(i)); + result.SetRow(i, this.Row(i)); } result.SetRow(rowIndex, row); - for (int i = rowIndex + 1; i < RowCount; i++) + for (var i = rowIndex + 1; i < this.RowCount; i++) { - result.SetRow(i, GetRow(i - 1)); + result.SetRow(i, this.Row(i - 1)); } return result; @@ -990,7 +991,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// equal the number of columns of this Matrix. public virtual void SetRow(int rowIndex, Vector row) { - if (rowIndex < 0 || rowIndex >= RowCount) + if (rowIndex < 0 || rowIndex >= this.RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); } @@ -1000,17 +1001,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("row"); } - if (row.Count != ColumnCount) + if (row.Count != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row"); } CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, i => this.At(rowIndex, i, row[i])); } - + /// /// Copies the values of the given array to the specified row. /// @@ -1023,7 +1024,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// equal the number of columns of this Matrix. public virtual void SetRow(int rowIndex, double[] row) { - if (rowIndex < 0 || rowIndex >= RowCount) + if (rowIndex < 0 || rowIndex >= this.RowCount) { throw new ArgumentOutOfRangeException("rowIndex"); } @@ -1033,14 +1034,14 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("row"); } - if (row.Length != ColumnCount) + if (row.Length != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension, "row"); } CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, i => this.At(rowIndex, i, row[i])); } @@ -1051,7 +1052,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The number of rows to copy. Must be positive. /// The column to start copying to. /// The number of columns to copy. Must be positive. - /// The submatrix to copy from. + /// The sub-matrix to copy from. /// If: is /// negative, or greater than or equal to the number of rows. /// is negative, or greater than or equal to the number @@ -1064,12 +1065,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// is not positive. public virtual void SetSubMatrix(int rowIndex, int rowLength, int columnIndex, int columnLength, Matrix subMatrix) { - if (rowIndex >= RowCount || rowIndex < 0) + if (rowIndex >= this.RowCount || rowIndex < 0) { throw new ArgumentOutOfRangeException("rowIndex"); } - if (columnIndex >= ColumnCount || columnIndex < 0) + if (columnIndex >= this.ColumnCount || columnIndex < 0) { throw new ArgumentOutOfRangeException("columnIndex"); } @@ -1099,29 +1100,29 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentOutOfRangeException("rowLength", "rowLength can be at most the number of rows in subMatrix."); } - int colMax = columnIndex + columnLength; - int rowMax = rowIndex + rowLength; + var colMax = columnIndex + columnLength; + var rowMax = rowIndex + rowLength; - if (rowMax > RowCount) + if (rowMax > this.RowCount) { throw new ArgumentOutOfRangeException("rowLength"); } - if (colMax > ColumnCount) + if (colMax > this.ColumnCount) { throw new ArgumentOutOfRangeException("columnLength"); } CommonParallel.For( - columnIndex, - colMax, + columnIndex, + colMax, j => + { + for (int i = rowIndex, ii = 0; i < rowMax; i++, ii++) { - for (int i = rowIndex, ii = 0; i < rowMax; i++, ii++) - { - At(i, j, subMatrix[ii, j - columnIndex]); - } - }); + this.At(i, j, subMatrix[ii, j - columnIndex]); + } + }); } /// @@ -1141,7 +1142,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("source"); } - int min = Math.Min(RowCount, ColumnCount); + var min = Math.Min(this.RowCount, this.ColumnCount); if (source.Count != min) { @@ -1149,8 +1150,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double } CommonParallel.For( - 0, - min, + 0, + min, i => this.At(i, i, source[i])); } @@ -1171,7 +1172,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("source"); } - int min = Math.Min(RowCount, ColumnCount); + var min = Math.Min(this.RowCount, this.ColumnCount); if (source.Length != min) { @@ -1179,8 +1180,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double } CommonParallel.For( - 0, - min, + 0, + min, i => this.At(i, i, source[i])); } @@ -1197,17 +1198,17 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("result"); } - if (result.RowCount != RowCount || result.ColumnCount != ColumnCount) + if (result.RowCount != this.RowCount || result.ColumnCount != this.ColumnCount) { throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.For( - 0, - RowCount, + 0, + this.RowCount, i => { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { result.At(i, j, i < j ? this.At(i, j) : 0); } @@ -1220,15 +1221,15 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A multidimensional containing the values of this matrix. public virtual double[,] ToArray() { - var ret = new double[RowCount, ColumnCount]; + var ret = new double[this.RowCount, this.ColumnCount]; CommonParallel.For( - 0, - ColumnCount, + 0, + this.ColumnCount, j => { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { - ret[i, j] = At(i, j); + ret[i, j] = this.At(i, j); } }); return ret; @@ -1245,11 +1246,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// An array containing the matrix's elements. public virtual double[] ToColumnWiseArray() { - var ret = new double[RowCount * ColumnCount]; - foreach (KeyValuePair column in ColumnEnumerator()) + var ret = new double[this.RowCount * this.ColumnCount]; + foreach (var column in this.ColumnEnumerator()) { - int columnIndex = column.Key * RowCount; - foreach (KeyValuePair element in column.Value.GetIndexedEnumerator()) + var columnIndex = column.Key * this.RowCount; + foreach (var element in column.Value.GetIndexedEnumerator()) { ret[columnIndex + element.Key] = element.Value; } @@ -1269,12 +1270,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// An array containing the matrix's elements. public virtual double[] ToRowWiseArray() { - var ret = new double[RowCount * ColumnCount]; + var ret = new double[this.RowCount * this.ColumnCount]; - foreach (KeyValuePair row in RowEnumerator()) + foreach (var row in this.RowEnumerator()) { - int rowIndex = row.Key * ColumnCount; - foreach (KeyValuePair element in row.Value.GetIndexedEnumerator()) + var rowIndex = row.Key * this.ColumnCount; + foreach (var element in row.Value.GetIndexedEnumerator()) { ret[rowIndex + element.Key] = element.Value; } @@ -1286,6 +1287,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double #region Implemented Interfaces #if !SILVERLIGHT + #region ICloneable /// @@ -1296,10 +1298,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// object ICloneable.Clone() { - return Clone(); + return this.Clone(); } #endregion + #endif #region IEquatable @@ -1311,7 +1314,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// An object to compare with this object. /// /// - /// true if the current object is equal to the parameter; otherwise, false. + /// true if the current object is equal to the parameter; otherwise, false. /// public bool Equals(Matrix other) { @@ -1321,7 +1324,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double return false; } - if (ColumnCount != other.ColumnCount || RowCount != other.RowCount) + if (this.ColumnCount != other.ColumnCount || this.RowCount != other.RowCount) { return false; } @@ -1333,11 +1336,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double } // If all else fails, perform element wise comparison. - for (var row = 0; row < RowCount; row++) + for (var row = 0; row < this.RowCount; row++) { - for (var column = 0; column < ColumnCount; column++) + for (var column = 0; column < this.ColumnCount; column++) { - if (At(row, column) != other.At(row, column)) + if (this.At(row, column) != other.At(row, column)) { return false; } @@ -1366,18 +1369,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double public string ToString(string format, IFormatProvider formatProvider) { var stringBuilder = new StringBuilder(); - for (var row = 0; row < RowCount; row++) + for (var row = 0; row < this.RowCount; row++) { - for (var column = 0; column < ColumnCount; column++) + for (var column = 0; column < this.ColumnCount; column++) { - stringBuilder.Append(At(row, column).ToString(format, formatProvider)); - if (column != ColumnCount - 1) + stringBuilder.Append(this.At(row, column).ToString(format, formatProvider)); + if (column != this.ColumnCount - 1) { stringBuilder.Append(formatProvider.GetTextInfo().ListSeparator); } } - if (row != RowCount - 1) + if (row != this.RowCount - 1) { stringBuilder.Append(Environment.NewLine); } @@ -1401,12 +1404,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// private void RangeCheck(int row, int column) { - if (row < 0 || row >= RowCount) + if (row < 0 || row >= this.RowCount) { throw new ArgumentOutOfRangeException("row"); } - if (column < 0 || column >= ColumnCount) + if (column < 0 || column >= this.ColumnCount) { throw new ArgumentOutOfRangeException("column"); } @@ -1423,7 +1426,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public override bool Equals(object obj) { - return Equals(obj as Matrix); + return this.Equals(obj as Matrix); } /// @@ -1434,12 +1437,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public override int GetHashCode() { - var hashNum = Math.Min(RowCount * ColumnCount, 25); + var hashNum = Math.Min(this.RowCount * this.ColumnCount, 25); long hash = 0; for (var i = 0; i < hashNum; i++) { - var col = i % ColumnCount; - var row = (i - col) / RowCount; + var col = i % this.ColumnCount; + var row = (i - col) / this.RowCount; #if SILVERLIGHT hash ^= Precision.DoubleToInt64Bits(this[row, col]); @@ -1458,11 +1461,11 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public virtual void Clear() { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { - for (int j = 0; j < ColumnCount; j++) + for (var j = 0; j < this.ColumnCount; j++) { - At(i, j, 0); + this.At(i, j, 0); } } } @@ -1473,12 +1476,12 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// The transpose of this matrix. public virtual Matrix Transpose() { - Matrix ret = CreateMatrix(ColumnCount, RowCount); - for (int j = 0; j < ColumnCount; j++) + var ret = this.CreateMatrix(this.ColumnCount, this.RowCount); + for (var j = 0; j < this.ColumnCount; j++) { - for (int i = 0; i < RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { - ret.At(j, i, At(i, j)); + ret.At(j, i, this.At(i, j)); } } @@ -1497,18 +1500,18 @@ namespace MathNet.Numerics.LinearAlgebra.Double } // Get a sequence of inversions from the permutation. - int[] inv = p.ToInversions(); + var inv = p.ToInversions(); - for (int i = 0; i < p.Dimension; i++) + for (var i = 0; i < p.Dimension; i++) { if (inv[i] != i) { - int q = inv[i]; - for (int j = 0; j < this.ColumnCount; j++) + var q = inv[i]; + for (var j = 0; j < this.ColumnCount; j++) { - double temp = At(q, j); - At(q, j, At(i, j)); - At(i, j, temp); + var temp = this.At(q, j); + this.At(q, j, this.At(i, j)); + this.At(i, j, temp); } } } @@ -1526,24 +1529,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double } // Get a sequence of inversions from the permutation. - int[] inv = p.ToInversions(); + var inv = p.ToInversions(); - for (int i = 0; i < p.Dimension; i++) + for (var i = 0; i < p.Dimension; i++) { if (inv[i] != i) { - int q = inv[i]; - for (int j = 0; j < this.RowCount; j++) + var q = inv[i]; + for (var j = 0; j < this.RowCount; j++) { - double temp = At(j, q); - At(j, q, At(j, i)); - At(j, i, temp); + var temp = this.At(j, q); + this.At(j, q, this.At(j, i)); + this.At(j, i, temp); } } } } - /// + /// /// Concatenates this matrix with the given matrix. /// /// The matrix to concatenate. @@ -1555,13 +1558,13 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("right"); } - if (right.RowCount != RowCount) + if (right.RowCount != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension); } - Matrix result = CreateMatrix(RowCount, ColumnCount + right.ColumnCount); - Append(right, result); + var result = this.CreateMatrix(this.RowCount, this.ColumnCount + right.ColumnCount); + this.Append(right, result); return result; } @@ -1577,7 +1580,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("right"); } - if (right.RowCount != RowCount) + if (right.RowCount != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameRowDimension); } @@ -1587,7 +1590,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("result"); } - if (result.ColumnCount != (ColumnCount + right.ColumnCount) || result.RowCount != RowCount) + if (result.ColumnCount != (this.ColumnCount + right.ColumnCount) || result.RowCount != this.RowCount) { throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension); } @@ -1599,20 +1602,20 @@ namespace MathNet.Numerics.LinearAlgebra.Double { for (var j = 0; j < this.ColumnCount; j++) { - result.At(i, j, At(i, j)); + result.At(i, j, this.At(i, j)); } } - }, + }, () => { for (var i = 0; i < this.RowCount; i++) { for (var j = 0; j < right.ColumnCount; j++) { - result.At(i, j + ColumnCount, right.At(i, j)); + result.At(i, j + this.ColumnCount, right.At(i, j)); } } - }); + }); } /// @@ -1629,13 +1632,13 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("lower"); } - if (lower.ColumnCount != ColumnCount) + if (lower.ColumnCount != this.ColumnCount) { - throw new ArgumentException("lower", Resources.ArgumentMatrixSameColumnDimension); + throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "lower"); } - Matrix result = CreateMatrix(RowCount + lower.RowCount, ColumnCount); - Stack(lower, result); + var result = this.CreateMatrix(this.RowCount + lower.RowCount, this.ColumnCount); + this.Stack(lower, result); return result; } @@ -1652,10 +1655,10 @@ namespace MathNet.Numerics.LinearAlgebra.Double { throw new ArgumentNullException("lower"); } - - if (lower.ColumnCount != ColumnCount) + + if (lower.ColumnCount != this.ColumnCount) { - throw new ArgumentException("lower", Resources.ArgumentMatrixSameColumnDimension); + throw new ArgumentException(Resources.ArgumentMatrixSameColumnDimension, "lower"); } if (result == null) @@ -1663,35 +1666,35 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("result"); } - if (result.RowCount != (RowCount + lower.RowCount) || result.ColumnCount != ColumnCount) + if (result.RowCount != (this.RowCount + lower.RowCount) || result.ColumnCount != this.ColumnCount) { - throw new ArgumentException("result", Resources.ArgumentMatrixDimensions); + throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.Invoke( () => { - for (var i = 0; i < this.RowCount; i++) + for (var i = 0; i < this.RowCount; i++) { for (var j = 0; j < this.ColumnCount; j++) { - result.At(i, j, At(i, j)); + result.At(i, j, this.At(i, j)); } } - }, + }, () => { for (var i = 0; i < lower.RowCount; i++) { for (var j = 0; j < this.ColumnCount; j++) { - result.At(i + RowCount, j, lower.At(i, j)); + result.At(i + this.RowCount, j, lower.At(i, j)); } } }); } - /// + /// /// Diagonally stacks his matrix on top of the given matrix. The new matrix is a M-by-N matrix, /// where M = this.Rows + lower.Rows and N = this.Columns + lower.Columns. /// The values of off the off diagonal matrices/blocks are set to zero. @@ -1706,8 +1709,8 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("lower"); } - Matrix result = CreateMatrix(RowCount + lower.RowCount, ColumnCount + lower.ColumnCount); - DiagonalStack(lower, result); + var result = this.CreateMatrix(this.RowCount + lower.RowCount, this.ColumnCount + lower.ColumnCount); + this.DiagonalStack(lower, result); return result; } @@ -1731,9 +1734,9 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("result"); } - if (result.RowCount != RowCount + lower.RowCount || result.ColumnCount != ColumnCount + lower.ColumnCount) + if (result.RowCount != this.RowCount + lower.RowCount || result.ColumnCount != this.ColumnCount + lower.ColumnCount) { - throw new ArgumentException("result", Resources.ArgumentMatrixDimensions); + throw new ArgumentException(Resources.ArgumentMatrixDimensions, "result"); } CommonParallel.Invoke( @@ -1743,20 +1746,20 @@ namespace MathNet.Numerics.LinearAlgebra.Double { for (var j = 0; j < this.ColumnCount; j++) { - result.At(i, j, At(i, j)); + result.At(i, j, this.At(i, j)); } } - }, + }, () => { for (var i = 0; i < lower.RowCount; i++) { for (var j = 0; j < lower.ColumnCount; j++) { - result.At(i + RowCount, j + ColumnCount, lower.At(i, j)); + result.At(i + this.RowCount, j + this.ColumnCount, lower.At(i, j)); } } }); } - } + } } \ No newline at end of file diff --git a/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs b/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs index 94b15a35..c89c5ed0 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/LinearAlgebraProviderTests.cs @@ -157,7 +157,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { for (int j = 0; j < c.ColumnCount; j++) { - AssertHelpers.AlmostEqual(x.GetRow(i) * y.GetColumn(j), c[i, j], 15); + AssertHelpers.AlmostEqual(x.Row(i) * y.Column(j), c[i, j], 15); } } } @@ -180,7 +180,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { for (int j = 0; j < c.ColumnCount; j++) { - AssertHelpers.AlmostEqual(2 * (x.GetRow(i) * y.GetColumn(j)), c[i, j], 15); + AssertHelpers.AlmostEqual(2 * (x.Row(i) * y.Column(j)), c[i, j], 15); } } @@ -190,7 +190,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { for (int j = 0; j < c.ColumnCount; j++) { - AssertHelpers.AlmostEqual(4 * (x.GetRow(i) * y.GetColumn(j)), c[i, j], 15); + AssertHelpers.AlmostEqual(4 * (x.Row(i) * y.Column(j)), c[i, j], 15); } } } diff --git a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.Arithmetic.cs b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.Arithmetic.cs index 042e9ef2..76cadd55 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.Arithmetic.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.Arithmetic.cs @@ -64,7 +64,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double for (var i = 0; i < A.RowCount; i++) { - var ar = A.GetRow(i); + var ar = A.Row(i); var dot = ar * x; Assert.AreEqual(dot, y[i]); } @@ -80,7 +80,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double for (var i = 0; i < A.RowCount; i++) { - var ar = A.GetRow(i); + var ar = A.Row(i); var dot = ar * x; Assert.AreEqual(dot, y[i]); } @@ -99,7 +99,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double y = new DenseVector(new[] { 1.0, 2.0, 3.0 }); for (var i = 0; i < A.RowCount; i++) { - var ar = A.GetRow(i); + var ar = A.Row(i); var dot = ar * y; Assert.AreEqual(dot, x[i]); } @@ -446,7 +446,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { for (var j = 0; j < C.ColumnCount; j++) { - AssertHelpers.AlmostEqual(A.GetRow(i) * B.GetColumn(j), C[i, j], 15); + AssertHelpers.AlmostEqual(A.Row(i) * B.Column(j), C[i, j], 15); } } } @@ -499,7 +499,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { for (var j = 0; j < C.ColumnCount; j++) { - AssertHelpers.AlmostEqual(A.GetRow(i) * B.GetColumn(j), C[i, j], 15); + AssertHelpers.AlmostEqual(A.Row(i) * B.Column(j), C[i, j], 15); } } } @@ -631,7 +631,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double var result = matrix.NormalizeColumns(pValue); for (var j = 0; j < result.ColumnCount; j++) { - var col = result.GetColumn(j); + var col = result.Column(j); Assert.AreApproximatelyEqual(1.0, col.NormP(pValue), 10e-12); } } @@ -645,7 +645,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double var matrix = this.testMatrices["Singular3x3"].NormalizeRows(pValue); for (var i = 0; i < matrix.RowCount; i++) { - var row = matrix.GetRow(i); + var row = matrix.Row(i); Assert.AreApproximatelyEqual(1.0, row.NormP(pValue), 10e-12); } } diff --git a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs index a3a59f7e..0d594629 100644 --- a/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs +++ b/src/UnitTests/LinearAlgebraTests/Double/MatrixTests.cs @@ -238,7 +238,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void CanGetRow(int rowIndex, string name) { var matrix = this.testMatrices[name]; - var row = matrix.GetRow(rowIndex); + var row = matrix.Row(rowIndex); Assert.AreEqual(matrix.ColumnCount, row.Count); for (var j = 0; j < matrix.ColumnCount; j++) @@ -252,7 +252,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetRowThrowsArgumentOutOfRangeWithNegativeIndex() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetRow(-1); + matrix.Row(-1); } [Test] @@ -260,7 +260,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetRowThrowsArgumentOutOfRangeWithOverflowingRowIndex() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetRow(matrix.RowCount); + matrix.Row(matrix.RowCount); } [Test] @@ -272,7 +272,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices[name]; var row = CreateVector(matrix.ColumnCount); - matrix.GetRow(rowIndex, row); + matrix.Row(rowIndex, row); Assert.AreEqual(matrix.ColumnCount, row.Count); for (var j = 0; j < matrix.ColumnCount; j++) @@ -286,7 +286,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetRowWithResultFailsWhenResultIsNull() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetRow(0, null); + matrix.Row(0, null); } [Test] @@ -295,7 +295,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var row = CreateVector(matrix.ColumnCount); - matrix.GetRow(-1, row); + matrix.Row(-1, row); } [Test] @@ -304,7 +304,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var row = CreateVector(matrix.ColumnCount); - matrix.GetRow(matrix.RowCount, row); + matrix.Row(matrix.RowCount, row); } [Test] @@ -315,7 +315,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void CanGetRowWithRange(int rowIndex, int start, int length, string name) { var matrix = this.testMatrices[name]; - var row = matrix.GetRow(rowIndex, start, length); + var row = matrix.Row(rowIndex, start, length); Assert.AreEqual(length, row.Count); for (var j = start; j < start + length; j++) @@ -330,7 +330,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var result = CreateVector(matrix.ColumnCount); - matrix.GetRow(0, 0, 0, result); + matrix.Row(0, 0, 0, result); } [Test] @@ -339,7 +339,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var result = this.CreateVector(matrix.ColumnCount - 1); - matrix.GetRow(0, 0, 0, result); + matrix.Row(0, 0, 0, result); } [Test] @@ -350,7 +350,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void CanGetColumn(int colIndex, string name) { var matrix = this.testMatrices[name]; - var col = matrix.GetColumn(colIndex); + var col = matrix.Column(colIndex); Assert.AreEqual(matrix.RowCount, col.Count); for (var j = 0; j < matrix.RowCount; j++) @@ -364,7 +364,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetColumnThrowsArgumentOutOfRangeWithNegativeIndex() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetColumn(-1); + matrix.Column(-1); } [Test] @@ -372,7 +372,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetColumnThrowsArgumentOutOfRangeWithOverflowingRowIndex() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetColumn(matrix.ColumnCount); + matrix.Column(matrix.ColumnCount); } [Test] @@ -384,7 +384,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices[name]; var col = CreateVector(matrix.RowCount); - matrix.GetColumn(colIndex, col); + matrix.Column(colIndex, col); Assert.AreEqual(matrix.RowCount, col.Count); for (var j = 0; j < matrix.RowCount; j++) @@ -398,7 +398,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void GetColumnFailsWhenResultIsNull() { var matrix = this.testMatrices["Singular3x3"]; - matrix.GetColumn(0, null); + matrix.Column(0, null); } [Test] @@ -407,7 +407,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var column = CreateVector(matrix.ColumnCount); - matrix.GetColumn(-1, column); + matrix.Column(-1, column); } [Test] @@ -416,7 +416,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var column = CreateVector(matrix.RowCount); - matrix.GetRow(matrix.ColumnCount, column); + matrix.Row(matrix.ColumnCount, column); } [Test] @@ -427,7 +427,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double public void CanGetColumnWithRange(int colIndex, int start, int length, string name) { var matrix = this.testMatrices[name]; - var col = matrix.GetColumn(colIndex, start, length); + var col = matrix.Column(colIndex, start, length); Assert.AreEqual(length, col.Count); for (var j = start; j < start + length; j++) @@ -442,7 +442,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var col = CreateVector(matrix.RowCount); - matrix.GetColumn(0, 0, 0, col); + matrix.Column(0, 0, 0, col); } [Test] @@ -451,7 +451,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var matrix = this.testMatrices["Singular3x3"]; var result = this.CreateVector(matrix.RowCount - 1); - matrix.GetColumn(0, 0, matrix.RowCount, result); + matrix.Column(0, 0, matrix.RowCount, result); } [Test] @@ -517,7 +517,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var data = this.testMatrices[name]; var result = this.CreateMatrix(data.RowCount, data.ColumnCount); - var lower = data.GetUpperTriangle(); + var lower = data.UpperTriangle(); for (var i = 0; i < data.RowCount; i++) { for (var j = 0; j < data.ColumnCount; j++) @@ -541,7 +541,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var data = this.testMatrices["Square3x3"]; Matrix result = null; - data.GetUpperTriangle(result); + data.UpperTriangle(result); } [Test] @@ -550,7 +550,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var data = this.testMatrices["Square3x3"]; var result = this.CreateMatrix(data.RowCount + 1, data.ColumnCount); - data.GetUpperTriangle(result); + data.UpperTriangle(result); } [Test] @@ -559,7 +559,7 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests.Double { var data = this.testMatrices["Square3x3"]; var result = this.CreateMatrix(data.RowCount, data.ColumnCount + 1); - data.GetUpperTriangle(result); + data.UpperTriangle(result); } [Test]