Skip to content

Commit 0dacfc6

Browse files
fix doc
1 parent ad793bd commit 0dacfc6

File tree

2 files changed

+44
-48
lines changed

2 files changed

+44
-48
lines changed

README.md

Lines changed: 1 addition & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -17,51 +17,4 @@ fft( 3 , 4 , u , 0 , 8 , v , 0 , 8 ) ;
1717
[![Code Climate](http://img.shields.io/codeclimate/github/aureooms/js-fft.svg?style=flat)](https://codeclimate.com/github/aureooms/js-fft)
1818
[![NPM downloads per month](http://img.shields.io/npm/dm/aureooms-js-fft.svg?style=flat)](https://www.npmjs.org/package/aureooms-js-fft)
1919
[![GitHub issues](http://img.shields.io/github/issues/aureooms/js-fft.svg?style=flat)](https://github.com/aureooms/js-fft/issues)
20-
21-
22-
## Use
23-
24-
```js
25-
/**
26-
* Initialization with complex numbers in double precision.
27-
*/
28-
29-
const number = require( "aureooms-js-number" ) ;
30-
const complex = require( "aureooms-js-complex" ) ;
31-
32-
const kernel = complex.cartesian.kernel.compile( number , "i" ) ;
33-
const cartesian = complex.cartesian.array.compile( kernel ) ;
34-
35-
const $ = fft.compile( cartesian ) ;
36-
37-
// ...
38-
39-
/**
40-
* Fast multiplication of two polynomials u and v in C[x]
41-
* ( little endian , double precision )
42-
*/
43-
44-
const array = require( "aureooms-js-array" ) ;
45-
46-
const l = Math.ceil( Math.log2( Math.max( u.length , v.length ) ) ) ;
47-
const m = Math.pow( 2 , l ) | 0 ;
48-
const n = m << 1 ;
49-
50-
const _u = array.alloc( n ) ;
51-
array.copy( u , 0 , u.length , _u , 0 ) ;
52-
array.fillfn( _u , u.length , n , cartesian.$0 ) ;
53-
54-
const _v = array.alloc( n ) ;
55-
array.copy( v , 0 , v.length , _v , 0 ) ;
56-
array.fillfn( _v , v.length , n , cartesian.$0 ) ;
57-
58-
const $u = array.alloc( n ) ;
59-
const $v = array.alloc( n ) ;
60-
61-
$.fft( l , m , _u , 0 , n , $u , 0 , n ) ; // O(n log n)
62-
$.fft( l , m , _v , 0 , n , $v , 0 , n ) ; // O(n log n)
63-
64-
for ( let i = 0 ; i < n ; ++i ) $u[i] = cartesian.imul( $u[i] , $v[i] ) ; // O(n)
65-
66-
$.ifft( l , m , $u , 0 , n , _u , 0 , n ) ; // O(n log n)
67-
```
20+
[![Documentation](https://aureooms.github.io/js-fft/badge.svg)](https://aureooms.github.io/js-fft/source.html)

doc/manual/example.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,44 @@
1+
```js
2+
/**
3+
* Initialization with complex numbers in double precision.
4+
*/
15

6+
const number = require( "aureooms-js-number" ) ;
7+
const complex = require( "aureooms-js-complex" ) ;
8+
9+
const kernel = complex.cartesian.kernel.compile( number , "i" ) ;
10+
const cartesian = complex.cartesian.array.compile( kernel ) ;
11+
12+
const $ = fft.compile( cartesian ) ;
13+
14+
// ...
15+
16+
/**
17+
* Fast multiplication of two polynomials u and v in C[x]
18+
* ( little endian , double precision )
19+
*/
20+
21+
const array = require( "aureooms-js-array" ) ;
22+
23+
const l = Math.ceil( Math.log2( Math.max( u.length , v.length ) ) ) ;
24+
const m = Math.pow( 2 , l ) | 0 ;
25+
const n = m << 1 ;
26+
27+
const _u = array.alloc( n ) ;
28+
array.copy( u , 0 , u.length , _u , 0 ) ;
29+
array.fillfn( _u , u.length , n , cartesian.$0 ) ;
30+
31+
const _v = array.alloc( n ) ;
32+
array.copy( v , 0 , v.length , _v , 0 ) ;
33+
array.fillfn( _v , v.length , n , cartesian.$0 ) ;
34+
35+
const $u = array.alloc( n ) ;
36+
const $v = array.alloc( n ) ;
37+
38+
$.fft( l , m , _u , 0 , n , $u , 0 , n ) ; // O(n log n)
39+
$.fft( l , m , _v , 0 , n , $v , 0 , n ) ; // O(n log n)
40+
41+
for ( let i = 0 ; i < n ; ++i ) $u[i] = cartesian.imul( $u[i] , $v[i] ) ; // O(n)
42+
43+
$.ifft( l , m , $u , 0 , n , _u , 0 , n ) ; // O(n log n)
44+
```

0 commit comments

Comments
 (0)