Commits

committed fc3d8d2 Merge

merge default

• Participants
• Parent commits 7e7a539, 9c33b59
• Branches vendor-rename

File dotviewer/strunicode.py

`+RAW_ENCODING = "utf-8"`
`+`
`+`
`+def forceunicode(name):`
`+    return name if isinstance(name, unicode) else name.decode(RAW_ENCODING)`
`+`
`+`
`+def forcestr(name):`
`+    return name if isinstance(name, str) else name.encode(RAW_ENCODING)`

File lib_pypy/numpypy/core/numeric.py

`            'newaxis', 'ufunc',`
`            'asarray', 'asanyarray', 'base_repr',`
`            'array_repr', 'array_str', 'set_string_function',`
`-           'array_equal', 'outer', 'identity', 'little_endian',`
`+           'array_equal', 'outer', 'vdot', 'identity', 'little_endian',`
`            'Inf', 'inf', 'infty', 'Infinity', 'nan', 'NaN', 'False_', 'True_',`
`           ]`
` `
`     b = asarray(b)`
`     return a.ravel()[:,newaxis]*b.ravel()[newaxis,:]`
` `
`+def vdot(a, b):`
`+    """`
`+    Return the dot product of two vectors.`
`+`
`+    The vdot(`a`, `b`) function handles complex numbers differently than`
`+    dot(`a`, `b`).  If the first argument is complex the complex conjugate`
`+    of the first argument is used for the calculation of the dot product.`
`+`
`+    Note that `vdot` handles multidimensional arrays differently than `dot`:`
`+    it does *not* perform a matrix product, but flattens input arguments`
`+    to 1-D vectors first. Consequently, it should only be used for vectors.`
`+`
`+    Parameters`
`+    ----------`
`+    a : array_like`
`+        If `a` is complex the complex conjugate is taken before calculation`
`+        of the dot product.`
`+    b : array_like`
`+        Second argument to the dot product.`
`+`
`+    Returns`
`+    -------`
`+    output : ndarray`
`+        Dot product of `a` and `b`.  Can be an int, float, or`
`+        complex depending on the types of `a` and `b`.`
`+`
`+    See Also`
`+    --------`
`+    dot : Return the dot product without using the complex conjugate of the`
`+          first argument.`
`+`
`+    Examples`
`+    --------`
`+    >>> a = np.array([1+2j,3+4j])`
`+    >>> b = np.array([5+6j,7+8j])`
`+    >>> np.vdot(a, b)`
`+    (70-8j)`
`+    >>> np.vdot(b, a)`
`+    (70+8j)`
`+`
`+    Note that higher-dimensional arrays are flattened!`
`+`
`+    >>> a = np.array([[1, 4], [5, 6]])`
`+    >>> b = np.array([[4, 1], [2, 2]])`
`+    >>> np.vdot(a, b)`
`+    30`
`+    >>> np.vdot(b, a)`
`+    30`
`+    >>> 1*4 + 4*1 + 5*2 + 6*2`
`+    30`
`+`
`+    """`
`+    return dot(asarray(a).ravel().conj(), asarray(b).ravel())`
`+`
` def identity(n, dtype=None):`
`     """`
`     Return the identity array.`

File pypy/module/test_lib_pypy/numpypy/core/test_numeric.py

`                           [12, 15, 18]])`
`         assert (res == expected).all()`
` `
`+    def test_vdot(self):`
`+        import numpypy as np`
`+        a = np.array([1+2j,3+4j])`
`+        b = np.array([5+6j,7+8j])`
`+        c = np.vdot(a, b)`
`+        assert c == (70-8j)`
`+        c = np.vdot(b, a)`
`+        assert c == (70+8j)`
`+`
`+        a = np.array([[1, 4], [5, 6]])`
`+        b = np.array([[4, 1], [2, 2]])`
`+        c = np.vdot(a, b)`
`+        assert c == 30`
`+        c = np.vdot(b, a)`
`+        assert c == 30`
`+`
`     def test_identity(self):`
`         from numpypy import array, int32, float64, dtype, identity`
`         a = identity(0)`

File rpython/rtyper/lltypesystem/rstr.py

`             b.chars[i] = str.chars[i]`
`         return b`
` `
`-    @jit.look_inside_iff(lambda s: jit.isvirtual(s))`
`     @jit.elidable`
`     def ll_strhash(s):`
`         # unlike CPython, there is no reason to avoid to return -1`