-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
operations between jagged arrays and scalars #3607
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
Open
dvd101x
wants to merge
53
commits into
develop
Choose a base branch
from
jagged-arrays
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 10 commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
0f834fb
Refactor matAlgo14xDs
dvd101x c9d57a1
Included an algorithm for Array and scalars
dvd101x d273182
fixed name of the exporter function
dvd101x fb35b55
Merge branch 'develop' into jagged-arrays
dvd101x af646a8
Fixed missing variable
dvd101x 57c4cb2
Added tests and removed useMatrixForArrayScalar.js
dvd101x 8e58d2b
added more tests
dvd101x cdceb79
Added documentation
dvd101x d67b73d
Added benchmarks
dvd101x a720b66
Fixed comment to allow for non-rectangular arrays
dvd101x 4a215ed
Define terminology used for nested arrays.
dvd101x 4bdb5ca
Documentation fixes for non-rectangular arrays
dvd101x 8c6c47d
Removed concat and other dependancies from factory functions
dvd101x 47fc7aa
Merge branch 'develop' into jagged-arrays
dvd101x 2130ba6
Merge branch 'develop' into jagged-arrays
dvd101x 0c08fd0
Merge branch 'develop' into jagged-arrays
dvd101x 996a5e7
Merge branch 'develop' into jagged-arrays
dvd101x cbcb691
Include history of `add`
dvd101x b409734
Added `dotDivide` history
dvd101x dd37a16
Added `dotMultiply` history
dvd101x 2ba17c4
Added history of `dotPow`
dvd101x 7851c6c
Added history for `gcd`
dvd101x eeab295
Added history for `lcm`
dvd101x e353386
Added history for `mod`
dvd101x a5c7d8f
Added history for `nthRoot`
dvd101x 471b9a0
Added history for `nthRoot`
dvd101x 58fbad7
Added history for `subtract`
dvd101x 19b3bc2
Added history for `bitAnd`
dvd101x 6992600
Added history for `bitOr` and `bitXor`
dvd101x f8a0659
Added history to `leftShift`, `rightArithShift` and `rightLogShift`
dvd101x ac4bf47
Added history for `and`, `or` and `xor`
dvd101x ffd1e72
Added history of `compare`
dvd101x e565ada
History for `equal`
dvd101x 76aab1a
History for `larger`
dvd101x e71bb52
History for `largerEq`
dvd101x 1fab22a
history for `largerEq`
dvd101x 1e62b6c
Add history to `smaller`
dvd101x 4362b6e
History for `smallerEq`
dvd101x 7a58f84
History for `unequal`
dvd101x c7119db
History for `atan2`
dvd101x f127054
History for `to`
dvd101x 9c5e98b
Added some missing "`"
dvd101x a07bfa4
Format
dvd101x 493de05
Changed description from "Iterates" to "Deeply iterates"
dvd101x 0d4a91a
Merge branch 'develop' into jagged-arrays
gwhitney 0563b85
chore: make History format consistent; add test per #3537.
gwhitney d3d6f0e
Merge branch 'develop' into jagged-arrays
dvd101x 903dbdc
Add test for `optimizeCallbak`. Included unary info for `map`
dvd101x daf597e
added test for `optimizeCallback
dvd101x 88e1aa7
added more tests to `optimizeCallback`
dvd101x b520031
Restored capability to map non unary functions.
dvd101x f260f3c
Added tests to optimize callback findFirst
dvd101x c25a0ef
Fix tests for optimize callback
dvd101x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
This file was deleted.
Oops, something went wrong.
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import { factory } from '../../../utils/factory.js' | ||
| import { deepMap as map } from '../../../utils/array.js' | ||
|
|
||
| const name = 'matAlgo15xAs' | ||
| const dependencies = [] | ||
|
|
||
| export const createMatAlgo15xAs = /* #__PURE__ */ factory(name, dependencies, () => { | ||
| /** | ||
| * Iterates over Array items and invokes the callback function f(Aij..z, b). | ||
| * Callback function invoked once for each item. | ||
gwhitney marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * C(i,j,...z) = f(Aij..z, b) | ||
| * | ||
| * @param {Array} a The Array instance (A) | ||
| * @param {Scalar} b The Scalar value | ||
| * @param {Function} cf The f(Aij..z,b) operation to invoke | ||
| * @param {boolean} inverse A true value indicates callback should be invoked f(b,Aij..z) | ||
| * | ||
| * @return {Array} Array (C) | ||
| * | ||
| * https://github.com/josdejong/mathjs/pull/346#issuecomment-97659042 | ||
| */ | ||
| return function matAlgo15xAs (a, b, cf, inverse) { | ||
| return inverse ? map(a, v => cf(b, v), true) : map(a, v => cf(v, b), true) | ||
| } | ||
| }) | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import { Bench } from 'tinybench' | ||
| import { matrix, add, subtract, random } from '../../lib/esm/index.js' | ||
| import { formatTaskResult } from './utils/formatTaskResult.js' | ||
|
|
||
| const array = random([500, 500], -10, 10) | ||
| const genericMatrix = matrix(array) | ||
| const numberMatrix = matrix(array, 'dense', 'number') | ||
|
|
||
| // console.log('data', array) | ||
| // console.log('abs(data)', abs(array))npm run | ||
|
|
||
| const bench = new Bench({ time: 100, iterations: 100 }) | ||
| .add('add(array, 1)', () => { | ||
| add(array, 1) | ||
| }) | ||
| .add('add(matrix, 1)', () => { | ||
| add(genericMatrix, 1) | ||
| }) | ||
| .add('add(numberMatrix, 1)', () => { | ||
| add(numberMatrix, 1) | ||
| }) | ||
| .add('subtract(array, 1)', () => { | ||
| subtract(array, 1) | ||
| }) | ||
| .add('subtract(matrix, 1)', () => { | ||
| subtract(genericMatrix, 1) | ||
| }) | ||
| .add('subtract(numberMatrix, 1)', () => { | ||
| subtract(numberMatrix, 1) | ||
| }) | ||
|
|
||
| bench.addEventListener('cycle', (event) => console.log(formatTaskResult(bench, event.task))) | ||
| await bench.run() |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.