# Path: blaspy/level_2/syr.py
# def syr(x, A=None, uplo='u', alpha=1.0, lda=None, inc_x=1):
#     """
#     Perform a symmetric rank-1 update operation.
# 
#     A := A + alpha * x * x_T
# 
#     where alpha is a scalar, A is a symmetric matrix, and x is a general column vector.
# 
#     The 'uplo' argument indicates whether the lower or upper triangle of A is to be referenced and
#     updated by the operation.
# 
#     Vector x can be passed in as either row or column vector. If necessary, an implicit
#     transposition occurs.
# 
#     If matrix A is not provided, a zero matrix of the appropriate size and type is created
#     and returned. In such a case, lda is automatically set to the number of columns in the
#     newly created matrix A.
# 
#     Args:
#         x:        2D NumPy matrix or ndarray representing vector x
# 
#         --optional arguments--
# 
#         A:        2D NumPy matrix or ndarray representing matrix A
#                       < default is the zero matrix >
#         uplo:     'u'  if the upper triangle of A is to be used
#                   'l'  if the lower triangle of A is to be used
#                       < default is 'u' >
#         alpha:    scalar alpha
#                       < default is 1.0 >
#         lda:      leading dimension of A (must be >= # of cols in A)
#                       < default is the number of columns in A >
#         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:
#         Matrix A (which is also overwritten)
# 
#     Raises:
#         ValueError: if any of the following conditions occur:
#                     - A or x is not a 2D NumPy ndarray or NumPy matrix
#                     - A and x do not have the same dtype or that dtype is not supported
#                     - x is not a vector
#                     - the effective length of x does not conform to the dimensions of A
#                     - uplo is not equal to one of the following: 'u', 'U', 'l', 'L'
#     """
# 
#     # get the dimensions of the parameters
#     m_x, n_x, x_length = get_vector_dimensions('x', x, inc_x)
# 
#     # if no matrix A is given, create a zero matrix of appropriate size with the same dtype as x
#     if A is None:
#         A = create_zero_matrix(x_length, x_length, x.dtype, type(x))
#         lda = None
# 
#     # continue getting dimensions of the parameters
#     dim_A = get_square_matrix_dimension('A', A)
# 
#     # assign a default value to lda if necessary (assumes row-major order)
#     if lda is None:
#         lda = dim_A
# 
#     # ensure the parameters are appropriate for the operation
#     check_equal_sizes('A', dim_A, 'x', x_length)
# 
#     # convert to appropriate CBLAS value
#     cblas_uplo = convert_uplo(uplo)
# 
#     # determine which CBLAS subroutine to call and which ctypes data type to use
#     cblas_func, data_type = get_cblas_info('syr', (A.dtype, x.dtype))
# 
#     # create a ctypes POINTER for each vector and matrix
#     ctype_x = POINTER(data_type * n_x * m_x)
#     ctype_A = POINTER(data_type * dim_A * dim_A)
# 
#     # call CBLAS using ctypes
#     cblas_func.argtypes = [c_int, c_int, c_int, data_type, ctype_x, c_int, ctype_A, c_int]
#     cblas_func.restype = None
#     cblas_func(ROW_MAJOR, cblas_uplo, dim_A, alpha, x.ctypes.data_as(ctype_x), inc_x,
#                A.ctypes.data_as(ctype_A), lda)
# 
#     return A  # A is also overwritten


from blaspy import syr
from numpy import array, asmatrix
from string import ascii_letters
from unittest import TestCase
                   [2., 3.]])
        x = array([[1., 2.],
                   [2., 3.]])
        self.assertRaises(ValueError, syr, x, A)

    def test_mixed_dtypes1_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='float32')
        x = array([[1.],
                   [2.]], dtype='float64')
        self.assertEqual(A.dtype, 'float32')
        self.assertEqual(x.dtype, 'float64')
        self.assertRaises(ValueError, syr, x, A)

    def test_mixed_dtypes2_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='float64')
        x = array([[1.],
                   [2.]], dtype='float32')
        self.assertEqual(A.dtype, 'float64')
        self.assertEqual(x.dtype, 'float32')
        self.assertRaises(ValueError, syr, x, A)

    def test_integer_dtype_for_all_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='int')
        x = array([[1.],
                   [2.]], dtype='int')
        self.assertEqual(A.dtype, 'int')
        self.assertEqual(x.dtype, 'int')

# Path: blaspy/level_2/syr.py
# def syr(x, A=None, uplo='u', alpha=1.0, lda=None, inc_x=1):
#     """
#     Perform a symmetric rank-1 update operation.
# 
#     A := A + alpha * x * x_T
# 
#     where alpha is a scalar, A is a symmetric matrix, and x is a general column vector.
# 
#     The 'uplo' argument indicates whether the lower or upper triangle of A is to be referenced and
#     updated by the operation.
# 
#     Vector x can be passed in as either row or column vector. If necessary, an implicit
#     transposition occurs.
# 
#     If matrix A is not provided, a zero matrix of the appropriate size and type is created
#     and returned. In such a case, lda is automatically set to the number of columns in the
#     newly created matrix A.
# 
#     Args:
#         x:        2D NumPy matrix or ndarray representing vector x
# 
#         --optional arguments--
# 
#         A:        2D NumPy matrix or ndarray representing matrix A
#                       < default is the zero matrix >
#         uplo:     'u'  if the upper triangle of A is to be used
#                   'l'  if the lower triangle of A is to be used
#                       < default is 'u' >
#         alpha:    scalar alpha
#                       < default is 1.0 >
#         lda:      leading dimension of A (must be >= # of cols in A)
#                       < default is the number of columns in A >
#         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:
#         Matrix A (which is also overwritten)
# 
#     Raises:
#         ValueError: if any of the following conditions occur:
#                     - A or x is not a 2D NumPy ndarray or NumPy matrix
#                     - A and x do not have the same dtype or that dtype is not supported
#                     - x is not a vector
#                     - the effective length of x does not conform to the dimensions of A
#                     - uplo is not equal to one of the following: 'u', 'U', 'l', 'L'
#     """
# 
#     # get the dimensions of the parameters
#     m_x, n_x, x_length = get_vector_dimensions('x', x, inc_x)
# 
#     # if no matrix A is given, create a zero matrix of appropriate size with the same dtype as x
#     if A is None:
#         A = create_zero_matrix(x_length, x_length, x.dtype, type(x))
#         lda = None
# 
#     # continue getting dimensions of the parameters
#     dim_A = get_square_matrix_dimension('A', A)
# 
#     # assign a default value to lda if necessary (assumes row-major order)
#     if lda is None:
#         lda = dim_A
# 
#     # ensure the parameters are appropriate for the operation
#     check_equal_sizes('A', dim_A, 'x', x_length)
# 
#     # convert to appropriate CBLAS value
#     cblas_uplo = convert_uplo(uplo)
# 
#     # determine which CBLAS subroutine to call and which ctypes data type to use
#     cblas_func, data_type = get_cblas_info('syr', (A.dtype, x.dtype))
# 
#     # create a ctypes POINTER for each vector and matrix
#     ctype_x = POINTER(data_type * n_x * m_x)
#     ctype_A = POINTER(data_type * dim_A * dim_A)
# 
#     # call CBLAS using ctypes
#     cblas_func.argtypes = [c_int, c_int, c_int, data_type, ctype_x, c_int, ctype_A, c_int]
#     cblas_func.restype = None
#     cblas_func(ROW_MAJOR, cblas_uplo, dim_A, alpha, x.ctypes.data_as(ctype_x), inc_x,
#                A.ctypes.data_as(ctype_A), lda)
# 
#     return A  # A is also overwritten


# Path: bp_unit_tests/level_2/unit_test_syr.py
from blaspy import syr
from numpy import array, asmatrix
from string import ascii_letters
from unittest import TestCase

                   [2., 3.]])
        x = array([[1., 2.],
                   [2., 3.]])
        self.assertRaises(ValueError, syr, x, A)

    def test_mixed_dtypes1_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='float32')
        x = array([[1.],
                   [2.]], dtype='float64')
        self.assertEqual(A.dtype, 'float32')
        self.assertEqual(x.dtype, 'float64')
        self.assertRaises(ValueError, syr, x, A)

    def test_mixed_dtypes2_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='float64')
        x = array([[1.],
                   [2.]], dtype='float32')
        self.assertEqual(A.dtype, 'float64')
        self.assertEqual(x.dtype, 'float32')
        self.assertRaises(ValueError, syr, x, A)

    def test_integer_dtype_for_all_raises_ValueError(self):
        A = array([[1., 2.],
                   [3., 4.]], dtype='int')
        x = array([[1.],
                   [2.]], dtype='int')
        self.assertEqual(A.dtype, 'int')
        self.assertEqual(x.dtype, 'int')

        self.assertRaises(ValueError, syr, x, A)