search for: tanh

Displaying 20 results from an estimated 56 matches for "tanh".

Did you mean: anh
2017 Mar 17
4
Hyperbolic tangent different results on Windows and Mac
Dear all, We seem to have found a "strange" behaviour in the hyperbolic tangent function tanh on Windows. When running tanh(356 + 0i) the Windows result is NaN + 0.i while on Mac the result is 1 + 0i. It doesn't seem to be a floating point error because on Mac it is possible to run arbitrarily large numbers (say tanh( 999999677873648767519238192348124812341234182374817239847812738481234...
2017 Mar 27
1
Hyperbolic tangent different results on Windows and Mac
.... The problem can be produced > with C++ without R: > > #include <iostream> > #include <cmath> > #include <complex> > > int main(){ > std::cout << std::fixed; > std::complex<double> z(356, 0); > std::cout << "tanh" << z << " = " << std::tanh(z) > << " (tanh(356) = " << std::tanh(356) << ")\n"; > } > > On OS-X we get: > > tanh(356.000000,0.000000) = (1.000000,-0.000000) (tanh(356) = 1.000000) > > But on...
2017 May 04
2
complex tests failure
For a while I have been getting that the complex tests fails on RHEL 6. The specific issue has to do with tanh (see below for full output from complex.Rout.fail). This is both with the stock compiler (GCC 4.4.7) and a compiler supplied through the conda project (GCC 4.8.5). The compiler supplied through conda ends up linking R to certain system files, so the binary is not completely independent (although...
2017 May 04
2
complex tests failure
...ings? Obviously that would be great for something like this which affects tests and seems to be a known problem for older C standard libraries. Best, Kasper On Thu, May 4, 2017 at 9:12 AM, Tomas Kalibera <tomas.kalibera at gmail.com> wrote: > > As a quick fix, you can undefine HAVE_CTANH in complex.c, somewhere after > including config.h > An internal substitute, which is implemented inside complex.c, will be > used. > > Best > Tomas > > > > > On 05/04/2017 02:57 PM, Kasper Daniel Hansen wrote: > >> For a while I have been getting that the...
2017 May 05
1
complex tests failure
...older C standard libraries. >> >> Best, >> Kasper >> >> On Thu, May 4, 2017 at 9:12 AM, Tomas Kalibera >> <tomas.kalibera at gmail.com <mailto:tomas.kalibera at gmail.com>> wrote: >> >> >> As a quick fix, you can undefine HAVE_CTANH in complex.c, >> somewhere after including config.h >> An internal substitute, which is implemented inside complex.c, >> will be used. >> >> Best >> Tomas >> >> >> >> >> On 05/04/2017 02:57 PM, Kasper Daniel H...
2012 Jul 11
2
nls problem: singular gradient
...s nls with "singular gradient" here? I post a minimal example on the bottom and would be very happy if someone could help me. Kind regards, ########### # define some constants smallc <- 0.0001 t <- seq(0,1,0.001) t0 <- 0.5 tau1 <- 0.02 # generate yy(t) yy <- 1/2 * ( 1- tanh((t - t0)/smallc) * exp(-t / tau1) ) + rnorm(length(t))*0.01 # show the curve plot(x=t, y=yy, pch=18) # prepare data dd <- data.frame(y=yy, x=t) nlsfit <- nls(data=dd, y ~ 1/2 * ( 1- tanh((x - ttt)/smallc) * exp(-x / tau2) ), start=list(ttt=0.4, tau2=0.1) , trace=TRUE) # get error: # E...
2009 Feb 17
2
[LLVMdev] Pure external functions
On Tuesday 17 February 2009 09:46:07 Duncan Sands wrote: > Hi, > > > Lennart Augustsson mentioned on his blog that he got substantial > > performance improvements by conveying to LLVM when external functions > > (e.g. tanh) were pure. > > first note that tanh is not pure, because the result depends on the current > floating point rounding mode. Ugh. > However, if you are willing to sacrifice > complete numerical correctness, you can give llvm-gcc the -ffast-math flag > and, voila!, tanh becomes p...
2019 Apr 16
2
[FP] Constant folding math library functions
...ead to minor differences in results. A colleague sent me the following test case which demonstrates the issue: #include <stdio.h> #include <math.h> typedef union { double d; unsigned long long i; } my_dbl; int main(void) { my_dbl res, x; x.i = 0x3feeb39556255de2ull; res.d = tanh(x.d); printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i); return 0; } Compiling with "clang -O2 -g0 -emit-llvm" I get this: define dso_local i32 @main() local_unnamed_addr #0 { %1 = tail call double @tanh(double 0x3FEEB39556255DE2) #2 %2 = tail call i32 (i8*, ...) @...
2009 Feb 17
2
[LLVMdev] Pure external functions
Lennart Augustsson mentioned on his blog that he got substantial performance improvements by conveying to LLVM when external functions (e.g. tanh) were pure. How is this done? -- Dr Jon Harrop, Flying Frog Consultancy Ltd. http://www.ffconsultancy.com/?e
2009 Feb 17
0
[LLVMdev] Pure external functions
Hi, > Lennart Augustsson mentioned on his blog that he got substantial performance > improvements by conveying to LLVM when external functions (e.g. tanh) were > pure. first note that tanh is not pure, because the result depends on the current floating point rounding mode. However, if you are willing to sacrifice complete numerical correctness, you can give llvm-gcc the -ffast-math flag and, voila!, tanh becomes pure. Ciao, Duncan.
2017 May 04
0
complex tests failure
As a quick fix, you can undefine HAVE_CTANH in complex.c, somewhere after including config.h An internal substitute, which is implemented inside complex.c, will be used. Best Tomas On 05/04/2017 02:57 PM, Kasper Daniel Hansen wrote: > For a while I have been getting that the complex tests fails on RHEL 6. > The specific issue has...
2017 May 04
0
complex tests failure
...eems to be a known problem for older C > standard libraries. > > Best, > Kasper > > On Thu, May 4, 2017 at 9:12 AM, Tomas Kalibera > <tomas.kalibera at gmail.com <mailto:tomas.kalibera at gmail.com>> wrote: > > > As a quick fix, you can undefine HAVE_CTANH in complex.c, > somewhere after including config.h > An internal substitute, which is implemented inside complex.c, > will be used. > > Best > Tomas > > > > > On 05/04/2017 02:57 PM, Kasper Daniel Hansen wrote: > > For a while I...
2017 Mar 21
0
Hyperbolic tangent different results on Windows and Mac
>>>>> Rodrigo Zepeda <rzepeda17 at gmail.com> >>>>> on Fri, 17 Mar 2017 12:56:06 -0600 writes: > Dear all, > We seem to have found a "strange" behaviour in the hyperbolic tangent > function tanh on Windows. > When running tanh(356 + 0i) the Windows result is NaN + 0.i while on Mac > the result is 1 + 0i. It doesn't seem to be a floating point error because > on Mac it is possible to run arbitrarily large numbers (say tanh( > 999999677873648767519238192348124...
2019 Apr 16
2
[FP] Constant folding math library functions
...differences in results. A colleague sent me the following test case which demonstrates the issue: #include <stdio.h> #include <math.h> typedef union { double d; unsigned long long i; } my_dbl; int main(void) { my_dbl res, x; x.i = 0x3feeb39556255de2ull; res.d = tanh(x.d); printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i); return 0; } Compiling with "clang -O2 -g0 -emit-llvm" I get this: define dso_local i32 @main() local_unnamed_addr #0 { %1 = tail call double @tanh(double 0x3FEEB39556255DE2) #2 %2 = tail call i32 (i8...
2019 Apr 17
3
[FP] Constant folding math library functions
...ead to minor differences in results. A colleague sent me the following test case which demonstrates the issue: #include <stdio.h> #include <math.h> typedef union { double d; unsigned long long i; } my_dbl; int main(void) { my_dbl res, x; x.i = 0x3feeb39556255de2ull; res.d = tanh(x.d); printf("tanh(%f) = %f = %016LX\n", x.d, res.d, res.i); return 0; } Compiling with “clang -O2 -g0 -emit-llvm” I get this: define dso_local i32 @main() local_unnamed_addr #0 { %1 = tail call double @tanh(double 0x3FEEB39556255DE2) #2 %2 = tail call i32 (i8*, ...) @printf(i8*...
2014 May 17
3
PATCH for replaygain_synthesis
The file src/share/replaygain_synthesis/include/private/fast_float_math_hack.h redefines 'tanh' as 'tanhf'. This file is intended for Intel Compiler only, but it includes outdated mathf.h and doesn't work with current versions of ICC. The fixes are trivial though, and I compiled 2 versions of flac.exe: with this 'hack' turned off an on. The difference in decoding spe...
2011 Jul 02
2
Vector of functions
Hi there, I have a vector of some functions e.g. #-----------------------------# f.1 <- function(a) { return( a ); } f.2 <- function(a) { return( 1 - (tanh(a))^2 ); } f.3 <- function(a) { return( 1 / (1+exp(-a)) * (1 - (1 / (1+exp(-a)))) ); } func.l <- c(f.1, f.2, f.3); #-----------------------------# and would like to calculate the output value of a function in the vector, that is, pick e.g. function at position 2 in func.l and calculate t...
2014 May 18
0
PATCH for replaygain_synthesis
...f their is any real benefit, but changing the include in fast_float_math_hack.h to <mathimf.h> is all that is required to use the latest ICC. John On 17/05/2014 10:26, lvqcl wrote: > The file > src/share/replaygain_synthesis/include/private/fast_float_math_hack.h > redefines 'tanh' as 'tanhf'. This file is intended for Intel Compiler only, > but it includes outdated mathf.h and doesn't work with current versions > of ICC. > > The fixes are trivial though, and I compiled 2 versions of flac.exe: > with this > 'hack' turned off an on. T...
2009 Feb 15
0
Kalman Filter - dlm package
...the Identity matrix (diag(2)) and I would like to know how to adapt the coding such that F can vary over time and matches my case study described above. data(NelPlo) ### multivariate local level -- seemingly unrelated time series buildSu <- function(x) { Vsd <- exp(x[1:2]) Vcorr <- tanh(x[3]) V <- Vsd %o% Vsd V[1,2] <- V[2,1] <- V[1,2] * Vcorr Wsd <- exp(x[4:5]) Wcorr <- tanh(x[6]) W <- Wsd %o% Wsd W[1,2] <- W[2,1] <- W[1,2] * Wcorr return(list( m0 = rep(0,2), C0 = 1e7 * diag(2), FF = diag(2), GG = diag(2), V = V, W = W)) } suMLE <- dlmMLE...
2009 Aug 27
1
standard error associated with correlation coefficient
I want the standard error associated with a correlation. I can calculate using cor & var, but am wondering if there are libraries that already provide this function. [[alternative HTML version deleted]]