Type definition missing for matrixFrom* #3115#3146
Closed
Hudsxn wants to merge 6 commits intojosdejong:developfrom
Closed
Type definition missing for matrixFrom* #3115#3146Hudsxn wants to merge 6 commits intojosdejong:developfrom
Hudsxn wants to merge 6 commits intojosdejong:developfrom
Conversation
…nges to package-lock.json with using npm install to run the unit tests & lint tests
josdejong
reviewed
Feb 2, 2024
Owner
josdejong
left a comment
There was a problem hiding this comment.
Thanks @Hudsxn , this looks good already!
Can you please add some tests to typescript-tests/testTypes.ts to verify that the types indeed work (and guard that they keep working in the future)?
| * Create a dense matrix from vectors as individual rows. If you pass column vectors, they will be transposed (but not conjugated!) | ||
| * @param rows - a multi-dimensional number array or matrix | ||
| */ | ||
| matrixFromRows<T extends (number | BigNumber)[] | Matrix>(...rows: T[]): T[] |
Owner
There was a problem hiding this comment.
I think you can use MathCollection here? Looking at the examples of these functions, they also support nested arrays for example, not only a flat array.
Collaborator
There was a problem hiding this comment.
Actually, they only allow vectors, or vectors of one-tuples. I am trying to capture that in an update to polish off this PR to get it off the queue.
Owner
|
@Hudsxn can you have a look at my feedback? |
Owner
|
Ping @Hudsxn |
Collaborator
|
Superseded by #3371. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added in the typescript definitions for matrixFromRows, matrixFromColumns and matrixFromFunction, Also created a type:
And swapped out other references, and created a type for the callback function on the matrixFromFunction: