Skip to content

Conversation

Jason-S-Ross
Copy link
Contributor

References to other Issues or PRs

Fixes #21870

Brief description of what is fixed or changed

Check if the argument is an NDimArray before checking if it is Iterable since arrays are iterable.

Other comments

Release Notes

  • tensor
    • Fix bug with arrays of rank 0 getting promoted to arrays of rank 1

@sympy-bot
Copy link

sympy-bot commented Aug 14, 2021

Hi, I am the SymPy bot (v161). I'm here to help you write a release notes entry. Please read the guide on how to write release notes.

Your release notes are in good order.

Here is what the release notes will look like:

  • tensor

This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.9.

Click here to see the pull request description that was parsed.
<!-- Your title above should be a short description of what
was changed. Do not include the issue number in the title. -->

#### References to other Issues or PRs
<!-- If this pull request fixes an issue, write "Fixes #NNNN" in that exact
format, e.g. "Fixes #1234" (see
https://tinyurl.com/auto-closing for more information). Also, please
write a comment on that issue linking back to this pull request once it is
open. -->

Fixes #21870

#### Brief description of what is fixed or changed
Check if the argument is an `NDimArray` _before_ checking if it is `Iterable` since arrays are iterable.

#### Other comments


#### Release Notes

<!-- Write the release notes for this release below between the BEGIN and END
statements. The basic format is a bulleted list with the name of the subpackage
and the release note for this PR. For example:

* solvers
  * Added a new solver for logarithmic equations.

* functions
  * Fixed a bug with log of integers.

or if no release note(s) should be included use:

NO ENTRY

See https://github.com/sympy/sympy/wiki/Writing-Release-Notes for more
information on how to write release notes. The bot will check your release
notes automatically to see if they are formatted correctly. -->

<!-- BEGIN RELEASE NOTES -->
* tensor
  * Fix bug with arrays of rank 0 getting promoted to arrays of rank 1
<!-- END RELEASE NOTES -->

Update

The release notes on the wiki have been updated.

@github-actions
Copy link

Benchmark results from GitHub Actions

Lower numbers are good, higher numbers are bad. A ratio less than 1
means a speed up and greater than 1 means a slowdown. Green lines
beginning with + are slowdowns (the PR is slower then master or
master is slower than the previous release). Red lines beginning
with - are speedups.

Significantly changed benchmark results (PR vs master)

Significantly changed benchmark results (master vs previous release)

       before           after         ratio
     [ed9a550f]       [3ba05b51]
     <sympy-1.8^0>                 
-      1.25±0.01s          168±4ms     0.13  dsolve.TimeDsolve01.time_dsolve
-      10.8±0.01s       5.19±0.04s     0.48  integrate.TimeIntegrationRisch02.time_doit_risch(100)
+         123±2ms          190±2ms     1.54  logic.LogicSuite.time_dpll2
-        96.6±3μs       36.1±0.2μs     0.37  matrices.TimeDiagonalEigenvals.time_eigenvals
-         109±5μs         71.9±2μs     0.66  matrices.TimeMatrixGetItem.time_ImmutableDenseMatrix_getitem
-         111±1μs         73.0±2μs     0.66  matrices.TimeMatrixGetItem.time_ImmutableSparseMatrix_getitem
-         105±2μs         63.5±1μs     0.61  solve.TimeMatrixArithmetic.time_dense_add(10, 0)
+      13.3±0.4μs         23.2±1μs     1.74  solve.TimeMatrixArithmetic.time_dense_add(3, 0)
+      16.7±0.2μs         36.7±1μs     2.20  solve.TimeMatrixArithmetic.time_dense_add(3, 5)
+      24.7±0.6μs       49.6±0.7μs     2.01  solve.TimeMatrixArithmetic.time_dense_add(4, 5)
+        45.1±2μs         80.0±1μs     1.77  solve.TimeMatrixArithmetic.time_dense_add(6, 5)
-     1.52±0.03ms          274±7μs     0.18  solve.TimeMatrixArithmetic.time_dense_multiply(10, 0)
-        59.0±2μs         30.9±2μs     0.52  solve.TimeMatrixArithmetic.time_dense_multiply(3, 0)
+        90.7±2μs          164±3μs     1.81  solve.TimeMatrixArithmetic.time_dense_multiply(3, 5)
-         127±5μs       37.6±0.8μs     0.30  solve.TimeMatrixArithmetic.time_dense_multiply(4, 0)
-         371±5μs         81.4±2μs     0.22  solve.TimeMatrixArithmetic.time_dense_multiply(6, 0)
-         113±1μs       52.6±0.9μs     0.46  solve.TimeMatrixOperations.time_det(3, 0)
-         215±2μs          126±3μs     0.59  solve.TimeMatrixOperations.time_det(3, 2)
-         206±7μs          117±2μs     0.57  solve.TimeMatrixOperations.time_det(3, 5)
-         117±4μs         53.6±1μs     0.46  solve.TimeMatrixOperations.time_det_bareiss(3, 0)
-         210±2μs          128±2μs     0.61  solve.TimeMatrixOperations.time_det_bareiss(3, 2)
-         200±3μs          120±4μs     0.60  solve.TimeMatrixOperations.time_det_bareiss(3, 5)
-         121±4μs       53.9±0.7μs     0.44  solve.TimeMatrixOperations.time_det_berkowitz(3, 0)
-         208±3μs          126±2μs     0.60  solve.TimeMatrixOperations.time_det_berkowitz(3, 2)
-         200±4μs          113±4μs     0.57  solve.TimeMatrixOperations.time_det_berkowitz(3, 5)
+         904±7μs      1.43±0.03ms     1.59  solve.TimeMatrixOperations.time_det_berkowitz(4, 0)
+     1.08±0.01ms      2.11±0.06ms     1.96  solve.TimeMatrixOperations.time_det_berkowitz(4, 2)
+     1.15±0.01ms      2.24±0.04ms     1.94  solve.TimeMatrixOperations.time_det_berkowitz(4, 5)
+         334±3μs          583±8μs     1.74  solve.TimeMatrixOperations.time_rank(3, 0)
+         515±9μs         844±20μs     1.64  solve.TimeMatrixOperations.time_rank(4, 0)
-      6.23±0.1ms       3.39±0.1ms     0.54  solve.TimeRationalSystem.time_linsolve(10)
-     1.27±0.05ms         838±20μs     0.66  solve.TimeRationalSystem.time_linsolve(5)
+     1.25±0.01ms      1.91±0.04ms     1.53  solve.TimeSparseSystem.time_linear_eq_to_matrix(10)
+      7.69±0.1ms       11.7±0.2ms     1.52  solve.TimeSparseSystem.time_linear_eq_to_matrix(30)
-     1.51±0.02ms      1.01±0.01ms     0.67  solve.TimeSparseSystem.time_linsolve_eqs(10)
-     2.87±0.05ms      1.77±0.04ms     0.62  solve.TimeSparseSystem.time_linsolve_eqs(20)
-     4.15±0.07ms      2.65±0.04ms     0.64  solve.TimeSparseSystem.time_linsolve_eqs(30)

Full benchmark results can be found as artifacts in GitHub Actions
(click on checks at the top of the PR).

@smichr smichr merged commit c27951f into sympy:master Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tensors of rank 0 turn into arrays of rank 1 when .replace_with_arrays is called
4 participants