Skip to content
Snippets Groups Projects
Commit 145b00d9 authored by Paul Nitzke's avatar Paul Nitzke
Browse files

Implement correct matrix output

* Adds support for seed and compressed matrix
parent 02ff9ae1
No related branches found
No related tags found
1 merge request!22Non-minor rewrites of the design spec to accomodate new requirements
......@@ -10,31 +10,34 @@ namespace SparseTransform.Convert
class MatrixMarketWriter : IWriter
{
private bool seed;
private DoubleMatrix doubleMatrix;
private IntegerMatrix intMatrix;
private DoubleMatrix inputMatrix;
public MatrixMarketWriter(bool seed, DoubleMatrix inputDoubleInput, IntegerMatrix inputIntInput)
public MatrixMarketWriter(bool seed, DoubleMatrix inputMatrix)
{
intMatrix = inputIntInput;
doubleMatrix = inputDoubleInput;
this.inputMatrix = inputMatrix;
this.seed = seed;
}
public string Write(IGraph graph)
{
IntegerMatrix? seedMatrix = graph.ToSeedMatrix(inputMatrix.RowCount);
if (seed)
{
// ziemlich wilder ausdruck, wa? Liefert die seed matrix aus einem AdjacencyGraph oder BipartiteGraph. (je nachdem was IGraph ist)
IntegerMatrix matrix = graph.ToSeedMatrix(graph is AdjacencyGraph ? ((AdjacencyGraph)graph).GetNodeCount() : ((BipartiteGraph)graph).GetRightNodeCount());
if (matrix.RowCount != 0)
if (seedMatrix is IntegerMatrix && seedMatrix.RowCount != 0)
{
return matrix.ToMatrixMarketString();
return seedMatrix.ToMatrixMarketString();
}
return "null";
}
else
{
if (seedMatrix is IntegerMatrix && inputMatrix is DoubleMatrix && seedMatrix.RowCount != 0)
{
return CalculateCompressedMatrix(inputMatrix, seedMatrix).ToMatrixMarketString();
}
return "null";
}
}
......@@ -43,9 +46,9 @@ namespace SparseTransform.Convert
/// todo
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void CalculateCompressedMatrix()
private DoubleMatrix CalculateCompressedMatrix(DoubleMatrix inputMatrix, IntegerMatrix seedMatrix)
{
throw new NotImplementedException();
return inputMatrix.Multiply(seedMatrix);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment