Repository: ManimCommunity/manim

Issue:
Update Matrix to ensure consistency
## Motivation
<!-- Outline your motivation: In what way do your changes improve the library? -->
As described in #924, ```Matrix``` shows inconsistent behavior depending on whether ```DecimalNumber``` or ```MathTex``` is used as the underlying mobject. Additionally, passing a 1d row-vector results in a column-vector to be displayed (Note that while this is not a breaking change, it changes the visualization of existing code!).

Closes #924 



## Overview / Explanation for Changes
<!-- Give an overview of your changes and explain how they
resolve the situation described in the previous section.

For PRs introducing new features, please provide code snippets
using the newly introduced functionality and ideally even the
expected rendered output. -->

The following change addresses both points mentioned in the motivation.
```py
matrix = np.array(matrix, ndmin=1)
```
to
```py
matrix = np.array(matrix, ndmin=2)
```

The other change, which is the introduction of the ```transpose``` argument is for the following reason:
```py
from manim import *


class Test(Scene):
    def construct(self):
        arr = np.array([0.1, 0.3])
        # Transposing a vector does not do anything!
        m1 = DecimalMatrix(arr.transpose())
        self.add(m1)

        # Transposing a vector (remember ndmin=2 in matrix.py) now works!
        m2 = DecimalMatrix(arr, transpose=True).next_to(m1, DOWN)
        self.add(m2)

        self.wait(2)
```
Resulting image:
<img width="443" alt="Screenshot 2021-01-11 at 11 57 04" src="https://user-images.githubusercontent.com/22744609/104172306-5d7ce280-5404-11eb-9bec-ef8941b96951.png">


## Oneline Summary of Changes
```
- Ensure consistent matrix behavior (:pr:`925`)
```

## Testing Status
Just tested with the code above and a part of my codebase (consisting of around 6 different matrices)


## Acknowledgements
- [x] I have read the [Contributing Guidelines](https://docs.manim.community/en/latest/contributing.html)

<!-- Once again, thanks for helping out by contributing to manim! -->


<!-- Do not modify the lines below. -->
## Reviewer Checklist
- [ ] Newly added functions/classes are either private or have a docstring
- [ ] Newly added functions/classes have [tests](https://github.com/ManimCommunity/manim/wiki/Testing) added and (optional) examples in the docs
- [ ] Newly added documentation builds, looks correctly formatted, and adds no additional build warnings
- [ ] The oneline summary has been included [in the wiki](https://github.com/ManimCommunity/manim/wiki/Changelog-for-next-release)



Discussion:
I'd also like to change the ```matrix``` variable to ```self.matrix``` to ensure access to the underlying numpy array. Please let me know what you think of it.

Resolving patch:
diff --git a/manim/mobject/matrix.py b/manim/mobject/matrix.py
--- a/manim/mobject/matrix.py
+++ b/manim/mobject/matrix.py
@@ -78,7 +78,7 @@ def __init__(
         element_alignment_corner=DR,
         left_bracket="\\big[",
         right_bracket="\\big]",
-        **kwargs
+        **kwargs,
     ):
         """
         Matrix can either either include numbers, tex_strings,
@@ -96,7 +96,11 @@ def __init__(
         self.left_bracket = left_bracket
         self.right_bracket = right_bracket
         VMobject.__init__(self, **kwargs)
-        matrix = np.array(matrix, ndmin=1)
+        if len(matrix.shape) < 2:
+            raise ValueError(
+                f"{self.__str__()} class requires a two-dimensional array!"
+            )
+        matrix = np.array(matrix)
         mob_matrix = self.matrix_to_mob_matrix(matrix)
         self.organize_mob_matrix(mob_matrix)
         self.elements = VGroup(*mob_matrix.flatten())
@@ -198,14 +202,14 @@ def __init__(
         matrix,
         element_to_mobject=DecimalNumber,
         element_to_mobject_config={"num_decimal_places": 1},
-        **kwargs
+        **kwargs,
     ):
         Matrix.__init__(
             self,
             matrix,
             element_to_mobject=element_to_mobject,
             element_to_mobject_config=element_to_mobject_config,
-            **kwargs
+            **kwargs,
         )
 
 


Test patch: