Opened 14 years ago
Closed 14 years ago
#6301 closed enhancement (fixed)
[with patch, positive review] implement the Hadamard product of two matrices
Reported by: | ncalexan | Owned by: | was |
---|---|---|---|
Priority: | minor | Milestone: | sage-4.1.1 |
Component: | linear algebra | Keywords: | elementwise Hadamard matrix product |
Cc: | rbeezer, ylchapuy | Merged in: | sage-4.1.1.alpha0 |
Authors: | Rob Beezer | Reviewers: | Jason Grout |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
That is, given a matrix A and another matrix B (of the same dimensions), form C such that C[i, j] = A[i, j] * B[i, j].
Attachments (1)
Change History (7)
comment:1 Changed 14 years ago by
Cc: | rbeezer added |
---|
comment:2 Changed 14 years ago by
Authors: | → Rob Beezer |
---|---|
Cc: | ylchapuy added |
Keywords: | elementwise added |
Summary: | implement the Hadamard product of two matrices → [with patch, needs review] implement the Hadamard product of two matrices |
Type: | defect → enhancement |
Changed 14 years ago by
Attachment: | trac_6301_elementwise_matrix_product.patch added |
---|
comment:3 Changed 14 years ago by
Summary: | [with patch, needs review] implement the Hadamard product of two matrices → [with patch, positive review] implement the Hadamard product of two matrices |
---|
Nice work! This all looks great. Doctests in these files pass as well. Positive review.
comment:4 Changed 14 years ago by
Reviewers: | → Jason Grout |
---|
comment:5 Changed 14 years ago by
Milestone: | sage-feature → sage-4.1.1 |
---|
comment:6 Changed 14 years ago by
Merged in: | → sage-4.1.1.alpha0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
Patch overview:
elementwise_product()
inmatrix2.pyx
checks inputs for proper sizes, and coerces base rings, etc.Then two versions of
_elementwise_product()
(inmatrix_dense.pyx
andmatrix_sparse.pyx
) take over and do the actual work in what should be a fairly efficient manner, given the generality implied.More efficient implementations are certainly possible for more specialized classes. The intent here is to begin with a correct and general implementation that is moderately efficient, primarily to make the functionality available in Sage.