MCPcopy Create free account
hub / github.com/pydata/numexpr / nc_tanh

Function nc_tanh

numexpr3/complex_functions.hpp:1556–1593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1554}
1555
1556static void
1557nc_tanh(npy_intp n, npy_complex64 *x, npy_intp sb1, npy_complex64 *r)
1558{
1559 npy_float32 si,ci,shr,chr;
1560 npy_float32 rs,is,rc,ic;
1561 npy_float32 d;
1562 if( sb1 == sizeof(npy_complex64) ) { // Aligned
1563 for( npy_intp I = 0; I < n; I++ ) {
1564 si = sinf(x[I].imag);
1565 ci = cosf(x[I].imag);
1566 shr = sinhf(x[I].real);
1567 chr = coshf(x[I].real);
1568 rs = ci*shr;
1569 is = si*chr;
1570 rc = ci*chr;
1571 ic = si*shr;
1572 d = rc*rc + ic*ic;
1573 r[I].real = (rs*rc+is*ic)/d;
1574 r[I].imag = (is*rc-rs*ic)/d;
1575 }
1576 }
1577 else {
1578 sb1 /= sizeof(npy_complex64);
1579 for( npy_intp I = 0; I < n; I++ ) {
1580 si = sinf(x[I*sb1].imag);
1581 ci = cosf(x[I*sb1].imag);
1582 shr = sinhf(x[I*sb1].real);
1583 chr = coshf(x[I*sb1].real);
1584 rs = ci*shr;
1585 is = si*chr;
1586 rc = ci*chr;
1587 ic = si*shr;
1588 d = rc*rc + ic*ic;
1589 r[I].real = (rs*rc+is*ic)/d;
1590 r[I].imag = (is*rc-rs*ic)/d;
1591 }
1592 }
1593}
1594
1595static void
1596nc_tanh(npy_intp n, npy_complex128 *x, npy_intp sb1, npy_complex128 *r)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…