Opened 9 years ago
Closed 5 years ago
#12287 closed defect (duplicate)
numpy array to matrix does not respect ring spesification
Reported by: | vlima | Owned by: | jason, was |
---|---|---|---|
Priority: | minor | Milestone: | sage-duplicate/invalid/wontfix |
Component: | linear algebra | Keywords: | numpy, matrix |
Cc: | Merged in: | ||
Authors: | Reviewers: | Vincent Delecroix | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: | todo |
Description
Example:
sage: import numpy as np sage: A = np.random.randint(2,size=(2,2)) sage: B = matrix(QQ,A) sage: B.parent() Full MatrixSpace of 2 by 2 dense matrices over Integer Ring
Expected result would be matrix over the rationals:
Full MatrixSpace of 2 by 2 dense matrices over Rational Field
Change History (8)
comment:1 Changed 9 years ago by
comment:2 Changed 8 years ago by
- Milestone changed from sage-5.11 to sage-5.12
comment:3 Changed 7 years ago by
- Milestone changed from sage-6.1 to sage-6.2
comment:4 Changed 7 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:5 Changed 7 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:6 Changed 6 years ago by
- Stopgaps set to todo
comment:7 Changed 5 years ago by
Does work on recent Sage
sage: import numpy as np sage: A = np.random.randint(2,size=(2,2)) sage: B = matrix(QQ,A) sage: B.parent() Full MatrixSpace of 2 by 2 dense matrices over Rational Field
comment:8 Changed 5 years ago by
- Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
- Resolution set to duplicate
- Reviewers set to Vincent Delecroix
- Status changed from new to closed
Duplicate of #20286.
Note: See
TracTickets for help on using
tickets.
In sage/matrix/constructor.py line 606 (sage-4.7.2):
If this is true, then the ring argument to matrix() will be ignored and <numpy array>.dtype determines the ring for the matrix. F.ex: