Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

added extraction/generation of diagonal/triangonal matrices to linalg #14501

Merged
merged 1 commit into from
Apr 30, 2019

Conversation

asmushetzel
Copy link
Contributor

Description

This add operators to the linalg namespace to

  • extract a diagonal from a single or a batch of square matrices
  • construct a single or a batch of square diagonal matrices
  • extract a triangle from a single or a batch of square matrices
  • construct a single or a batch of square triangular matrices

This operators are useful for various tasks when working with linear algebra. We have a specific use case already where batches of triangular matrices exist and the non-zero entries above/below some diagonal must be rearranged as 1-d tensors.

There are various variants of such diagonal/triangular matrix manipulation in numpy (tril/triu/diag/diagonal/diagflat) and also one already in MXNet (diag-operator). Unfortunately without real consistency. MXNet's current diag operator is consistent with numpy's diag. So it lacks any notion of batches of matrices which is a fundamental concept for all linalg-operators.

It doesn't seem to be useful to write the "one fits all" operator for all types of manipulation of diagonal/triangular matrix operations. So this PR rather provides a consistent mechanism that can be used in the context of "linalg"-namespace and supports the usual operations that people need when they do advanced linear algebra. In particular, it does support the same level of batched matrix support, the same data types, diagonal and triangular matrices and enough flexibility to deal also with diagonal/triangular matrices that are defined by other than the main diagonal.

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • [ X] Changes are complete (i.e. I finished coding on this PR)
  • [ X] All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • [ X] Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http:https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • [X ] To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@asmushetzel asmushetzel requested a review from szha as a code owner March 22, 2019 09:24
@asmushetzel asmushetzel force-pushed the diagtrian branch 3 times, most recently from 7d5e1db to b0fe5e4 Compare March 22, 2019 11:22
@asmushetzel
Copy link
Contributor Author

@mseeger you may be interested in these operators

@asmushetzel
Copy link
Contributor Author

All checks passed except two and the latter ones apparently related to a connectivity issue where they tried to download some data from a different server. Not sure that I can do anything about this. Any advice?

@pinaraws
Copy link

@mxnet-label-bot add[pr-awaiting-review, Operator]

@marcoabreu marcoabreu added Operator pr-awaiting-review PR is waiting for code review labels Mar 25, 2019
@szha
Copy link
Member

szha commented Apr 3, 2019

@asmushetzel thanks for the contribution. Could you rebase the PR to the latest commit on master?

@asmushetzel
Copy link
Contributor Author

rebased.

@asmushetzel
Copy link
Contributor Author

Anything that I can help with to get this through?

@Roshrini
Copy link
Member

@asmushetzel Thanks for working on this. @eric-haibin-lin @reminisce @apeforest @anirudh2290 Can you please help review this PR?

@roywei
Copy link
Member

roywei commented Apr 29, 2019

@eric-haibin-lin @reminisce @apeforest @anirudh2290 gentle ping for review. Thanks!

@szha szha merged commit c7577e5 into apache:master Apr 30, 2019
@asmushetzel asmushetzel deleted the diagtrian branch May 1, 2019 09:39
access2rohit pushed a commit to access2rohit/incubator-mxnet that referenced this pull request May 14, 2019
haohuanw pushed a commit to haohuanw/incubator-mxnet that referenced this pull request Jun 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Operator pr-awaiting-review PR is waiting for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants