Add function atanh to .control section
This commit is contained in:
parent
3996d27b29
commit
71571a1432
|
|
@ -343,6 +343,7 @@ struct func ft_funcs[] = {
|
||||||
{ "cosh", cx_cosh },
|
{ "cosh", cx_cosh },
|
||||||
{ "tanh", cx_tanh },
|
{ "tanh", cx_tanh },
|
||||||
{ "atan", cx_atan },
|
{ "atan", cx_atan },
|
||||||
|
{ "atanh", cx_atanh },
|
||||||
{ "sortorder", cx_sortorder },
|
{ "sortorder", cx_sortorder },
|
||||||
{ "norm", cx_norm },
|
{ "norm", cx_norm },
|
||||||
{ "rnd", cx_rnd },
|
{ "rnd", cx_rnd },
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ extern void *cx_cosh(void *, short int , int , int *, short int *);
|
||||||
extern void *cx_tan(void *, short int , int , int *, short int *);
|
extern void *cx_tan(void *, short int , int , int *, short int *);
|
||||||
extern void *cx_tanh(void *, short int , int , int *, short int *);
|
extern void *cx_tanh(void *, short int , int , int *, short int *);
|
||||||
extern void *cx_atan(void *, short int , int , int *, short int *);
|
extern void *cx_atan(void *, short int , int , int *, short int *);
|
||||||
|
extern void *cx_atanh(void*, short int, int, int*, short int*);
|
||||||
extern void *cx_floor(void *, short int , int , int *, short int *);
|
extern void *cx_floor(void *, short int , int , int *, short int *);
|
||||||
extern void *cx_ceil(void *, short int , int , int *, short int *);
|
extern void *cx_ceil(void *, short int , int , int *, short int *);
|
||||||
extern void *cx_nint(void *, short int , int , int *, short int *);
|
extern void *cx_nint(void *, short int , int , int *, short int *);
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
|
||||||
|
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <complex.h>
|
||||||
|
|
||||||
#include "ngspice/ngspice.h"
|
#include "ngspice/ngspice.h"
|
||||||
#include "ngspice/memory.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. */
|
/** atan of a complex vector: return atan of the real part. */
|
||||||
void *
|
void *
|
||||||
cx_atan(void *data, short int type, int length, int *newlength, short int *newtype)
|
cx_atan(void *data, short int type, int length, int *newlength, short int *newtype)
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ void * cx_cosh(void *data, short int type, int length, int *newlength, short int
|
||||||
void * cx_tan(void *data, short int type, int length, int *newlength, short int *newtype);
|
void * cx_tan(void *data, short int type, int length, int *newlength, short int *newtype);
|
||||||
void * cx_tanh(void *data, short int type, int length, int *newlength, short int *newtype);
|
void * cx_tanh(void *data, short int type, int length, int *newlength, short int *newtype);
|
||||||
void * cx_atan(void *data, short int type, int length, int *newlength, short int *newtype);
|
void * cx_atan(void *data, short int type, int length, int *newlength, short int *newtype);
|
||||||
|
void * cx_atanh(void *data, short int type, int length, int *newlength, short int *newtype);
|
||||||
void * cx_sortorder(void *data, short int type, int length, int *newlength, short int *newtype);
|
void * cx_sortorder(void *data, short int type, int length, int *newlength, short int *newtype);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue