-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding fast multipole method for Legendre-Chebyshev transforms (#83)
* Adding FMM * Update fmm.c * Adding new tests * Trigger * Adding stdint.h * Fixing mac CI
- Loading branch information
Showing
9 changed files
with
2,120 additions
and
21 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
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,67 @@ | ||
#include "fasttransforms.h" | ||
#include "ftinternal.h" | ||
#include "fmm.h" | ||
|
||
size_t get_number_of_blocks(const size_t level) { return pow(2, level + 1) - 1; } | ||
|
||
size_t get_h(const size_t level, const size_t L) { return pow(2, L - level - 1); } | ||
|
||
size_t get_number_of_submatrices(const size_t level) { return 3 * get_number_of_blocks(level); } | ||
|
||
size_t get_total_number_of_blocks(const size_t L) { return pow(2, L + 1) - (L + 2); } | ||
|
||
size_t get_total_number_of_submatrices(const size_t L) { return 3 * get_total_number_of_blocks(L); } | ||
|
||
void get_ij(size_t *ij, const size_t level, const size_t block, const size_t s, const size_t L) | ||
{ | ||
size_t h = get_h(level, L); | ||
ij[0] = 2 * block * s * h; | ||
ij[1] = ij[0] + 2 * s * h; | ||
} | ||
|
||
/*#if defined(FT_QUADMATH) | ||
#define FLT quadruple | ||
#define X(name) FT_CONCAT(ft_, name, q) | ||
#define Y(name) FT_CONCAT(, name, q) | ||
#include "fmm_source.c" | ||
#undef FLT | ||
#undef X | ||
#undef Y | ||
#define FLT long double | ||
#define X(name) FT_CONCAT(ft_, name, l) | ||
#define X2(name) FT_CONCAT(ft_, name, q) | ||
#define Y(name) FT_CONCAT(, name, l) | ||
#include "fmm_source.c" | ||
#undef FLT | ||
#undef X | ||
#undef X2 | ||
#undef Y | ||
#else | ||
#define FLT long double | ||
#define X(name) FT_CONCAT(ft_, name, l) | ||
#define X2(name) FT_CONCAT(ft_, name, l) | ||
#define Y(name) FT_CONCAT(, name, l) | ||
#include "fmm_source.c" | ||
#undef FLT | ||
#undef X | ||
#undef X2 | ||
#undef Y | ||
#endif*/ | ||
|
||
|
||
#define FLT double | ||
#define X(name) FT_CONCAT(ft_, name, ) | ||
#define FT_USE_DOUBLE | ||
#include "fmm_source.c" | ||
#undef FLT | ||
#undef X | ||
#undef FT_USE_DOUBLE | ||
|
||
#define FLT float | ||
#define X(name) FT_CONCAT(ft_, name, f) | ||
#define FT_USE_SINGLE | ||
#include "fmm_source.c" | ||
#undef FLT | ||
#undef X | ||
#undef FT_USE_SINGLE |
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,22 @@ | ||
#ifndef FMM_H | ||
#define FMM_H | ||
|
||
#include <assert.h> | ||
#include <stdbool.h> | ||
#include <string.h> | ||
#include <stdint.h> | ||
#include <time.h> | ||
|
||
enum { L2C = 0, C2L = 1, BOTH = 2 }; | ||
|
||
#ifdef CLOCK_UPTIME_RAW | ||
#define tic clock_gettime_nsec_np(CLOCK_UPTIME_RAW) | ||
#define dtics(a, b) (double)(b - a) / 1.0E9 | ||
#define toc(a) (double)(tic - a) / 1.0E9 | ||
#else | ||
#define tic clock() | ||
#define dtics(a, b) (double)(b - a) / (double)CLOCKS_PER_SEC | ||
#define toc(a) (double)(tic - a) / (double)CLOCKS_PER_SEC | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.