BUG: Series dot product __rmatmul__ doesn't allow matrix vector multiplication
State: closed

- [x] closes #21530 
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

the new `__rmatmul__` implementation in Series seems to be missing matrix vector multiplication case as raised in the issue in question. Only inner product of two vectors was supported in `__rmatmul__` method.

This PR uses the same implementation in DataFrame to add support in Series and test case.

matmul operator (`@`, `@=`) was added in python 3.5 in https://www.python.org/dev/peps/pep-0465/

```python
class A(object):
    def __matmul__(self, other):
        print('__matmul__ is called in A.')

class B(object):
    def __rmatmul__(self, other):
        print('__rmatmul__ is called in B.')

A() @ B()
B() @ A()
del A.__matmul__
A() @ B()

>>> A() @ B()
__matmul__ is called in A.
>>> B() @ A()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for @: 'B' and 'A'
>>> del A.__matmul__
>>> A() @ B()
__rmatmul__ is called in B.
```

Labels:
name: Bug
name: Algos
description: Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff

Comments:
@minggli : Looks like a good start!  Can we also add a `whatsnew` too?
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=h1) Report
> Merging [#21578](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/028c9c0ef78878c9ef01570b47dd5211ef9d26ca?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/21578/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #21578   +/-   ##
=======================================
  Coverage    91.9%    91.9%           
=======================================
  Files         153      153           
  Lines       49549    49549           
=======================================
  Hits        45539    45539           
  Misses       4010     4010
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.3% <100%> (ø)` | :arrow_up: |
| #single | `41.78% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/21578/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `94.19% <100%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=footer). Last update [028c9c0...d5a0d28](https://codecov.io/gh/pandas-dev/pandas/pull/21578?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

raised an issue https://github.com/pandas-dev/pandas/issues/21581 regarding error message when `__rmatmul__` is called in dataframe and series. as dot method is implemented treating dataframe or series as left. when `__rmatmul__` is called the error message doesn't work well.

this is an existing error.

need advice. fix it in the same PR and how to do that or should we handle it separately? @jreback 
thanks @minggli very nice
Thanks @jreback and @gfyoung