From 6c38d3b18492ca2631379162a4f04c14e943be95 Mon Sep 17 00:00:00 2001 From: Christoph Ruegg Date: Mon, 13 Aug 2012 22:31:58 +0200 Subject: [PATCH] LA: IsFullyMutable can be accessed via .Storage, no need to forward to Matrix class --- src/Numerics/LinearAlgebra/Generic/Matrix.cs | 18 ------------------ .../LinearAlgebra/Storage/MatrixStorage.cs | 8 ++++++++ .../MatrixStructureTheory.cs | 4 ++-- 3 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/Numerics/LinearAlgebra/Generic/Matrix.cs b/src/Numerics/LinearAlgebra/Generic/Matrix.cs index dfbc22ca..0bbe4999 100644 --- a/src/Numerics/LinearAlgebra/Generic/Matrix.cs +++ b/src/Numerics/LinearAlgebra/Generic/Matrix.cs @@ -204,24 +204,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic Storage.At(row, column, value); } - /// - /// True if all fields of this matrix can be set to any value. - /// False if some fields are fixed, like on a diagonal matrix. - /// - public bool IsFullyMutable - { - get { return Storage.IsFullyMutable; } - } - - /// - /// True if the specified field can be set to any value. - /// Fall if the field is fixed, like an off-diagonal field on a diagonal matrix. - /// - public bool IsMutable(int row, int column) - { - return Storage.IsMutable(row, column); - } - /// /// Sets all values to zero. /// diff --git a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs index 99dbe5aa..9aace840 100644 --- a/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs +++ b/src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs @@ -77,11 +77,19 @@ namespace MathNet.Numerics.LinearAlgebra.Storage /// WARNING: This method is not thread safe. Use "lock" with it and be sure to avoid deadlocks. public abstract void At(int row, int column, T value); + /// + /// True if all fields of this matrix can be set to any value. + /// False if some fields are fixed, like on a diagonal matrix. + /// public virtual bool IsFullyMutable { get { return true; } } + /// + /// True if the specified field can be set to any value. + /// Fall if the field is fixed, like an off-diagonal field on a diagonal matrix. + /// public virtual bool IsMutable(int row, int column) { return true; diff --git a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs index 8c54125c..bbf8a1c8 100644 --- a/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs +++ b/src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs @@ -19,14 +19,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests protected Matrix CreateDenseFor(Matrix m, int rows = -1, int columns = -1, int seed = 1) { - return m.IsFullyMutable + return m.Storage.IsFullyMutable ? CreateDenseRandom(rows >= 0 ? rows : m.RowCount, columns >= 0 ? columns : m.ColumnCount, seed) : CreateDenseZero(rows >= 0 ? rows : m.RowCount, columns >= 0 ? columns : m.ColumnCount); } protected Vector CreateVectorFor(Matrix m, int size, int seed = 1) { - return m.IsFullyMutable + return m.Storage.IsFullyMutable ? CreateVectorRandom(size, seed) : CreateVectorZero(size); }