Browse Source

LA: IsFullyMutable can be accessed via .Storage, no need to forward to Matrix class

la-knuth
Christoph Ruegg 14 years ago
parent
commit
6c38d3b184
  1. 18
      src/Numerics/LinearAlgebra/Generic/Matrix.cs
  2. 8
      src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs
  3. 4
      src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs

18
src/Numerics/LinearAlgebra/Generic/Matrix.cs

@ -204,24 +204,6 @@ namespace MathNet.Numerics.LinearAlgebra.Generic
Storage.At(row, column, value);
}
/// <summary>
/// True if all fields of this matrix can be set to any value.
/// False if some fields are fixed, like on a diagonal matrix.
/// </summary>
public bool IsFullyMutable
{
get { return Storage.IsFullyMutable; }
}
/// <summary>
/// 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.
/// </summary>
public bool IsMutable(int row, int column)
{
return Storage.IsMutable(row, column);
}
/// <summary>
/// Sets all values to zero.
/// </summary>

8
src/Numerics/LinearAlgebra/Storage/MatrixStorage.cs

@ -77,11 +77,19 @@ namespace MathNet.Numerics.LinearAlgebra.Storage
/// <remarks>WARNING: This method is not thread safe. Use "lock" with it and be sure to avoid deadlocks.</remarks>
public abstract void At(int row, int column, T value);
/// <summary>
/// True if all fields of this matrix can be set to any value.
/// False if some fields are fixed, like on a diagonal matrix.
/// </summary>
public virtual bool IsFullyMutable
{
get { return true; }
}
/// <summary>
/// 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.
/// </summary>
public virtual bool IsMutable(int row, int column)
{
return true;

4
src/UnitTests/LinearAlgebraTests/MatrixStructureTheory.cs

@ -19,14 +19,14 @@ namespace MathNet.Numerics.UnitTests.LinearAlgebraTests
protected Matrix<T> CreateDenseFor(Matrix<T> 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<T> CreateVectorFor(Matrix<T> m, int size, int seed = 1)
{
return m.IsFullyMutable
return m.Storage.IsFullyMutable
? CreateVectorRandom(size, seed)
: CreateVectorZero(size);
}

Loading…
Cancel
Save