-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type definition missing for matrixFrom* #3115 #3146
base: develop
Are you sure you want to change the base?
Conversation
…nges to package-lock.json with using npm install to run the unit tests & lint tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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[] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@Hudsxn can you have a look at my feedback? |
Ping @Hudsxn |
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: