public CostAnalyzer(ICostMatrix <TCost> costMatrix) { CostMatrix = costMatrix; OrderedNeighboursFromTo = new SortedList <int, TCost> [costMatrix.Matrix.Length]; for (int row = 0; row < costMatrix.Matrix.Length; row++) { OrderedNeighboursFromTo[row] = new SortedList <int, TCost>(costMatrix.Matrix.Length - 1, new Comparer(costMatrix.Matrix[row])); for (int col = 0; col < costMatrix.Matrix.Length; col++) { OrderedNeighboursFromTo[row].Add(col, costMatrix.Matrix[row][col]); } } }
public static CostMatrix <TCost> CreateTransposed(ICostMatrix <TCost> originalMatrix) { var dimension = originalMatrix.Matrix.Length; var transposed = new TCost[originalMatrix.Matrix.Length][]; for (int col = 0; col < originalMatrix.Matrix.Length; col++) { transposed[col] = new TCost[dimension]; for (int row = 0; row < originalMatrix.Matrix.Length; row++) { transposed[col][row] = originalMatrix.Matrix[row][col]; } } return(new CostMatrix <TCost>(transposed)); }