1 | initial version |

Unfortunately, matrices can only be defined over a ring, not a semiring. For example it is the same with nonnegative integers:

```
sage: matrix(NN, 2)
ValueError: Invalid matrix constructor. Type matrix? for help
```

2 | No.2 Revision |

Unfortunately, matrices can only be defined over a ring, not a semiring. For example it is the same with nonnegative integers:

```
sage: matrix(NN, 2)
ValueError: Invalid matrix constructor. Type matrix? for help
```

**EDIT** You can use numpy matrices for basic operations:

```
sage: import numpy as np
sage: M = np.matrix([[T(1),T(2)],[T(3),T(4)]])
sage: M
matrix([[1.00000000000000, 2.00000000000000],
[3.00000000000000, 4.00000000000000]], dtype=object)
sage: M*M
matrix([[2.00000000000000, 3.00000000000000],
[4.00000000000000, 5.00000000000000]], dtype=object)
sage: M+M
matrix([[1.00000000000000, 2.00000000000000],
[3.00000000000000, 4.00000000000000]], dtype=object)
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.