33 lines
690 B
JavaScript
33 lines
690 B
JavaScript
|
import sinh from './sinh';
|
||
|
import cosh from './cosh';
|
||
|
|
||
|
export default function(pp, arg_r, arg_i) {
|
||
|
var sin_arg_r = Math.sin(arg_r);
|
||
|
var cos_arg_r = Math.cos(arg_r);
|
||
|
var sinh_arg_i = sinh(arg_i);
|
||
|
var cosh_arg_i = cosh(arg_i);
|
||
|
var r = 2 * cos_arg_r * cosh_arg_i;
|
||
|
var i = -2 * sin_arg_r * sinh_arg_i;
|
||
|
var j = pp.length - 1;
|
||
|
var hr = pp[j];
|
||
|
var hi1 = 0;
|
||
|
var hr1 = 0;
|
||
|
var hi = 0;
|
||
|
var hr2;
|
||
|
var hi2;
|
||
|
|
||
|
while (--j >= 0) {
|
||
|
hr2 = hr1;
|
||
|
hi2 = hi1;
|
||
|
hr1 = hr;
|
||
|
hi1 = hi;
|
||
|
hr = -hr2 + r * hr1 - i * hi1 + pp[j];
|
||
|
hi = -hi2 + i * hr1 + r * hi1;
|
||
|
}
|
||
|
|
||
|
r = sin_arg_r * cosh_arg_i;
|
||
|
i = cos_arg_r * sinh_arg_i;
|
||
|
|
||
|
return [r * hr - i * hi, r * hi + i * hr];
|
||
|
}
|