forked from ruslo/hunter
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38a255d
commit 0759ff2
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright (c) 2016-2017, Ruslan Baratov | ||
# Copyright (c) 2017, David Hirvonen | ||
# All rights reserved. | ||
|
||
# !!! DO NOT PLACE HEADER GUARDS HERE !!! | ||
|
||
include(hunter_add_version) | ||
include(hunter_cacheable) | ||
include(hunter_cmake_args) | ||
include(hunter_download) | ||
include(hunter_pick_scheme) | ||
|
||
hunter_add_version( | ||
PACKAGE_NAME | ||
fft2d | ||
VERSION | ||
1.0.0-p0 | ||
URL | ||
"https://github.com/hunter-packages/fft2d/archive/v1.0.0-p0.tar.gz" | ||
SHA1 | ||
080f5415229653fe032e981e4ce65a05a6967bbe | ||
) | ||
|
||
hunter_pick_scheme(DEFAULT url_sha1_cmake) | ||
hunter_cacheable(fft2d) | ||
hunter_download(PACKAGE_NAME fft2d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2016-2017, Ruslan Baratov | ||
# Copyright (c) 2017, David Hirvonen | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-fft2d) | ||
|
||
hunter_add_package(fft2d) | ||
find_package(fft2d CONFIG REQUIRED) | ||
|
||
add_executable(foo foo.cpp) | ||
target_link_libraries(foo fft2d::fft2d) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Source : fft2d/sample1/testxg.c (open license) | ||
// | ||
// Reproduce samples for valid link test, since no headers are exported. | ||
// | ||
// This is used as a build test only. | ||
|
||
#include <math.h> | ||
#include <stdio.h> | ||
#define MAX(x,y) ((x) > (y) ? (x) : (y)) | ||
|
||
/* random number generator, 0 <= RND < 1 */ | ||
#define RND(p) ((*(p) = (*(p) * 7141 + 54773) % 259200) * (1.0 / 259200.0)) | ||
|
||
#ifndef NMAX | ||
#define NMAX 8192 | ||
#define NMAXSQRT 64 | ||
#endif | ||
|
||
extern "C" { | ||
void cdft(int, int, double *, int *, double *); | ||
void putdata(int nini, int nend, double *a) | ||
{ | ||
int j, seed = 0; | ||
|
||
for (j = nini; j <= nend; j++) { | ||
a[j] = RND(&seed); | ||
} | ||
} | ||
double errorcheck(int nini, int nend, double scale, double *a) | ||
{ | ||
int j, seed = 0; | ||
double err = 0, e; | ||
|
||
for (j = nini; j <= nend; j++) { | ||
e = RND(&seed) - a[j] * scale; | ||
err = MAX(err, fabs(e)); | ||
} | ||
return err; | ||
} | ||
|
||
} // extern "C" | ||
|
||
int main() | ||
{ | ||
int n = 64, ip[NMAXSQRT + 2]; | ||
double a[NMAX + 1], w[NMAX * 5 / 4], t[NMAX / 2 + 1], err; | ||
|
||
printf("data length n=? (must be 2^m)\n"); | ||
//scanf("%d", &n); | ||
ip[0] = 0; | ||
|
||
/* check of CDFT */ | ||
|
||
putdata(0, n - 1, a); | ||
cdft(n, 1, a, ip, w); | ||
cdft(n, -1, a, ip, w); | ||
return errorcheck(0, n - 1, 2.0 / n, a); | ||
} | ||
|