Hi all,
I'm trying to use the qtvwave library to build a simple mex C function to calculate Rayleigh wave ellipticity. As Marc suggested in another post, I started playing with the gpell code and after some copy, paste and modify, now the code is somehow running.
However I get a segmentation fault in all those particular cases where gpell produces some warning (e.g. ** Warning ** : _x2 == min). In all other cases it works well.
I'm still not 100% sure this can cause the problem but, just in case, is there any automatic way to suppress these warnings and any console output?
Thanks,
Valerio
Turn off warning
Turn off warning
- Attachments
-
- gpell_core.cpp
- (1.63 KiB) Downloaded 860 times
Hi Valerio,
In latest release the warning is either fixed or it does not produce any crash. For your information, in the next release qtbwave library has been renamed to GpCoreWave. Among other reasons I wanted to get rid of prefix 'Qtb' which means nothing and prefer using namespace. Porting from one version to the other is really not a big deal (just a few replacements).
I can't remember if there was a C and a Fortran interface to that library at the time you implement your mex function. Now, there is a C interface to the computation of dispersion and ellipticity curves.
Thanks for the code.
In latest release the warning is either fixed or it does not produce any crash. For your information, in the next release qtbwave library has been renamed to GpCoreWave. Among other reasons I wanted to get rid of prefix 'Qtb' which means nothing and prefer using namespace. Porting from one version to the other is really not a big deal (just a few replacements).
I can't remember if there was a C and a Fortran interface to that library at the time you implement your mex function. Now, there is a C interface to the computation of dispersion and ellipticity curves.
Thanks for the code.
Reading your code, I do not understand exactly what your are doing. Are you calculating the curve for two samples only? Why not setting the number of samples in the argument of the function?
On the output, what do you expect? One single value? Or a complete vector containing the ellipticity curve? Do you know to return a vector to Matlab? And how to accept a vector, for instance the sampling vector?
On the output, what do you expect? One single value? Or a complete vector containing the ellipticity curve? Do you know to return a vector to Matlab? And how to accept a vector, for instance the sampling vector?
Thanks for the reply.
Yes, I know this code could appear a little awful...
but this was the last of a long series of tests were I changed a lot of stuff, and the interface has been generally defined for testing purposes only (so, it is not optimized at all). Of course the Mex final interface would have been better written ;-p
The idea was just of getting one unique output value out of one unique frequency. Unfortunately, I can't make it working even in this simple case.
Anyway, now that I know about the new C interface, I will use it.
Thanks once again!
Valerio
Yes, I know this code could appear a little awful...

but this was the last of a long series of tests were I changed a lot of stuff, and the interface has been generally defined for testing purposes only (so, it is not optimized at all). Of course the Mex final interface would have been better written ;-p
The idea was just of getting one unique output value out of one unique frequency. Unfortunately, I can't make it working even in this simple case.
Anyway, now that I know about the new C interface, I will use it.
Thanks once again!
Valerio
Just a remark to get one single frequency point in the ellipticity curve.
If the sampling is rather poor it is likely to produce very bad results. To compute an ellipticity curve it is necessary to first compute the dispersion curve which requires a large band to allow automatic validity tests. So the best solution if you want just one point, let's say at 1 Hz, is to add samples before and after: e.g. 25 samples from 0.1Hz to 1Hz and other 25 from 1Hz to 10 Hz. Do the computation and return only the 26th value located at 1Hz.
If the sampling is rather poor it is likely to produce very bad results. To compute an ellipticity curve it is necessary to first compute the dispersion curve which requires a large band to allow automatic validity tests. So the best solution if you want just one point, let's say at 1 Hz, is to add samples before and after: e.g. 25 samples from 0.1Hz to 1Hz and other 25 from 1Hz to 10 Hz. Do the computation and return only the 26th value located at 1Hz.