Tyche Trading

Transpose Matrix

Bar Info



Matrix Handling

Price Rounding

Regression Lines


User Tracking

Example Strategies

Transpose Matrix


Transpose a matrix.



Transpose(double[,] matrix);



matrix: The matrix that needs to be transposed.

					/// <summary>
/// Transposes a 2d array.
/// </summary>
/// <param name="matrix"> The array that is to be transposed. </param>
/// <return> An array that is the transposed version of the recieved array. </return>
private double[,] Transpose(double[,] matrix)
	// save the dimentions of the array based on the size of the trasposed version of the array
	int row = matrix.GetLength(1);
	int col = matrix.GetLength(0);

	// set the size of the transposed array
	double[,] matrixT = new double[row, col];

	// save each value as the reverse of its original placement
	for (int i = 0; i < row; i++)
		for (int j = 0; j < col; j++)
			matrixT[i, j] = matrix[j, i];

	return matrixT;