# Path: blaspy/config.py
# BLAS_NAME = ""  # default is ""
# IN_BLASPY_SUBDIRECTORY = True  # default is True
#     PREPEND = str(path.dirname(__file__))[:-6] + "lib/"
#             BLAS_NAME = "libopenblas-0.2.13-win64-int32.dll"
#             BLAS_NAME = "libopenblas-0.2.13-win32.dll"
#         PREPEND = ""
#             BLAS_NAME = "libopenblas-0.2.13-linux64.so"
#             BLAS_NAME = "libopenblas-0.2.13-linux32.so"
#    PREPEND = ""
# 
# Path: blaspy/errors.py
# def raise_invalid_dtypes(allowed):
#     raise ValueError("All matrix and vector parameters should have the same dtype and that dtype "
#                      "should be in the following list of allowed dtypes (which may change from "
#                      "one BLASpy function to another): %s. This error can be fixed calling "
#                      ".astype('dtype') on the problem ndarray or matrix before calling a BLASpy "
#                      "function with that ndarray or matrix as a parameter." % (allowed,))
# 
# def raise_not_vector(name, rows, cols):
#     raise ValueError("'%s' should be a vector. Either the number of rows or number of "
#                      "columns must equal one. Number of rows: %i. Number of columns: %i." %
#                      (name, rows, cols))
# 
# def raise_not_2d_numpy(name):
#     raise ValueError("'%s' should be two-dimensional and of NumPy type ndarray or matrix. BLASpy "
#                      "expects vectors to be two-dimensional, so ensure you are not trying to pass "
#                      "in a one-dimensional ndarray as a vector." % name)
# 
# def raise_not_square(name, rows, cols):
#     raise ValueError("'%s' should be a square matrix. The number of rows must equal the number of "
#                      "columns. Number of rows: %i. Number of columns: %i" % (name, rows, cols))
# 
# def raise_size_mismatch(name1, size_1, name2, size_2):
#     raise ValueError("There was a size mismatch between '%s' (%d) and '%s' (%d). Double check that their "
#                      "sizes conform in a manner appropriate for the BLASpy function being "
#                      "called." % (name1, size_1, name2, size_2))
# 
# def raise_strides_not_one():
#     raise ValueError("If 'y' is not provided, then the stride of all vectors should equal one.")
# 
# def raise_invalid_parameter(name, allowed, actual):
#     raise ValueError("Parameter '%s' should equal one of the following values: %s. Actual value: "
#                      "%s" % (name, (allowed,), actual))


from .config import _libblas as lib
from .errors import (raise_invalid_dtypes, raise_not_vector, raise_not_2d_numpy, raise_not_square,
                     raise_size_mismatch, raise_strides_not_one, raise_invalid_parameter)
from ctypes import c_double, c_float
from numpy import asmatrix, zeros
from numpy import matrix as np_matrix

    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):

# Path: blaspy/config.py
# BLAS_NAME = ""  # default is ""
# IN_BLASPY_SUBDIRECTORY = True  # default is True
#     PREPEND = str(path.dirname(__file__))[:-6] + "lib/"
#             BLAS_NAME = "libopenblas-0.2.13-win64-int32.dll"
#             BLAS_NAME = "libopenblas-0.2.13-win32.dll"
#         PREPEND = ""
#             BLAS_NAME = "libopenblas-0.2.13-linux64.so"
#             BLAS_NAME = "libopenblas-0.2.13-linux32.so"
#    PREPEND = ""
# 
# Path: blaspy/errors.py
# def raise_invalid_dtypes(allowed):
#     raise ValueError("All matrix and vector parameters should have the same dtype and that dtype "
#                      "should be in the following list of allowed dtypes (which may change from "
#                      "one BLASpy function to another): %s. This error can be fixed calling "
#                      ".astype('dtype') on the problem ndarray or matrix before calling a BLASpy "
#                      "function with that ndarray or matrix as a parameter." % (allowed,))
# 
# def raise_not_vector(name, rows, cols):
#     raise ValueError("'%s' should be a vector. Either the number of rows or number of "
#                      "columns must equal one. Number of rows: %i. Number of columns: %i." %
#                      (name, rows, cols))
# 
# def raise_not_2d_numpy(name):
#     raise ValueError("'%s' should be two-dimensional and of NumPy type ndarray or matrix. BLASpy "
#                      "expects vectors to be two-dimensional, so ensure you are not trying to pass "
#                      "in a one-dimensional ndarray as a vector." % name)
# 
# def raise_not_square(name, rows, cols):
#     raise ValueError("'%s' should be a square matrix. The number of rows must equal the number of "
#                      "columns. Number of rows: %i. Number of columns: %i" % (name, rows, cols))
# 
# def raise_size_mismatch(name1, size_1, name2, size_2):
#     raise ValueError("There was a size mismatch between '%s' (%d) and '%s' (%d). Double check that their "
#                      "sizes conform in a manner appropriate for the BLASpy function being "
#                      "called." % (name1, size_1, name2, size_2))
# 
# def raise_strides_not_one():
#     raise ValueError("If 'y' is not provided, then the stride of all vectors should equal one.")
# 
# def raise_invalid_parameter(name, allowed, actual):
#     raise ValueError("Parameter '%s' should equal one of the following values: %s. Actual value: "
#                      "%s" % (name, (allowed,), actual))


# Path: blaspy/helpers.py
from .config import _libblas as lib
from .errors import (raise_invalid_dtypes, raise_not_vector, raise_not_2d_numpy, raise_not_square,
                     raise_size_mismatch, raise_strides_not_one, raise_invalid_parameter)
from ctypes import c_double, c_float
from numpy import asmatrix, zeros
from numpy import matrix as np_matrix


    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)