Comments (14)
Greetings, Andrew,
Thanks for checking this out. I might have had slightly illegal overloads of std::isnan etc. for complex but your solution, or maybe std::isinf(std::real(iv.fx[i])) || std::isinf(std::imag(iv.fx[i])) since those work for reals might be nicer.
I'll work on this tonight.
Cheers, Ed
from quadrature.
Thank you for looking into this Ed,
For your info, I ripped your functions from the __gnu_cxx namespace (as I had trouble compiling out-of-the-box) and placed them in my own namespace to test, and am using g++11 with c++20 standard. My test with double did work as expected.
Cheers,
Andrew
from quadrature.
I'm thinking I need a namespace of my own. I thought these were going into the libstdc++ gnu library but that's probably just not realistic.
from quadrature.
I think it could be useful for the community, a new flexible numerical tools library with straightforward api. You have a lot of nice functionalities in the various libraries. Unfortunately you may be right, it may take time (too long) to be part of the standard. Have you thought much about branching these off to their own thing?
from quadrature.
I have thought of that: 1. break things up (at least the directory structure suggests this), 2. Use a new namespace so I'm not in std (except for what is really in there) and __gnu_cxx; 3. maybe MIT license things that are not in official libstdc++.
Do you have any short test-cases/reproducers that you could post? I could figure them out but if you have them on hand it would help.
from quadrature.
- Stop uglifying names with __x and _X like a system library must do.
These are in no particular order.
from quadrature.
Here is a repo of my rip. I have a function test_integrate.cpp where I use a simple test case, as well as some of my compile logs. the routines are in a namespace 'math'. (note I also did remove the leading underscores on variables/functions because I was trying to understand what you coded). I could very well be not using the library correctly, but this did work for double type.
https://github.com/ajackura/math_quadrature
compiled the test simply with
g++ -std=c++20 test_integrate.cpp o test_integrate -I./include/ 2> compile.log
from quadrature.
note also very slightly reorganized since I was playing with this, so I could have broken something inadvertently
from quadrature.
#include "include/ext/integration.h"
#include
std::complex<double>
fun(double x)
{
using namespace std::complex_literals;
return 1.0 / (x*x - 1.0i * x);
}
int
main()
{
const auto I = __gnu_cxx::integrate_clenshaw_curtis(fun, 1.0, 4.0, 0.000001, 0.0000111, 12);
}
from quadrature.
So, this test works for me, the integrate_clenshaw_curtis does not seem to have a problem with complex types. If I change integrate_singular (to use qags), then I get the following errors
from quadrature.
Ugh. I think the workspace type in the caller is right <double, complex>. I don't know why the integration routine expects <double, double>.
I'll figure it out.
I might have to make a reduced thing that gives the template error.
from quadrature.
Ok, try it now.
I just got complex type deduction working for all integrals.
I get the same test results as before.
I need to add complex integration tests. Maybe I'll try a function returning a 3-vector or something.
I did not do the other code reorgs yet, I wanted to fix the bug first.
from quadrature.
My first test with the qags method worked for double and complex type. I will keep testing this out as I play with it. I am doing some test on the use of these routines in my integral equations code for complex and real types, so there will be plenty of test to come.
Thanks a lot Ed, I'll be examining more of this library and let you know if I come across anything.
from quadrature.
Ok, So I'm closing this one out.
Thank you for testing this!
from quadrature.
Related Issues (10)
- Make canned double exp integral rules. HOT 1
- Add Lebedev quadrature for 3D spherical (2D surface) integration.
- Perhaps the tanh_sinh integral could use an open midpoint rule? HOT 1
- Oscillatory integrals and tests... HOT 3
- Make sure that a == b returns zero quickly, and that b < a (b -> a) gives -(a -> b). HOT 1
- The qcheb algorithm is a mystery and is inflexible.
- The double-exponential methods need error estimates. HOT 1
- __gnu_cxx::factorial<_Tp> not defined in the --gnu_cxx namespace HOT 3
- Try to decouple this from upstream projects like specfun (tr28124) and polynomial. 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 quadrature.