# Path: blaspy/helpers.py
# def get_vector_dimensions(name, vector, stride):
#     """
#     Return the number of rows, number of columns, and length of a vector taking into account
#     the stride of the vector.
# 
#     Args:
#         name:      string to print as the vector's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing a vector
#         stride:    stride of the vector (increment for the elements of the vector)
# 
#     Returns:
#         A tuple of three elements where each element is described in order below:
# 
#         - number of rows in vector
#         - number of columns in vector
#         - length of vector after accounting for stride
# 
#     Raises:
#         TypeError: if vector is not a vector represented by a 2D NumPy ndarray or matrix
#     """
# 
#     try:
#         rows, cols = vector.shape
# 
#         if not (rows == 1 or cols == 1):
#             raise_not_vector(name, rows, cols)
# 
#         length = max(rows, cols)
#         if stride > 1:
#             length = (length / stride) + (length % stride > 0)
# 
#         return rows, cols, length
# 
#     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 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'))
# 
# def create_similar_zero_vector(other_vector, length=None):
#     """
#     Create and return a zero vector with the same dtype, length, and orientation as other_vector.
# 
#     Args:
#         other_vector:   vector whose dtype, length, and orientation to copy
# 
#         --optional arguments--
# 
#         length:         length of zero vector, default is length of other_vector
# 
#     Returns:
#         A new NumPy ndarray or matrix filled with zeros with the same characteristics as
#         other_vector.
#     """
# 
#     if other_vector.shape[0] == 1:
#         length = other_vector.shape[1] if length is None else length
#         new_vector = zeros((1, length), dtype=other_vector.dtype)
#     else:
#         length = other_vector.shape[0] if length is None else length
#         new_vector = zeros((length, 1), dtype=other_vector.dtype)
# 
#     if type(other_vector) is np_matrix:
#         new_vector = asmatrix(new_vector)
# 
#     return new_vector
# 
# def check_strides_equal_one(*args):
#     if any(stride != 1 for stride in args):
#         raise_strides_not_one()


from ..helpers import (get_vector_dimensions, check_equal_sizes, get_cblas_info,
                       create_similar_zero_vector, check_strides_equal_one)
from ctypes import c_int, POINTER

        y:      2D NumPy matrix or ndarray representing vector y
                    < default is a newly created zero vector of the same dtype and effective length >
        inc_x:  stride of x (increment for the elements of x)
                    < default is 1 >
        inc_y:  stride of y (increment for the elements of y)
                    < default is 1 >

    Returns:
        Vector y (which is also overwritten)

    Raises:
        ValueError: if any of the following conditions occur:
                        - x or y is not a 2D NumPy matrix or ndarray
                        - x and y do not have the same dtype or that dtype is not supported
                        - x or y is not a vector
                        - x and y do not have the same length
    """

    # get the dimensions of the parameters
    m_x, n_x, x_length = get_vector_dimensions('x', x, inc_x)

    # if y is not given, create zero vector with same orientation and type as x
    if y is None:
        inc_y = 1
        y = create_similar_zero_vector(x, x_length)

    m_y, n_y, y_length = get_vector_dimensions('y', y, inc_y)

    # ensure the parameters are appropriate for the operation

# Path: blaspy/helpers.py
# def get_vector_dimensions(name, vector, stride):
#     """
#     Return the number of rows, number of columns, and length of a vector taking into account
#     the stride of the vector.
# 
#     Args:
#         name:      string to print as the vector's name if an error occurs
#         vector:    numpy 2D ndarray or matrix representing a vector
#         stride:    stride of the vector (increment for the elements of the vector)
# 
#     Returns:
#         A tuple of three elements where each element is described in order below:
# 
#         - number of rows in vector
#         - number of columns in vector
#         - length of vector after accounting for stride
# 
#     Raises:
#         TypeError: if vector is not a vector represented by a 2D NumPy ndarray or matrix
#     """
# 
#     try:
#         rows, cols = vector.shape
# 
#         if not (rows == 1 or cols == 1):
#             raise_not_vector(name, rows, cols)
# 
#         length = max(rows, cols)
#         if stride > 1:
#             length = (length / stride) + (length % stride > 0)
# 
#         return rows, cols, length
# 
#     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 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'))
# 
# def create_similar_zero_vector(other_vector, length=None):
#     """
#     Create and return a zero vector with the same dtype, length, and orientation as other_vector.
# 
#     Args:
#         other_vector:   vector whose dtype, length, and orientation to copy
# 
#         --optional arguments--
# 
#         length:         length of zero vector, default is length of other_vector
# 
#     Returns:
#         A new NumPy ndarray or matrix filled with zeros with the same characteristics as
#         other_vector.
#     """
# 
#     if other_vector.shape[0] == 1:
#         length = other_vector.shape[1] if length is None else length
#         new_vector = zeros((1, length), dtype=other_vector.dtype)
#     else:
#         length = other_vector.shape[0] if length is None else length
#         new_vector = zeros((length, 1), dtype=other_vector.dtype)
# 
#     if type(other_vector) is np_matrix:
#         new_vector = asmatrix(new_vector)
# 
#     return new_vector
# 
# def check_strides_equal_one(*args):
#     if any(stride != 1 for stride in args):
#         raise_strides_not_one()


# Path: blaspy/level_1/copy.py
from ..helpers import (get_vector_dimensions, check_equal_sizes, get_cblas_info,
                       create_similar_zero_vector, check_strides_equal_one)
from ctypes import c_int, POINTER


        y:      2D NumPy matrix or ndarray representing vector y
                    < default is a newly created zero vector of the same dtype and effective length >
        inc_x:  stride of x (increment for the elements of x)
                    < default is 1 >
        inc_y:  stride of y (increment for the elements of y)
                    < default is 1 >

    Returns:
        Vector y (which is also overwritten)

    Raises:
        ValueError: if any of the following conditions occur:
                        - x or y is not a 2D NumPy matrix or ndarray
                        - x and y do not have the same dtype or that dtype is not supported
                        - x or y is not a vector
                        - x and y do not have the same length
    """

    # get the dimensions of the parameters
    m_x, n_x, x_length = get_vector_dimensions('x', x, inc_x)

    # if y is not given, create zero vector with same orientation and type as x
    if y is None:
        inc_y = 1
        y = create_similar_zero_vector(x, x_length)

    m_y, n_y, y_length = get_vector_dimensions('y', y, inc_y)

    # ensure the parameters are appropriate for the operation

    check_equal_sizes('x', x_length, 'y', y_length)