Skip to content

Commit

Permalink
Merge pull request #4 from Clonkk/devel
Browse files Browse the repository at this point in the history
merged devel
  • Loading branch information
Clonkk authored Nov 5, 2020
2 parents 9e945a2 + 8721d9a commit dbecaa6
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 28 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
tests/test1
testresults/
nimcache/
4 changes: 2 additions & 2 deletions fftw3.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.2.6"
version = "0.2.7"
author = "rcaillaud"
description = "Nim FFTW bindings"
license = "LGPL-2.1"
Expand All @@ -10,4 +10,4 @@ srcDir = "src"
# Dependencies

requires "nim >= 1.2.0"
requires "arraymancer >= 0.5.2"
requires "arraymancer >= 0.6.1"
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</head>

<body>
<meta http-equiv = "refresh" content = " time ; url = htmldocs/fftw3.html"/>
<meta http-equiv = "refresh" content = " time ; url = src/htmldocs/fftw3.html"/>
</body>

</html>
8 changes: 4 additions & 4 deletions src/fftw3.nim
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import arraymancer
import sequtils
import complex
import arraymancer/../tensor/private/p_accessors
import arraymancer/tensor/private/p_accessors


when defined(windows):
Expand Down Expand Up @@ -581,11 +581,11 @@ proc fftw_print_plan*(p: fftw_plan) {.cdecl, importc: "fftw_print_plan",
dynlib: LibraryName.}
proc fftw_sprint_plan*(p: fftw_plan): cstring {.cdecl,
importc: "fftw_sprint_plan", dynlib: LibraryName.}
proc fftw_malloc*(n: csize): pointer {.cdecl, importc: "fftw_malloc",
proc fftw_malloc*(n: csize_t): pointer {.cdecl, importc: "fftw_malloc",
dynlib: LibraryName.}
proc fftw_alloc_real*(n: csize): ptr cdouble {.cdecl,
proc fftw_alloc_real*(n: csize_t): ptr cdouble {.cdecl,
importc: "fftw_alloc_real", dynlib: LibraryName.}
proc fftw_alloc_complex*(n: csize): ptr fftw_complex {.cdecl,
proc fftw_alloc_complex*(n: csize_t): ptr fftw_complex {.cdecl,
importc: "fftw_alloc_complex", dynlib: LibraryName.}
proc fftw_free*(p: pointer) {.cdecl, importc: "fftw_free", dynlib: LibraryName.}
proc fftw_flops*(p: fftw_plan; add: ptr cdouble; mul: ptr cdouble;
Expand Down
30 changes: 15 additions & 15 deletions htmldocs/fftw3.html → src/htmldocs/fftw3.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ <h1 class="title">fftw3</h1>

</ul>
<ul class="simple nested-toc-section">fftw_malloc
<li><a class="reference" href="#fftw_malloc%2Ccsize"
title="fftw_malloc(n: csize): pointer">fftw_malloc,csize<span class="attachedType"></span></a></li>
<li><a class="reference" href="#fftw_malloc%2Ccsize_t"
title="fftw_malloc(n: csize_t): pointer">fftw_malloc,csize_t<span class="attachedType"></span></a></li>

</ul>
<ul class="simple nested-toc-section">fftw_plan_guru64_r2r
Expand Down Expand Up @@ -384,8 +384,8 @@ <h1 class="title">fftw3</h1>

</ul>
<ul class="simple nested-toc-section">fftw_alloc_real
<li><a class="reference" href="#fftw_alloc_real%2Ccsize"
title="fftw_alloc_real(n: csize): ptr cdouble">fftw_alloc_real,csize<span class="attachedType"></span></a></li>
<li><a class="reference" href="#fftw_alloc_real%2Ccsize_t"
title="fftw_alloc_real(n: csize_t): ptr cdouble">fftw_alloc_real,csize_t<span class="attachedType"></span></a></li>

</ul>
<ul class="simple nested-toc-section">fftw_export_wisdom_to_file
Expand Down Expand Up @@ -507,8 +507,8 @@ <h1 class="title">fftw3</h1>

</ul>
<ul class="simple nested-toc-section">fftw_alloc_complex
<li><a class="reference" href="#fftw_alloc_complex%2Ccsize"
title="fftw_alloc_complex(n: csize): ptr fftw_complex">fftw_alloc_complex,csize<span class="attachedType">fftw_complex</span></a></li>
<li><a class="reference" href="#fftw_alloc_complex%2Ccsize_t"
title="fftw_alloc_complex(n: csize_t): ptr fftw_complex">fftw_alloc_complex,csize_t<span class="attachedType">fftw_complex</span></a></li>

</ul>
<ul class="simple nested-toc-section">fftw_import_wisdom_from_file
Expand Down Expand Up @@ -1627,24 +1627,24 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>


</dd>
<a id="fftw_malloc,csize"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_malloc%2Ccsize"><span class="Identifier">fftw_malloc</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;fftw_malloc&quot;</span><span class="Other">,</span>
<span class="Identifier">dynlib</span><span class="Other">:</span> <span class="Identifier">LibraryName</span></span><span class="Other">.}</span></span></pre></dt>
<a id="fftw_malloc,csize_t"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_malloc%2Ccsize_t"><span class="Identifier">fftw_malloc</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize_t</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">pointer</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;fftw_malloc&quot;</span><span class="Other">,</span>
<span class="Identifier">dynlib</span><span class="Other">:</span> <span class="Identifier">LibraryName</span></span><span class="Other">.}</span></span></pre></dt>
<dd>



</dd>
<a id="fftw_alloc_real,csize"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_alloc_real%2Ccsize"><span class="Identifier">fftw_alloc_real</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">cdouble</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span> <span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;fftw_alloc_real&quot;</span><span class="Other">,</span>
<span class="Identifier">dynlib</span><span class="Other">:</span> <span class="Identifier">LibraryName</span></span><span class="Other">.}</span></span></pre></dt>
<a id="fftw_alloc_real,csize_t"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_alloc_real%2Ccsize_t"><span class="Identifier">fftw_alloc_real</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize_t</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">cdouble</span> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span>
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;fftw_alloc_real&quot;</span><span class="Other">,</span> <span class="Identifier">dynlib</span><span class="Other">:</span> <span class="Identifier">LibraryName</span></span><span class="Other">.}</span></span></pre></dt>
<dd>



</dd>
<a id="fftw_alloc_complex,csize"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_alloc_complex%2Ccsize"><span class="Identifier">fftw_alloc_complex</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="fftw3.html#fftw_complex"><span class="Identifier">fftw_complex</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span>
<a id="fftw_alloc_complex,csize_t"></a>
<dt><pre><span class="Keyword">proc</span> <a href="#fftw_alloc_complex%2Ccsize_t"><span class="Identifier">fftw_alloc_complex</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">csize_t</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="fftw3.html#fftw_complex"><span class="Identifier">fftw_complex</span></a> <span><span class="Other">{</span><span class="Other pragmadots">...</span><span class="Other">}</span></span><span class="pragmawrap"><span class="Other">{.</span><span class="pragma"><span class="Identifier">cdecl</span><span class="Other">,</span>
<span class="Identifier">importc</span><span class="Other">:</span> <span class="StringLit">&quot;fftw_alloc_complex&quot;</span><span class="Other">,</span> <span class="Identifier">dynlib</span><span class="Other">:</span> <span class="Identifier">LibraryName</span></span><span class="Other">.}</span></span></pre></dt>
<dd>

Expand Down Expand Up @@ -1701,7 +1701,7 @@ <h1><a class="toc-backref" href="#12">Procs</a></h1>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br/>
<small style="color: var(--hint);">Made with Nim. Generated: 2020-10-26 17:16:21 UTC</small>
<small style="color: var(--hint);">Made with Nim. Generated: 2020-11-05 15:59:44 UTC</small>
</div>
</div>
</div>
Expand Down
File renamed without changes.
8 changes: 2 additions & 6 deletions tests/test1.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import unittest
import sugar

import fftw3
Expand All @@ -10,7 +9,7 @@ import random
import times
import system

proc main()=
block: # fftw_plan_dft, fftw_execute_dft
let dims = @[4, 3, 2*7-1]

var randData: Tensor[float64] = randomTensor(dims, 10).astype(float64)
Expand All @@ -35,10 +34,7 @@ proc main()=
let size = complex(orig.size.float64)
orig = orig /. size

test "fftw_plan_dft ifft(fft(x)) compared to original data":
check compare(randData, orig.map(x => x.re))
doAssert compare(randData, orig.map(x => x.re))

fftw_destroy_plan(fft)
fftw_destroy_plan(ifft)

main()

0 comments on commit dbecaa6

Please sign in to comment.