diff --git a/src/MathNet.Numerics.5.0.ReSharper b/src/MathNet.Numerics.5.0.ReSharper index ca6c2a14..9922e4f4 100644 --- a/src/MathNet.Numerics.5.0.ReSharper +++ b/src/MathNet.Numerics.5.0.ReSharper @@ -3,6 +3,742 @@ SOLUTION + + + + + + en-US + false + pointwise + + + + en-US + en-US + en-US + + en-US + + + Public Protected ProtectedInternal + Any + Maybe + Maybe + Any + + + false + 80 + + + + + false + + + Any + Class + Maybe + Maybe + Any + + + Any + Enum + + Maybe + Maybe + Any + + + Any + EnumerationMember + + Maybe + Maybe + Any + + + + Classes, Enumerations, Enumeration values should be named in Pascal + + + _ + m_ + + Pascal + + + + + false + + + Public Internal Protected ProtectedInternal + Property + + Maybe + Maybe + Any + + + Public Internal Protected ProtectedInternal + Method + + Maybe + Maybe + Any + + + Public Internal Protected ProtectedInternal + Event + + Maybe + Maybe + Any + + + + Non private properties, methods, events should be in pascal. + + + _ + m_ + + Pascal + + + + + true + + + Private + Property + + Maybe + Maybe + Any + + + Private + Method + + Maybe + Maybe + Any + + + Private + Event + + Maybe + Maybe + Any + + + + Private properties, methods, events should be in camel. + + + _ + m_ + + Camel + + + + + false + + + Any + Field + + Maybe + Maybe + Any + + + + Fields should be underscore camel. + + _ + + + m_ + + Camel + + + + + false + + + Any + Variable + Maybe + Maybe + Any + + + Variable should be declared in camel. + + + _ + m_ + + Camel + + + + + false + + + Any + Parameter + Maybe + Maybe + Any + + + Function parameters should be in camel. + + + _ + m_ + + Camel + + + + + false + + + Any + Namespace + Maybe + Maybe + Any + + + Namespaces should be in Pascal. + + + _ + m_ + + Pascal + + + + + false + + + Any + Constant + Maybe + Maybe + Any + + + Constants should be in capital. + + + UpperCase + + + + + false + + + Any + Any + Maybe + Maybe + Any + + + + + Any + Constant + Maybe + Maybe + Any + + + Acronyms should not have more than 2 characters. + + + MatchesRegex + + + ^(?>(XML|SQL|[A-Z]{0,2})[A-Z]?([^A-Z]|$)|[^A-Z]+)*$ + + + false + + + Any + Any + Maybe + Maybe + Any + + + + + Any + Constant + + Maybe + Maybe + Any + + + Any + Field + + Maybe + Maybe + Any + + + Private + Method + + Maybe + Maybe + Any + + + None + Namespace + Maybe + Maybe + Any + + + Names should not have underscore character + + + NotMatchesRegex + + + (?<remove>_) + + + false + + + Any + Class + NUnit.Framework.TestFixtureAttribute + Maybe + Maybe + Any + + + TestFixtures should end with Test. + + + Test + + None + + Test + + + + + false + + + Any + Method + NUnit.Framework.TestAttribute + Maybe + Maybe + Any + + + Test methods should start with Test. + + Test + + + None + + + Test + + + + false + + + Any + Enum + Maybe + Maybe + Any + + + Enumerations should not end with Enum. + + + None + + + Enum + + + + false + + + Any + EnumerationMember + Maybe + Maybe + Any + + + Do not name enumerations reserved. + + + NotMatchesRegex + + + (?<remove>(reserved|Reserved)) + + + false + + + Any + Event + Maybe + Maybe + Any + + + Event should not have Before or After prefix. + + + Before + After + + None + + + + + false + + + Any + Enum + System.FlagsAttribute + Maybe + Maybe + Any + + + Flags enums should have plural names + + + None + + s + + + + + true + + + Any + Enum + Maybe + Maybe + Any + + + + + Any + Enum + System.FlagsAttribute + Maybe + Maybe + Any + + + Enums that are not flags should not have plural names + + + None + + + s + + + + false + + + Any + Class + System.Attribute + Maybe + Maybe + Any + + + Attribute should end with Attribute. + + + None + + Attribute + + + + + false + + + Any + Class + System.EventArgs + Maybe + Maybe + Any + + + EventArgs should end with EventArgs. + + + None + + EventArgs + + + + + false + + + Any + Class + System.Exception + Maybe + Maybe + Any + + + Exceptions should end with Exception. + + + None + + Exception + + + + + false + + + Any + Class + System.Collections.Stack + Maybe + Maybe + Any + + + Any + Class + System.Collections.Generic.Stack + + Maybe + Maybe + Any + + + + Stack should end with Collection or Stack. + + + None + + Collection + Stack + + + + + false + + + Any + Class + System.Collections.ICollection + Maybe + Maybe + Any + + + Any + Class + System.Collections.IEnumerable + Maybe + Maybe + Any + + + Any + Class + System.Collections.Generic.ICollection + Maybe + Maybe + Any + + + + + Any + Class + System.Collections.Stack + Maybe + Maybe + Any + + + Any + Class + System.Collections.Queue + Maybe + Maybe + Any + + + Any + Class + System.Collections.Generic.Stack + + Maybe + Maybe + Any + + + Collections should end with Collection. + + + None + + Collection + + + + + false + + + Any + Class + System.Collections.IDictionary + Maybe + Maybe + Any + + + Any + Class + System.Collections.Generic.IDictionary + Maybe + Maybe + Any + + + Dictionary should end with Dictionary. + + + None + + Dictionary + + + + + false + + + Any + Class + System.Collections.Queue + Maybe + Maybe + Any + + + Queue should end with Collection or Queue. + + + None + + Collection + Queue + + + + + false + + + Any + Interface + Maybe + Maybe + Any + + + Interfaces should be in Pascal and start with I. + + I + + + Pascal + + + + + + + + + Public Protected ProtectedInternal + Any + Maybe + Maybe + Any + + + + (?#email)\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)* + (?#url)http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)? + + + NEXT_LINE diff --git a/src/Numerics/LinearAlgebra/Double/DenseVector.cs b/src/Numerics/LinearAlgebra/Double/DenseVector.cs index 29202a4c..aa9dcab3 100644 --- a/src/Numerics/LinearAlgebra/Double/DenseVector.cs +++ b/src/Numerics/LinearAlgebra/Double/DenseVector.cs @@ -138,7 +138,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// Returns a reference to the internal data structure. /// - /// The DenseVector whose internal data we are + /// The DenseVector whose internal data we are /// returning. /// /// A reference to the internal date of the given vector. @@ -156,7 +156,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// Returns a vector bound directly to a reference of the provided array. /// - /// The array to bind to the DenseVector object. + /// The array to bind to the DenseVector object. /// /// A DenseVector whose values are bound to the given array. /// @@ -404,7 +404,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } /// - /// Returns a Vector containing the same values of rightSide. + /// Returns a Vector containing the same values of . /// /// This method is included for completeness. /// The vector to get the values from. @@ -560,7 +560,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } /// - /// Returns a Vector containing the negated values of rightSide. + /// Returns a Vector containing the negated values of . /// /// The vector to get the values from. /// A vector containing the negated values as . @@ -1137,7 +1137,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A vector with n-random elements distributed according /// to the specified random distribution. /// - /// If the n vector is non poisitive. + /// If the n vector is non positive. public override Vector Random(int length, IContinuousDistribution randomDistribution) { if (length < 1) @@ -1163,7 +1163,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A vector with n-random elements distributed according /// to the specified random distribution. /// - /// If the n vector is non poisitive. + /// If the n vector is non positive. public override Vector Random(int length, IDiscreteDistribution randomDistribution) { if (length < 1) @@ -1198,7 +1198,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// Euclidean Norm also known as 2-Norm. /// - /// Scalar ret = sqrt(sum(this[i]^2)) + /// Scalar ret = sqrt(sum(this[i]^2)) public override double Norm() { var sum = 0.0; @@ -1214,7 +1214,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// 1-Norm also known as Manhattan Norm or Taxicab Norm. /// - /// Scalar ret = sum(abs(this[i])) + /// Scalar ret = sum(abs(this[i])) public override double Norm1() { return CommonParallel.Aggregate( @@ -1227,7 +1227,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Computes the p-Norm. /// /// The p value. - /// Scalar ret = (sum(abs(this[i])^p))^(1/p) + /// Scalar ret = (sum(abs(this[i])^p))^(1/p) public override double NormP(int p) { if (1 > p) @@ -1256,7 +1256,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// Infinity Norm. /// - /// Scalar ret = max(abs(this[i])) + /// Scalar ret = max(abs(this[i])) public override double NormInfinity() { return CommonParallel.Select( diff --git a/src/Numerics/LinearAlgebra/Double/SparseVector.cs b/src/Numerics/LinearAlgebra/Double/SparseVector.cs index fb811533..e324f7e4 100644 --- a/src/Numerics/LinearAlgebra/Double/SparseVector.cs +++ b/src/Numerics/LinearAlgebra/Double/SparseVector.cs @@ -183,14 +183,13 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// This vector as a column matrix. public override Matrix ToColumnMatrix() { - throw new NotImplementedException(); - -// var matrix = new SparseMatrix(this.Count, 1); - // CommonParallel.For( - // 0, - // this.Count, - // index => matrix[i, 0] = vector[index]); - // return matrix; + var matrix = new SparseMatrix(this.Count, 1); + for (var i = 0; i < this.NonZerosCount; i++) + { + matrix[this._nonZeroIndices[i], 0] = this._nonZeroValues[i]; + } + + return matrix; } /// @@ -199,14 +198,13 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// This vector as a row matrix. public override Matrix ToRowMatrix() { - throw new NotImplementedException(); - -// var matrix = new SparseMatrix(1, this.Count); - // CommonParallel.For( - // 0, - // this.Count, - // index => matrix[0, i] = vector[index]); - // return matrix; + var matrix = new SparseMatrix(1, this.Count); + for (var i = 0; i < this.NonZerosCount; i++) + { + matrix[0, this._nonZeroIndices[i]] = this._nonZeroValues[i]; + } + + return matrix; } /// Gets or sets the value at the given . @@ -267,9 +265,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// public override Matrix CreateMatrix(int rows, int columns) { - throw new NotImplementedException(); - -// return new SparseMatrix(rows, columns); + return new SparseMatrix(rows, columns); } /// @@ -427,7 +423,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } /// - /// Adds the scaled sparce vector. + /// Adds the scaled sparse vector. /// /// The alpha. /// The other. @@ -535,7 +531,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } /// - /// Returns a Vector containing the same values of rightSide. + /// Returns a Vector containing the same values of . /// /// This method is included for completeness. /// The vector to get the values from. @@ -691,7 +687,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double } /// - /// Returns a Vector containing the negated values of rightSide. + /// Returns a Vector containing the negated values of . /// /// The vector to get the values from. /// A vector containing the negated values as . @@ -1221,20 +1217,19 @@ namespace MathNet.Numerics.LinearAlgebra.Double throw new ArgumentNullException("v"); } - throw new NotImplementedException(); - -// var matrix = new DenseMatrix(u.Count, v.Count); - // CommonParallel.For( - // 0, - // u.Count, - // i => - // { - // for (int j = 0; j < v.Count; j++) - // { - // matrix.At(i, j, u.Data[i] * v.Data[j]); - // } - // }); - // return matrix; + var matrix = new SparseMatrix(u.Count, v.Count); + for (var i = 0; i < u.NonZerosCount; i++) + { + for (var j = 0; j < v.NonZerosCount; j++) + { + if (u._nonZeroIndices[i] == v._nonZeroIndices[j]) + { + matrix.At(i, j, u._nonZeroValues[i] * v._nonZeroValues[j]); + } + } + } + + return matrix; } /// @@ -1246,7 +1241,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A vector with n-random elements distributed according /// to the specified random distribution. /// - /// If the length vector is non poisitive. + /// If the length vector is non positive. public override Vector Random(int length, IContinuousDistribution randomDistribution) { if (length < 0) @@ -1272,7 +1267,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// A vector with n-random elements distributed according /// to the specified random distribution. /// - /// If the n vector is non poisitive. + /// If the n vector is non positive. public override Vector Random(int length, IDiscreteDistribution randomDistribution) { if (length < 0) @@ -1310,7 +1305,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// Computes the p-Norm. /// /// The p value. - /// Scalar ret = (sum(abs(this[i])^p))^(1/p) + /// Scalar ret = (sum(abs(this[i])^p))^(1/p) public override double NormP(int p) { if (1 > p) @@ -1329,7 +1324,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// /// Infinity Norm. /// - /// Scalar ret = max(abs(this[i])) + /// Scalar ret = max(abs(this[i])) public override double NormInfinity() { return CommonParallel.Select(0, this.NonZerosCount, (index, localData) => localData = Math.Max(localData, Math.Abs(this._nonZeroValues[index])), Math.Max); @@ -1344,7 +1339,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// quotes): 'n', 'n,n,..', '(n,n,..)', '[n,n,...]', where n is a double. /// /// - /// A double sparce vector containing the values specified by the given string. + /// A double sparse vector containing the values specified by the given string. /// /// /// The string to parse. @@ -1359,7 +1354,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double /// quotes): 'n', 'n,n,..', '(n,n,..)', '[n,n,...]', where n is a double. /// /// - /// A double sparce vector containing the values specified by the given string. + /// A double sparse vector containing the values specified by the given string. /// /// /// the string to parse. @@ -1596,7 +1591,7 @@ namespace MathNet.Numerics.LinearAlgebra.Double #region System.Object override /// - /// Check equality. If this is regular vector, then chek by base implementation. If Sparse - use own equition + /// Check equality. If this is regular vector, then check by base implementation. If Sparse - use own method. /// /// Object to compare /// diff --git a/src/Numerics/Numerics.csproj b/src/Numerics/Numerics.csproj index 5179f244..3b5114f1 100644 --- a/src/Numerics/Numerics.csproj +++ b/src/Numerics/Numerics.csproj @@ -101,6 +101,7 @@ + diff --git a/src/Silverlight/Silverlight.csproj b/src/Silverlight/Silverlight.csproj index ce5b8d66..169b6e65 100644 --- a/src/Silverlight/Silverlight.csproj +++ b/src/Silverlight/Silverlight.csproj @@ -242,6 +242,9 @@ LinearAlgebra\Double\Matrix.cs + + LinearAlgebra\Double\SparseMatrix.cs + LinearAlgebra\Double\SparseVector.cs diff --git a/src/UnitTests/UnitTests.csproj b/src/UnitTests/UnitTests.csproj index 9afe6344..0a1bafa6 100644 --- a/src/UnitTests/UnitTests.csproj +++ b/src/UnitTests/UnitTests.csproj @@ -90,6 +90,7 @@ +