UNPKG

@nexys/math-ts

Version:

[![npm version](https://badge.fury.io/js/%40nexys%2Fmath-ts.svg)](https://www.npmjs.com/package/@nexys/math-ts) [![TavisCI](https://travis-ci.com/Nexysweb/tableau-wdc-react.svg?branch=master)](https://travis-ci.com/github/Nexysweb/math-ts) [![Deployment](

17 lines (16 loc) 456 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const complex_1 = require("./complex"); exports.fft = (v) => { const N = v.length; if (N === 0) { return []; } return v.map((_, k) => { return v.map((x, i) => { return x .multiply(complex_1.exp(2 * Math.PI * k * i / N) .multiply(1 / Math.sqrt(N))); }).reduce((c1, c2) => c1.sum(c2)); }); };