removing not necessary N () to improve performance #1
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.
Unnecessary calls to sympy.N may increase computational cost
Description
Replace N(k) for k, where k = 1, 2, or 3
Motivation and Context
Improve performance. For instance
import sympy as sp
tic = time.time()
for k in range(1000):
a = 2
toc = time.time()
print('time without sympy.N', toc-tic, 's')
tic = time.time()
for k in range(1000):
a = sp.N(2)
toc = time.time()
print('time with sympy.N', toc-tic, 's')
outputs
time without sympy.N 5.888938903808594e-05 s
time with sympy.N 0.012852907180786133 s
How Has This Been Tested?
make test
Screenshots (if appropriate):
Types of changes
Checklist: