Comments (1)
The culprit is likely to be line 29 in src/matrix_to_parameters.jl which subtracts cos(α)^4 - sin(α)^4
. When alpha is 0.25pi and 1.25pi cos(α)
is equal to sin(α)
. However due to numerical issues, both when calculating alpha and when calculating the subtraction of the 4th power of these functions, the actual value is not quite a zero:
println(cos(0.25pi)^4 - sin(0.25pi)^4); println(cos(α)^4 - sin(α)^4)
1.3877787807814457e-16
1.3877787807814457e-16
The behaviour has also been noted for negative values of alpha close to -0.25pi and -1.25pi.
We can fix this issue by enhancing the precision of our calculations using BigFloat
on the normalised matrix Hw on line 26. A precision of 64 gives a satisfactory result, however, it does impact the performance of the function by about 40 times. Lower precision values also gave good results for this test case, however, the additional precision was valuable when the magnitude of the two variables is significantly different.
A satisfactory compromise is to selectively enhance the precision if alpha is detected to be close to these problematic values using: isapprox(abs(rem(α/pi, 1)), 0.25, atol=1e-2)
from ellipsesampling.jl.
Related Issues (7)
- Register EllipseSampling.jl HOT 2
- TagBot trigger issue HOT 5
- Patch version to 0.1.1 HOT 3
- Patch version to 0.1.2 HOT 1
- Patch version to 0.1.3 HOT 1
- Minor release to v0.2.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ellipsesampling.jl.