Browse Source

Implemented DoTranspsoeThisAndMultiply for vectors on Double.

la-knuth
Alexander Karatarakis 16 years ago
committed by Marcus Cuda
parent
commit
ba4648d3cc
  1. 41
      src/Numerics/LinearAlgebra/Double/DenseMatrix.cs
  2. 18
      src/Numerics/LinearAlgebra/Double/Matrix.cs

41
src/Numerics/LinearAlgebra/Double/DenseMatrix.cs

@ -444,6 +444,47 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
}
/// <summary>
/// Multiplies the transpose of this matrix with a vector and places the results into the result vector.
/// </summary>
/// <param name="rightSide">The vector to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoTransposeThisAndMultiply(Vector<double> rightSide, Vector<double> result)
{
var denseRight = rightSide as DenseVector;
var denseResult = result as DenseVector;
if (denseRight == null || denseResult == null)
{
base.DoTransposeThisAndMultiply(rightSide, result);
}
else
{
Control.LinearAlgebraProvider.MatrixMultiplyWithUpdate(
Algorithms.LinearAlgebra.Transpose.DontTranspose,
Algorithms.LinearAlgebra.Transpose.DontTranspose,
1.0,
Data,
RowCount,
ColumnCount,
denseRight.Data,
denseRight.Count,
1,
0.0,
denseResult.Data);
}
}
/// <summary>
/// Multiplies the transpose of this matrix with another matrix and places the results into the result matrix.
/// </summary>
/// <param name="other">The matrix to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoTransposeThisAndMultiply(Matrix<double> other, Matrix<double> result)
{
throw new NotImplementedException();
}
/// <summary>
/// Negate each element of this matrix and place the results into the result matrix.
/// </summary>

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

@ -269,6 +269,24 @@ namespace MathNet.Numerics.LinearAlgebra.Double
}
}
/// <summary>
/// Multiplies the transpose of this matrix with a vector and places the results into the result vector.
/// </summary>
/// <param name="rightSide">The vector to multiply with.</param>
/// <param name="result">The result of the multiplication.</param>
protected override void DoTransposeThisAndMultiply(Vector<double> rightSide, Vector<double> result)
{
for (var i = 0; i < ColumnCount; i++)
{
var s = 0.0;
for (var j = 0; j != RowCount; j++)
{
s += At(j, i) * rightSide[j];
}
result[i] = s;
}
}
/// <summary>
/// Negate each element of this matrix and place the results into the result matrix.
/// </summary>

Loading…
Cancel
Save