# Path: blaspy/helpers.py
# def get_matrix_dimensions(name, matrix):
#     """
#     Return the number of rows and number of columns in a matrix.
# 
#     Args:
#         name:      string to print as the vector's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing the matrix
# 
#     Returns:
#         A tuple of two elements where each element is described in order below:
# 
#         - number of rows in matrix
#         - number of columns in matrix
# 
#     Raises:
#         TypeError: if matrix is not a 2D NumPy ndarray or matrix
#     """
# 
#     try:
#         rows, cols = matrix.shape
# 
#         return rows, cols
# 
#     except (AttributeError, TypeError):
#         raise_not_2d_numpy(name)
# 
# def get_square_matrix_dimension(name, matrix):
#     """
#     Return the dimension of a square matrix.
# 
#     Args:
#         name:      string to print as the matrix's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing a square matrix
# 
#     Returns:
#         An int representing both the number of rows and number of columns in matrix.
# 
#     Raises:
#         TypeError:  if matrix is not a 2D NumPy ndarray or matrix
#         ValueError: if matrix is not square
#     """
# 
#     try:
#         rows, cols = matrix.shape
# 
#         if rows != cols:
#             raise_not_square(name, rows, cols)
# 
#         return rows
# 
#     except (AttributeError, TypeError):
#         raise_not_2d_numpy(name)
# 
# def check_equal_sizes(name_1, size_1, name_2, size_2):
#     """
#     Check that size_1 and size_2 are equal.
# 
#     Args:
#         name_1:    string to print as the name of the first element
#         size_1:    size of the first element
#         name_2:    string to print as the name of the second element
#         size_2:    size of the second element
# 
#     Raises:
#         ValueError: if size_1 != size_2
#     """
# 
#     if size_1 != size_2:
#         raise_size_mismatch(name_1, size_1, name_2, size_2)
# 
# def convert_side(side):
#     if side == 'l' or side == 'L':
#         return LEFT
#     elif side == 'r' or side == 'R':
#         return RIGHT
#     else:
#         raise_invalid_parameter('side', ('l', 'L', 'r', 'R'), side)
# 
# def convert_uplo(uplo):
#     if uplo == 'u' or uplo == 'U':
#         return UPPER
#     elif uplo == 'l' or uplo == 'L':
#         return LOWER
#     else:
#         raise_invalid_parameter('uplo', ('u', 'U', 'l', 'L'), uplo)
# 
# def convert_trans(trans):
#     if trans == 'n' or trans == 'N':
#         return NO_TRANS
#     elif trans == 't' or trans == 'T':
#         return TRANS
#     else:
#         raise_invalid_parameter('trans', ('n', 'N', 't', 'T'), trans)
# 
# def convert_diag(diag):
#     if diag == 'n' or diag == 'N':
#         return NON_UNIT
#     elif diag == 'u' or diag == 'U':
#         return UNIT
#     else:
#         raise_invalid_parameter('diag', ('n', 'N', 'u', 'U'), diag)
# 
# def get_cblas_info(calling_func, dtypes):
#     """
#     Return the appropriate CBLAS subroutine and ctype data type based on the calling function and
#     dtypes of args.
# 
#     Args:
#         calling_func:    a string representation of the calling function
#         dtypes:          a tuple of the dtypes of all of the matrices or vectors passed into the
#                          calling function
# 
#     Returns:
#         A tuple of two elements where each element is described in order below:
# 
#         - appropriate CBLAS function
#         - appropriate ctypes data type
# 
#     Raises:
#         ValueError: if all matrices and/or vectors do not have the same dtype
#     """
# 
#     if all(dtype == 'float64' for dtype in dtypes):
#         return FUNC_DICT[calling_func][0], c_double
# 
#     elif all(dtype == 'float32' for dtype in dtypes):
#         return FUNC_DICT[calling_func][1], c_float
# 
#     else:
#         raise_invalid_dtypes(('float64', 'float32'))
# 
# ROW_MAJOR = 101
# 
# LEFT = 141


from ..helpers import (get_matrix_dimensions, get_square_matrix_dimension, check_equal_sizes,
                       convert_side, convert_uplo, convert_trans, convert_diag, get_cblas_info,
                       ROW_MAJOR, LEFT)
from ctypes import c_int, POINTER
                    - A and B do not have the same dtype or that dtype is not supported
                    - A is not a square matrix
                    - the dimensions of A and B do not conform
                    - 'side' is not equal to one of the following: 'l', 'L', 'r', 'R'
                    - 'uplo' is not equal to one of the following: 'u', 'U', 'l', 'L'
                    - 'trans' is not equal to one of the following: 'n', 'N', 't', 'T'
                    - 'diag' is not equal to one fo the following: 'n', 'N', 'u', 'U'
    """

    # convert to appropriate CBLAS value
    cblas_side = convert_side(side)
    cblas_uplo = convert_uplo(uplo)
    cblas_trans_a = convert_trans(trans_a)
    cblas_diag = convert_diag(diag)
    side_is_left = cblas_side == LEFT

    # get the dimensions of the parameters
    dim_A = get_square_matrix_dimension('A', A)
    m_B, n_B = get_matrix_dimensions('B', B)

    # assign a default value to lda, ldb, and ldc if necessary (assumes row-major order)
    if lda is None:
        lda = dim_A
    if ldb is None:
        ldb = n_B

    # ensure the matrix dimensions conform for the desired operation
    if side_is_left:
        check_equal_sizes('A', dim_A, 'B', m_B)
    else:

# Path: blaspy/helpers.py
# def get_matrix_dimensions(name, matrix):
#     """
#     Return the number of rows and number of columns in a matrix.
# 
#     Args:
#         name:      string to print as the vector's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing the matrix
# 
#     Returns:
#         A tuple of two elements where each element is described in order below:
# 
#         - number of rows in matrix
#         - number of columns in matrix
# 
#     Raises:
#         TypeError: if matrix is not a 2D NumPy ndarray or matrix
#     """
# 
#     try:
#         rows, cols = matrix.shape
# 
#         return rows, cols
# 
#     except (AttributeError, TypeError):
#         raise_not_2d_numpy(name)
# 
# def get_square_matrix_dimension(name, matrix):
#     """
#     Return the dimension of a square matrix.
# 
#     Args:
#         name:      string to print as the matrix's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing a square matrix
# 
#     Returns:
#         An int representing both the number of rows and number of columns in matrix.
# 
#     Raises:
#         TypeError:  if matrix is not a 2D NumPy ndarray or matrix
#         ValueError: if matrix is not square
#     """
# 
#     try:
#         rows, cols = matrix.shape
# 
#         if rows != cols:
#             raise_not_square(name, rows, cols)
# 
#         return rows
# 
#     except (AttributeError, TypeError):
#         raise_not_2d_numpy(name)
# 
# def check_equal_sizes(name_1, size_1, name_2, size_2):
#     """
#     Check that size_1 and size_2 are equal.
# 
#     Args:
#         name_1:    string to print as the name of the first element
#         size_1:    size of the first element
#         name_2:    string to print as the name of the second element
#         size_2:    size of the second element
# 
#     Raises:
#         ValueError: if size_1 != size_2
#     """
# 
#     if size_1 != size_2:
#         raise_size_mismatch(name_1, size_1, name_2, size_2)
# 
# def convert_side(side):
#     if side == 'l' or side == 'L':
#         return LEFT
#     elif side == 'r' or side == 'R':
#         return RIGHT
#     else:
#         raise_invalid_parameter('side', ('l', 'L', 'r', 'R'), side)
# 
# def convert_uplo(uplo):
#     if uplo == 'u' or uplo == 'U':
#         return UPPER
#     elif uplo == 'l' or uplo == 'L':
#         return LOWER
#     else:
#         raise_invalid_parameter('uplo', ('u', 'U', 'l', 'L'), uplo)
# 
# def convert_trans(trans):
#     if trans == 'n' or trans == 'N':
#         return NO_TRANS
#     elif trans == 't' or trans == 'T':
#         return TRANS
#     else:
#         raise_invalid_parameter('trans', ('n', 'N', 't', 'T'), trans)
# 
# def convert_diag(diag):
#     if diag == 'n' or diag == 'N':
#         return NON_UNIT
#     elif diag == 'u' or diag == 'U':
#         return UNIT
#     else:
#         raise_invalid_parameter('diag', ('n', 'N', 'u', 'U'), diag)
# 
# def get_cblas_info(calling_func, dtypes):
#     """
#     Return the appropriate CBLAS subroutine and ctype data type based on the calling function and
#     dtypes of args.
# 
#     Args:
#         calling_func:    a string representation of the calling function
#         dtypes:          a tuple of the dtypes of all of the matrices or vectors passed into the
#                          calling function
# 
#     Returns:
#         A tuple of two elements where each element is described in order below:
# 
#         - appropriate CBLAS function
#         - appropriate ctypes data type
# 
#     Raises:
#         ValueError: if all matrices and/or vectors do not have the same dtype
#     """
# 
#     if all(dtype == 'float64' for dtype in dtypes):
#         return FUNC_DICT[calling_func][0], c_double
# 
#     elif all(dtype == 'float32' for dtype in dtypes):
#         return FUNC_DICT[calling_func][1], c_float
# 
#     else:
#         raise_invalid_dtypes(('float64', 'float32'))
# 
# ROW_MAJOR = 101
# 
# LEFT = 141


# Path: blaspy/level_3/trsm.py
from ..helpers import (get_matrix_dimensions, get_square_matrix_dimension, check_equal_sizes,
                       convert_side, convert_uplo, convert_trans, convert_diag, get_cblas_info,
                       ROW_MAJOR, LEFT)
from ctypes import c_int, POINTER

                    - A and B do not have the same dtype or that dtype is not supported
                    - A is not a square matrix
                    - the dimensions of A and B do not conform
                    - 'side' is not equal to one of the following: 'l', 'L', 'r', 'R'
                    - 'uplo' is not equal to one of the following: 'u', 'U', 'l', 'L'
                    - 'trans' is not equal to one of the following: 'n', 'N', 't', 'T'
                    - 'diag' is not equal to one fo the following: 'n', 'N', 'u', 'U'
    """

    # convert to appropriate CBLAS value
    cblas_side = convert_side(side)
    cblas_uplo = convert_uplo(uplo)
    cblas_trans_a = convert_trans(trans_a)
    cblas_diag = convert_diag(diag)
    side_is_left = cblas_side == LEFT

    # get the dimensions of the parameters
    dim_A = get_square_matrix_dimension('A', A)
    m_B, n_B = get_matrix_dimensions('B', B)

    # assign a default value to lda, ldb, and ldc if necessary (assumes row-major order)
    if lda is None:
        lda = dim_A
    if ldb is None:
        ldb = n_B

    # ensure the matrix dimensions conform for the desired operation
    if side_is_left:
        check_equal_sizes('A', dim_A, 'B', m_B)
    else:

        check_equal_sizes('A', dim_A, 'B', n_B)