private static void TestMatrixVectorMultiplicationIntoResult(LinearAlgebraProviderChoice providers) { TestSettings.RunMultiproviderTest(providers, delegate() { // The result vectors will first be set to some non zero values to make sure that the result overwrites // them instead of being added to them. // MultiplyIntoResult() - untransposed var A = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); var x5 = Vector.CreateFromArray(SparseRectangular10by5.Lhs5); var b10Expected = Vector.CreateFromArray(SparseRectangular10by5.Rhs10); Vector b10Computed = Vector.CreateWithValue(SparseRectangular10by5.NumRows, 1.0); //Vector bComputed = Vector.CreateZero(SparseRectangular10by5.NumRows); A.MultiplyIntoResult(x5, b10Computed, false); comparer.AssertEqual(b10Expected, b10Computed); // MultiplyIntoResult() - transposed var x10 = Vector.CreateFromArray(SparseRectangular10by5.Lhs10); var b5Expected = Vector.CreateFromArray(SparseRectangular10by5.Rhs5); Vector b5Computed = Vector.CreateWithValue(SparseRectangular10by5.NumCols, 1.0); A.MultiplyIntoResult(x10, b5Computed, true); comparer.AssertEqual(b5Expected, b5Computed); }); }
private static void TestEquality() { // Equals(SkylineMatrix) var full1 = Matrix.CreateFromArray(SparsePosDef10by10.Matrix); var skyline1 = SkylineMatrix.CreateFromArrays(SparsePosDef10by10.Order, SparsePosDef10by10.SkylineValues, SparsePosDef10by10.SkylineDiagOffsets, true, true); Assert.True(full1.Equals(skyline1)); // Equals(CsrMatrix) var full2 = Matrix.CreateFromArray(SparseRectangular10by5.Matrix); var csr2 = CsrMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CsrValues, SparseRectangular10by5.CsrColIndices, SparseRectangular10by5.CsrRowOffsets, true); Assert.True(full2.Equals(csr2)); // Equals(CscMatrix) var full3 = Matrix.CreateFromArray(SparseRectangular10by5.Matrix); var csc3 = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); Assert.True(full3.Equals(csc3)); }
public static Matrix CalcSchurComplementFull(Matrix A, CscMatrix B, LdlSkyline inverseC) { // S = A - B^T * inv(C) * B Matrix invCB = Matrix.CreateZero(inverseC.Order, B.NumColumns); inverseC.SolveLinearSystems(B, invCB); return(A - B.MultiplyRight(invCB, true)); }
/// <summary> /// Will do nothing if it was already called. To perform this for a different stiffness matrix, first call /// <see cref="Clear"/>. /// </summary> public void ExtractKcrKrc(int[] cornerDofs, int[] remainderDofs) { if (Krc != null) { return; } Krc = linearSystem.Matrix.GetSubmatrixCsc(remainderDofs, cornerDofs); }
private static void TestSparseRectangularCSC() { var matrix = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); TestWriteOperation(matrix, SparseRectangular10by5.FullFormatPath); }
private static void TestMatrixCopy() { var full = Matrix.CreateFromArray(SparseRectangular10by5.Matrix); var csc = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); comparer.AssertEqual(full, csc.CopyToFullMatrix()); }
private static void TestEquality() { var full = Matrix.CreateFromArray(SparseRectangular10by5.Matrix); var csc = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); Assert.True(csc.Equals(full)); }
private static void TestClear() { var zero = Matrix.CreateZero(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols); var csc = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); csc.Clear(); comparer.AssertEqual(zero, csc); }
/// <summary> /// If the matrices stored in this object have already been calculated, they will be reused even if the original /// free-free stiffness matrix has changed. To avoid that, this method must be called. /// </summary> public void Clear() { inverseKff = null; RigidBodyModes = null; inverseKii = null; inverseKiiDiagonal = null; Kbb = null; Kib = null; //linearSystem.Matrix = null; // DO NOT DO THAT!!! The analyzer manages that. }
private static void TestSparseRectangularCSC() { // The reference file has been written by iterating the entries in CSC order. // Therefore it cannot be used for checking with a CSR matrix. var matrix = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); TestWriteOperation(matrix, SparseRectangular10by5.CoordinateFormatPath); }
/// <summary> /// Will do nothing if it was already called. To perform this for a different stiffness matrix, first call /// <see cref="Clear"/>. /// </summary> public void Clear() { inverseKii = null; inverseKiiDiagonal = null; inverseKrr = null; Kbb = null; Kib = null; Kcc = null; Krc = null; Krr = null; KccStar = null; //linearSystem.Matrix = null; // DO NOT DO THAT!!! The analyzer manages that. }
private static void TestGetColumn() { var matrix = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); for (int j = 0; j < SparseRectangular10by5.NumCols; ++j) { Vector colExpected = DenseStrategies.GetColumn(matrix, j); Vector colComputed = matrix.GetColumn(j); comparer.AssertEqual(colExpected, colComputed); } }
public void SolveLinearSystems(CscMatrix rhsVectors, Matrix solutionVectors) { Preconditions.CheckSystemSolutionDimensions(this.NumRows, rhsVectors.NumRows); Preconditions.CheckMultiplicationDimensions(this.Order, solutionVectors.NumRows); Preconditions.CheckSameColDimension(rhsVectors, solutionVectors); for (int j = 0; j < rhsVectors.NumColumns; ++j) { double[] rhsColumn = rhsVectors.GetColumn(j).RawData; int offset = j * NumRows; SolveWithOffsets(Order, values, diagOffsets, rhsColumn, 0, solutionVectors.RawData, offset); } }
private static void TestGetRow() { var matrix = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); for (int i = 0; i < SparseRectangular10by5.NumRows; ++i) { Vector rowExpected = DenseStrategies.GetRow(matrix, i); Vector rowComputed = matrix.GetRow(i); comparer.AssertEqual(rowExpected, rowComputed); } }
internal static CscMatrix GetSubmatrixCsc(double[] skyValues, int[] skyDiagOffsets, int[] rowsToKeep, int[] colsToKeep) { if ((rowsToKeep.Length == 0) || (colsToKeep.Length == 0)) { return(CscMatrix.CreateFromArrays(rowsToKeep.Length, colsToKeep.Length, new double[0], new int[0], new int[1] { 0 }, false)); } var submatrix = DokColMajor.CreateEmpty(rowsToKeep.Length, colsToKeep.Length); for (int subCol = 0; subCol < colsToKeep.Length; ++subCol) { int col = colsToKeep[subCol]; int diagOffset = skyDiagOffsets[col]; int colHeight = skyDiagOffsets[col + 1] - diagOffset - 1; // excluding diagonal for (int subRow = 0; subRow < rowsToKeep.Length; ++subRow) { int row = rowsToKeep[subRow]; if (row <= col) { int entryHeight = col - row; // excluding diagonal if (entryHeight <= colHeight) // inside stored non zero pattern { double val = skyValues[diagOffset + entryHeight]; if (val != 0.0) { submatrix[subRow, subCol] = val; // Skyline format stores many unnecessary zeros. } } } else // Transpose row <-> col. The cached column height and offset must be recalculated. { int transposedDiagOffset = skyDiagOffsets[row]; int transposedColHeight = skyDiagOffsets[row + 1] - transposedDiagOffset - 1; // excluding diagonal int entryHeight = row - col; // excluding diagonal if (entryHeight <= transposedColHeight) // inside stored non zero pattern { double val = skyValues[transposedDiagOffset + entryHeight]; if (val != 0.0) { submatrix[subRow, subCol] = val; // Skyline format stores many unnecessary zeros. } } } } } return(submatrix.BuildCscMatrix(true)); }
private static void TestBuildCSR() { var dense = Matrix.CreateFromArray(SparseRectangular10by5.Matrix); DokColMajor dok = CreateDok(SparseRectangular10by5.Matrix); // CSR with sorted col indices of each row CscMatrix cscSorted = dok.BuildCscMatrix(true); comparer.AssertEqual(dense, cscSorted); // CSR without sorting CscMatrix cscUnsorted = dok.BuildCscMatrix(false); comparer.AssertEqual(dense, cscUnsorted); }
private static void TestSymmSystemSolution() { double pivotTolerance = 0.5; int order = SparseSymm5by5.Order; var csc = CscMatrix.CreateFromArrays(order, order, SparseSymm5by5.CscValues, SparseSymm5by5.CscRowIndices, SparseSymm5by5.CscColOffsets, true); var xExpected = Vector.CreateWithValue(order, 1.0); var b = csc.Multiply(xExpected); var factor = LUCSparseNet.Factorize(order, csc.NumNonZeros, csc.RawValues, csc.RawRowIndices, csc.RawColOffsets, pivotTolerance); Vector xComputed = factor.SolveLinearSystem(b); comparer.AssertEqual(xExpected, xComputed); }
[Fact] //TODO: If the explicit transposition becomes abstracted behind a provider, then this should also be a Theory private static void TestTransposition() { var matrix = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); var transposeExpected = Matrix.CreateFromArray(MatrixOperations.Transpose(SparseRectangular10by5.Matrix)); // TransposeToCSC() CscMatrix transposeCsc = matrix.TransposeToCSC(); comparer.AssertEqual(transposeExpected, transposeCsc); // TransposeToCSR() CsrMatrix transposeCsr = matrix.TransposeToCSR(true); comparer.AssertEqual(transposeExpected, transposeCsr); }
/// <summary> /// Will do nothing if it was already called. To perform this for a different stiffness matrix, first call /// <see cref="Clear"/>. /// </summary> public void ExtractKbiKib(int[] boundaryDofs, int[] internalDofs) { if (Kib != null) { return; } try { Kib = Krr.GetSubmatrixCsc(internalDofs, boundaryDofs); } catch (MatrixDataOverwrittenException) { throw new InvalidOperationException( "The remainder-remainder stiffness submatrix of this subdomain has been overwritten and cannot be used" + " anymore. Try calling this method before factorizing/inverting it."); } }
private static void TestGetSubmatrix() { // These are useful for debugging //string outputPath = @"C:\Users\Serafeim\Desktop\output.txt"; //var writer = new LinearAlgebra.Output.FullMatrixWriter(); var matrix = Matrix.CreateFromArray( MultiDiagonalMatrices.CreateSymmetricPosDef(100, new int[] { 2, 4, 8, 16, 32, 64 })); var matrixSky = SkylineMatrix.CreateFromMatrix(matrix); var indices = new int[] { 0, 2, 4, 6, 12, 24, 32, 50, 64, 80 }; var indicesPerm = new int[] { 32, 80, 64, 0, 12, 24, 6, 50, 4, 2 }; int[] rowIndices = indicesPerm; var colIndices = new int[] { 90, 10, 20, 60, 40, 50, 0, 70, 80, 30 }; Matrix subMatrixFull = matrixSky.GetSubmatrixSymmetricFull(indices); SkylineMatrix subMatrixSky = matrixSky.GetSubmatrixSymmetricSkyline(indices); //writer.WriteToFile(subMatrixSky, outputPath, true); CscMatrix subMatrixCsc = matrixSky.GetSubmatrixCsc(indices, indices); Matrix subMatrixPermFull = matrixSky.GetSubmatrixSymmetricFull(indicesPerm); SkylineMatrix subMatrixPermSky = matrixSky.GetSubmatrixSymmetricSkyline(indicesPerm); CscMatrix subMatrixPermCsc = matrixSky.GetSubmatrixCsc(indicesPerm, indicesPerm); CscMatrix subMatrixRectCsc = matrixSky.GetSubmatrixCsc(rowIndices, colIndices); Matrix subMatrixExpected = matrix.GetSubmatrix(indices, indices); //writer.WriteToFile(subMatrixExpected, outputPath, true); Assert.True(subMatrixExpected.Equals(subMatrixFull)); Assert.True(subMatrixExpected.Equals(subMatrixSky)); Assert.True(subMatrixExpected.Equals(subMatrixCsc)); Matrix subMatrixPermExpected = matrix.GetSubmatrix(indicesPerm, indicesPerm); Assert.True(subMatrixPermExpected.Equals(subMatrixPermFull)); Assert.True(subMatrixPermExpected.Equals(subMatrixPermSky)); Assert.True(subMatrixPermExpected.Equals(subMatrixPermCsc)); Matrix subMatrixRectExpected = matrix.GetSubmatrix(rowIndices, colIndices); Assert.True(subMatrixRectExpected.Equals(subMatrixRectCsc)); }
private static void TestMatrixMatrixMultiplication(LinearAlgebraProviderChoice providers) { TestSettings.RunMultiproviderTest(providers, delegate() { var matrix5x5 = Matrix.CreateFromArray(SquareInvertible10by10.Matrix).GetSubmatrix(0, 5, 0, 5); //TODO: add a 5x5 matrix and its products var matrix10x10 = Matrix.CreateFromArray(SquareInvertible10by10.Matrix); var ATimesMatrix5x5 = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(SparseRectangular10by5.Matrix, matrix5x5.CopyToArray2D())); var ATimesTransposeMatrix5x5 = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(SparseRectangular10by5.Matrix, matrix5x5.Transpose().CopyToArray2D())); var transposeATimesMatrix10x10 = Matrix.CreateFromArray(MatrixOperations.MatrixTimesMatrix( MatrixOperations.Transpose(SparseRectangular10by5.Matrix), matrix10x10.CopyToArray2D())); var transposeATimesTransposeMatrix10x10 = Matrix.CreateFromArray(MatrixOperations.MatrixTimesMatrix( MatrixOperations.Transpose(SparseRectangular10by5.Matrix), matrix10x10.Transpose().CopyToArray2D())); var matrix10x10TimesA = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(matrix10x10.CopyToArray2D(), SparseRectangular10by5.Matrix)); var transposeMatrix10x10TimesA = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(matrix10x10.Transpose().CopyToArray2D(), SparseRectangular10by5.Matrix)); var matrix5x5TimesTransposeA = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(matrix5x5.CopyToArray2D(), MatrixOperations.Transpose(SparseRectangular10by5.Matrix))); var transposeMatrix5x5TimesTransposeA = Matrix.CreateFromArray( MatrixOperations.MatrixTimesMatrix(matrix5x5.Transpose().CopyToArray2D(), MatrixOperations.Transpose(SparseRectangular10by5.Matrix))); var A = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); // MultiplyRight() comparer.AssertEqual(ATimesMatrix5x5, A.MultiplyRight(matrix5x5, false, false)); comparer.AssertEqual(ATimesTransposeMatrix5x5, A.MultiplyRight(matrix5x5, false, true)); comparer.AssertEqual(transposeATimesMatrix10x10, A.MultiplyRight(matrix10x10, true, false)); comparer.AssertEqual(transposeATimesTransposeMatrix10x10, A.MultiplyRight(matrix10x10, true, true)); // MultiplyLeft() comparer.AssertEqual(matrix10x10TimesA, A.MultiplyLeft(matrix10x10, false, false)); comparer.AssertEqual(transposeMatrix10x10TimesA, A.MultiplyLeft(matrix10x10, false, true)); comparer.AssertEqual(matrix5x5TimesTransposeA, A.MultiplyLeft(matrix5x5, true, false)); comparer.AssertEqual(transposeMatrix5x5TimesTransposeA, A.MultiplyLeft(matrix5x5, true, true)); }); }
private static void TestMatrixVectorMultiplication(LinearAlgebraProviderChoice providers) { TestSettings.RunMultiproviderTest(providers, delegate() { // MultiplyRight() - untransposed var A = CscMatrix.CreateFromArrays(SparseRectangular10by5.NumRows, SparseRectangular10by5.NumCols, SparseRectangular10by5.CscValues, SparseRectangular10by5.CscRowIndices, SparseRectangular10by5.CscColOffsets, true); var x5 = Vector.CreateFromArray(SparseRectangular10by5.Lhs5); var b10Expected = Vector.CreateFromArray(SparseRectangular10by5.Rhs10); Vector b10Computed = A.Multiply(x5, false); comparer.AssertEqual(b10Expected, b10Computed); // MultiplyRight() - transposed var x10 = Vector.CreateFromArray(SparseRectangular10by5.Lhs10); var b5Expected = Vector.CreateFromArray(SparseRectangular10by5.Rhs5); Vector b5Computed = A.Multiply(x10, true); comparer.AssertEqual(b5Expected, b5Computed); }); }
/// <summary> /// Calculates the Schur complement of M/C = S = A - B^T * inv(C) * B, where M = [A B; B^T C]. /// This method constructs inv(C) * B one column at a time and uses that column to calculate the superdiagonal /// entries of the corresponding column of B^T * inv(C) * B. /// </summary> public static SymmetricMatrix CalcSchurComplementSymmetric(SymmetricMatrix A, CscMatrix B, ITriangulation inverseC) { //TODO: Unfortunately this cannot take advantage of MKL for CSC^T * vector. double[] valuesB = B.RawValues; int[] rowIndicesB = B.RawRowIndices; int[] colOffsetsB = B.RawColOffsets; var S = SymmetricMatrix.CreateZero(A.Order); for (int j = 0; j < B.NumColumns; ++j) { // column j of (inv(C) * B) = inv(C) * column j of B Vector colB = B.GetColumn(j); double[] colInvCB = inverseC.SolveLinearSystem(colB).RawData; // column j of (B^T * inv(C) * B) = B^T * column j of (inv(C) * B) // However we only need the superdiagonal part of this column. // Thus we only multiply the rows i of B^T (stored as columns i of B) with i <= j. for (int i = 0; i <= j; ++i) { double dot = 0.0; int colStart = colOffsetsB[i]; //inclusive int colEnd = colOffsetsB[i + 1]; //exclusive for (int k = colStart; k < colEnd; ++k) { dot += valuesB[k] * colInvCB[rowIndicesB[k]]; } // Perform the subtraction S = A - (B^T * inv(C) * B) for the current (i, j) int indexS = S.Find1DIndex(i, j); S.RawData[indexS] = A.RawData[indexS] - dot; } } return(S); }
/// <summary> /// Performs the LU factorization: A = L * U of a square matrix A. The matrix A is provided in CSC format. /// </summary> /// <param name="matrix">The matrix in symmetric (only upper triangle) CSC format.</param> /// <param name="pivotTolerance">The partial pivoting tolerance (from 0.0 to 1.0).</param> /// <exception cref="IndefiniteMatrixException">Thrown if the original matrix is not positive definite.</exception> public static LUCSparseNet Factorize(CscMatrix matrix, double pivotTolerance = defaultPivotTolelance) => Factorize(matrix.NumColumns, matrix.NumNonZeros, matrix.RawValues, matrix.RawRowIndices, matrix.RawColOffsets, pivotTolerance);
private void CalculateTransformationMatrix() { var e = (IEmbeddedElement)(embeddedElement.ElementType); int row = 0; int col = 0; int totalRows = embeddedElement.ElementType.DofEnumerator.GetDofTypesForMatrixAssembly(embeddedElement).SelectMany(x => x).Count(); //var matrix = new double[totalRows, superElementMap.Count]; var transformationMatrixOriginal = DokColMajor.CreateEmpty(totalRows, superElementMap.Count); foreach (var embeddedNode in e.EmbeddedNodes) { var localTransformationMatrix = transformation.GetTransformationVector(embeddedNode); var localHostDOFs = transformation.GetDOFTypesOfHost(embeddedNode); int nodeOrderInEmbeddedElement = embeddedElement.Nodes.FindFirstIndex(embeddedNode.Node); var embeddedNodeDOFQuantity = embeddedElement.ElementType.DofEnumerator.GetDofTypesForMatrixAssembly(embeddedElement)[nodeOrderInEmbeddedElement].Count; int dependentDOFs = transformation.GetDependentDOFTypes.Count; for (int i = 0; i < dependentDOFs; i++) { col = 0; for (int j = 0; j < localHostDOFs.Count; j++) { for (int k = 0; k < localHostDOFs[j].Count; k++) { var superelement = new SuperElementDof() { DOF = localHostDOFs[j][k], Element = embeddedNode.EmbeddedInElement, EmbeddedNode = embeddedNode.Node, HostNode = embeddedNode.EmbeddedInElement.Nodes[j] }; transformationMatrixOriginal[40 + row + i, superElementMap[superelement]] = localTransformationMatrix[i][col]; col++; } } } row += dependentDOFs; var independentEmbeddedDOFs = embeddedElement.ElementType.DofEnumerator.GetDofTypesForMatrixAssembly(embeddedElement)[nodeOrderInEmbeddedElement].Except(embeddedNode.DependentDOFs).ToArray(); for (int j = 0; j < independentEmbeddedDOFs.Length; j++) { var superelement = new SuperElementDof() { DOF = independentEmbeddedDOFs[j], Element = null, HostNode = null, EmbeddedNode = embeddedNode.Node }; transformationMatrixOriginal[40 + row, superElementMap[superelement]] = 1; row++; } } foreach (var node in embeddedElement.Nodes.Except(e.EmbeddedNodes.Select(x => x.Node))) { int nodeOrderInEmbeddedElement = embeddedElement.Nodes.FindFirstIndex(node); var currentNodeDOFs = embeddedElement.ElementType.DofEnumerator.GetDofTypesForMatrixAssembly(embeddedElement)[nodeOrderInEmbeddedElement]; for (int j = 0; j < currentNodeDOFs.Count; j++) { var superelement = new SuperElementDof() { DOF = currentNodeDOFs[j], Element = null, HostNode = null, EmbeddedNode = node }; transformationMatrixOriginal[row - 24, superElementMap[superelement]] = 1; row++; } } //StreamWriter sw = File.CreateText(String.Format("TransformationMatrix{0}.txt", embeddedElement.ID)); //for (int i = 0; i < totalRows; i++) //{ // var line = String.Empty; // for (int j = 0; j < superElementMap.Count; j++) // line += matrix[i,j].ToString() + ";"; // sw.WriteLine(line); //} //sw.Close(); //transformationMatrixOriginal = new Matrix2D(matrix); transformationMatrix = transformationMatrixOriginal.BuildCscMatrix(true);; }