Implement the functionality of the calculate_max_matrix_score function that maximizes the score of a binary matrix. The score is calculated based on specific criteria related to the rows and columns of the matrix.
Functionality Requirements:
The function should modify the matrix such that the first column consists entirely of 1s. If the first element of any row is 0, toggle all elements in that row (i.e., convert 0s to 1s and 1s to 0s).
After ensuring the first column is filled with 1s, compute the maximum score:
For each column, count the number of 0s and 1s.
For each column, add twice the maximum count of 0s or 1s to the score, multiplied by 2 raised to the power of the index of the column from the right.
Input/Output Requirements:
Input: A list of lists (matrix) containing binary integers (0s and 1s). The input matrix will have at least one row and one column.
Output: An integer representing the maximum score of the matrix.
Implementation Details:
The solution must be implemented in a file named /app/solution.py using the specified function signature:
python
def calculate_max_matrix_score(matrix):
Ensure that the implementation passes various edge cases, such as:
A matrix with all 0s.
A matrix with all 1s.
A mix of 0s and 1s in various configurations.
Please write tests to confirm the correctness of your implementation.