|
|
|
@ -21,6 +21,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group |
|
|
|
|
|
|
|
|
|
|
|
#include <errno.h> |
|
|
|
#include <complex.h> |
|
|
|
|
|
|
|
#include "ngspice/ngspice.h" |
|
|
|
#include "ngspice/memory.h" |
|
|
|
@ -862,6 +863,37 @@ cx_tanh(void *data, short int type, int length, int *newlength, short int *newty |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** atanh of a complex vector: use C99 function catanh. */ |
|
|
|
void* |
|
|
|
cx_atanh(void* data, short int type, int length, int* newlength, short int* newtype) |
|
|
|
{ |
|
|
|
if (type == VF_COMPLEX) { |
|
|
|
ngcomplex_t* d = alloc_c(length); |
|
|
|
*newtype = VF_COMPLEX; |
|
|
|
*newlength = length; |
|
|
|
ngcomplex_t* cc = (ngcomplex_t*)data; |
|
|
|
int i; |
|
|
|
for (i = 0; i < length; i++) { |
|
|
|
_Dcomplex midin = _Cbuild(cc->cx_real, cc->cx_imag); |
|
|
|
_Dcomplex midout = catanh(midin); |
|
|
|
d[i].cx_real = creal(midout); |
|
|
|
d[i].cx_imag = cimag(midout); |
|
|
|
} |
|
|
|
return ((void*)d); |
|
|
|
} |
|
|
|
else { |
|
|
|
double* d = alloc_d(length); |
|
|
|
*newtype = VF_REAL; |
|
|
|
*newlength = length; |
|
|
|
double* cc = (double*)data; |
|
|
|
int i; |
|
|
|
for (i = 0; i < length; i++) { |
|
|
|
d[i] = atanh(cc[i]); |
|
|
|
} |
|
|
|
return ((void*)d); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** atan of a complex vector: return atan of the real part. */ |
|
|
|
void * |
|
|
|
cx_atan(void *data, short int type, int length, int *newlength, short int *newtype) |
|
|
|
|