Compiled cores

The C++ kernels the solvers build on install (python -m kicad2ems.mom25d.core.build, python -m kicad2ems.gfdtd.core.build), from their sources through Doxygen. Without a built core each falls back to NumPy.

mom25d

The method of moments’ kernels: the singular and near-singular integrals and the matrix fill (OpenMP).

Typedefs

using cd = std::complex<double>
using cf = std::complex<float>
using i64 = std::int64_t
template<class T>
using arr = py::array_t<T, py::array::c_style | py::array::forcecast>

Functions

static inline double bessel_j0(double x)
static inline double dist(const double *c, int p, int q)
template<class T>
void fill_far_t(py::array_t<T> Z, py::dict geom, py::dict tabs, double w)
void fill_far_half(py::array_t<cd> Zh, arr<i64> rowptr, arr<i64> c0, py::dict geom, py::dict tabs, double w)
py::array_t<cd> far_block(arr<int> rows, arr<int> cols, py::dict geom, py::dict tabs, double w)
py::array_t<cd> fold_far(arr<int> cols, py::dict geom, py::dict tabs, double w)
py::array_t<cd> matvec_far(arr<cd> x, py::dict geom, py::dict tabs, double w)
py::array_t<cd> matvec_far_multi(arr<cd> x, py::dict geom, py::dict tabs, double w)
static inline bool rule_over_p(double ap, double aq, int p, int q)
static inline double tri_area(const double *nd, const int *tr, int t)
static inline void offplane_one(const double *V, const double *P6, const double *W6, double d, double &m0, double mro[2], double mrs[2], double &mrr)
py::tuple offplane_pairs(arr<double> nodes, arr<int> tris, arr<double> P6, arr<double> W6, arr<int> P, arr<int> Q, double d)
static inline void atomic_add(cd *z, cd v)
static inline void atomic_add(cf *z, cd v)
void near_core(const Mesh &g, const Tables &tb, const double *nodes, const int *tris, const double *P3, const double *W3, const double *P6, const double *W6, const int *P, const int *Q, int n, double w, NearOut &o)
static void near_stat(py::dict quad, int n, NearOut &o)
py::array_t<cd> near_into_dense(py::array Z, py::dict geom, py::dict tabs, py::dict quad, arr<int> P, arr<int> Q, double w)
py::array_t<cd> near_into_half(py::array_t<cd> Zh, arr<i64> rowptr, arr<i64> c0, py::dict geom, py::dict tabs, py::dict quad, arr<int> P, arr<int> Q, double w)
py::array_t<cd> near_matvec(arr<cd> x, py::dict geom, py::dict tabs, py::dict quad, arr<int> P, arr<int> Q, double w)
py::tuple near_coo(py::dict geom, py::dict tabs, py::dict quad, arr<int> P, arr<int> Q, double w)
py::array_t<cd> near_q(py::dict geom, py::dict tabs, py::dict quad, arr<int> P, arr<int> Q, double w)
static TreeView tree_view(arr<int> &node, arr<int> &parent, arr<int> &branch, arr<double> &sig, arr<int> &roots, arr<int> &cot, arr<int> &cu, arr<int> &cv, int n_nodes)
void tree_cols(py::array_t<cd> X, arr<int> node, arr<int> parent, arr<int> branch, arr<double> sig, arr<int> roots, arr<int> cot, arr<int> cu, arr<int> cv, int n_nodes)
void tree_rows(py::array_t<cd> X, arr<int> node, arr<int> parent, arr<int> branch, arr<double> sig, arr<int> roots, arr<int> cot, arr<int> cu, arr<int> cv, int n_nodes)
void lt_half_step(py::array_t<cd> data, arr<i64> rp, arr<i64> c0, arr<uint8_t> is_tree, int step, arr<int> node, arr<int> parent, arr<int> branch, arr<double> sig, arr<int> roots, arr<int> cot, arr<int> cu, arr<int> cv, int n_nodes)
template<class Off, class First>
static void charge_rows(cd *z, Off off, First first, const cd *M, i64 nf, int f0, const int *tr, const int *pu, const int *pv, int nt, const double *ar, int g)
void charge_into(py::array_t<cd> Z, arr<cd> Mq, arr<int> tree, arr<int> u, arr<int> v, arr<double> area, int g, int f0)
void charge_into_half(py::array_t<cd> data, arr<i64> rp, arr<i64> c0, arr<cd> Mq, arr<int> tree, arr<int> u, arr<int> v, arr<double> area, int g, int f0)
int num_threads()
py::tuple near_pairs(arr<double> cent, arr<double> size, arr<double> z, double fac)
py::array_t<cd> radial_table_sum(arr<double> px, arr<double> py_, arr<double> W, arr<double> vx, arr<double> vy, arr<cd> table, double dr)
static inline void cross3(const double *a, const double *b, double *c)
static inline double dot3(const double *a, const double *b)
py::object pair_moments3d(arr<double> Vo, arr<double> Vs, arr<double> bar, arr<double> wq, bool scalar_only)
py::tuple sides_blocks(arr<double> Po, arr<double> Wo, arr<int> olay, arr<double> sp, arr<int> slay, arr<int> lt, py::list tabs, arr<double> drs, arr<i64> sptr, arr<int> sfn, arr<double> sfx, arr<double> sfy, arr<double> sdq, arr<i64> nptr, arr<int> nfn, arr<double> d1, arr<double> dx, arr<double> dy, arr<double> dz, arr<cd> dq, arr<i64> hptr, arr<int> htgt, arr<double> hal, arr<double> hv, arr<int> fpos, i64 Nrow, i64 N, i64 nF, double w, i64 chunk, i64 skip_o, i64 skip_p, double far)
static void sub_rule(int level, std::vector<double> &bar, std::vector<double> &w)
py::array_t<cd> slot_coupling(arr<double> Vt, arr<double> At, arr<double> St, arr<double> Vu, arr<double> Au, arr<double> Su, double dz, arr<cd> tabP, arr<cd> tabU, double dr, double near, int sub_max)
py::array_t<cd> hankel_real(arr<double> rho, arr<double> kr, arr<cd> W)
static inline double bessel_j1(double x)
static inline double bessel_jn(int n, double x)
py::array_t<cd> bessel_real_sum(int n, arr<double> rho, arr<double> kr, arr<cd> W)
static cd bessel_jn_complex1(int n, cd z)
py::array_t<cd> bessel_jn_complex(int n, py::array_t<cd, py::array::c_style | py::array::forcecast> z)
void loop_transform(py::array_t<cd, py::array::c_style> Z, arr<i64> V, arr<i64> idx, arr<double> cw)
void blend(py::array_t<cd> out, py::object F0, py::list D, arr<double> c, cd s)
py::array_t<cf> scale_c64(py::array_t<cd, py::array::c_style> Z, arr<double> d, bool inplace)
template<class T>
void pack_half_t(py::array_t<T, py::array::c_style> Z, arr<double> d, py::array_t<cf> out, int nb)
void half_c64(arr<cd> H, arr<double> d, py::array_t<cf> out, int nb)
void half_c64_rows(arr<cd> H, arr<double> d, py::array_t<cf> out, int nb, i64 r0, i64 r1)
void half_scale(py::array_t<cd> data, arr<i64> rp, arr<i64> c0, arr<cd> d)
template<class T>
void compact_half_t(py::array_t<T, py::array::c_style> Z, int nb)
void ldl_diag(py::array_t<cf> A, py::array_t<cf> pack, py::array_t<cf> linvt, py::array_t<cf> dinv, py::array_t<cf> linv)
py::array_t<cd> fan_q(py::dict geom, py::dict tabs, arr<int> F)
template<class C>
py::array_t<C> project_t(py::array_t<C, py::array::c_style> Z, arr<int> keep, arr<int> elim, arr<int> cp, arr<int> ci, arr<double> cv, arr<int> tp, arr<int> ti, arr<double> tv, int Nr)
PYBIND11_MODULE(_core, m)

Variables

static const int NEAR_STAT = 12
struct Tables

Public Functions

inline void rest(int t, double r, cd &ga, cd &gq) const
inline void kern(int la, int lb, double r, cd &ga, cd &gq) const

Public Members

int ntab = 0
int nfine = 0
int L = 0
const cd *A = nullptr
const cd *Q = nullptr
const cd *cA = nullptr
const cd *cq = nullptr
const cd *cAi = nullptr
const cd *cqi = nullptr
const double *dr = nullptr
const double *d = nullptr
const double *dimg = nullptr
const int *tab = nullptr
const int *kind = nullptr
struct TabHold

Public Functions

inline TabHold(py::dict tb)

Public Members

arr<cd> A
arr<cd> Q
arr<cd> cA
arr<cd> cq
arr<cd> cAi
arr<cd> cqi
arr<double> dr
arr<double> d
arr<double> dimg
arr<int> tab
arr<int> kind
Tables t
struct Mesh

Public Members

int Ne = 0
int Nt = 0
const int *ep
const int *em
const int *lt
const int *te
const double *ap
const double *am
const double *vp
const double *vm
const double *cent
const double *area
const double *ta
const double *tv
struct MeshHold

Public Functions

inline MeshHold(py::dict g)

Public Members

arr<int> ep
arr<int> em
arr<int> lt
arr<int> te
arr<double> ap
arr<double> am
arr<double> vp
arr<double> vm
arr<double> cent
arr<double> area
arr<double> ta
arr<double> tv
Mesh m
struct NearOut

Public Members

int mode
void *Z
size_t ld
bool single
const cd *x
cd *y
int *ri
int *ci
cd *vv
cd *qcorr
const i64 *rowptr = nullptr
const i64 *c0 = nullptr
double *stat
bool stat_ready
struct TreeView

Public Members

const int *node
const int *parent
const int *branch
const int *roots
const int *cot
const int *cu
const int *cv
const double *sig
int nn
int nr
int nc
int n_nodes
template<class Sc>
class BLRFactorT

Public Functions

inline BLRFactorT(arr<int> order, arr<int> start, arr<uint8_t> far, py::dict geom, py::dict tabs, double w, arr<i64> nptr, arr<int> nidx, arr<cd> nval, arr<cd> B, arr<cd> C, arr<double> dsc, double atol, int max_rank, bool factor_it, double max_bytes, bool symmetric)
inline py::array_t<cd> matvec(py::array_t<cd, py::array::c_style | py::array::forcecast> R)
inline py::array_t<cd> solve(py::array_t<cd, py::array::c_style | py::array::forcecast> R)
inline py::dict stats() const

Private Functions

inline size_t bytes() const
inline void subtract(int k, int j0, int j1, std::vector<std::vector<Sc>> &y, int nr) const
inline void schur(blrk::Tile<Sc> &c, const blrk::Tile<Sc> &a, const blrk::Tile<Sc> &b, int max_rank)
inline void factor(int max_rank)

Private Members

int N_ = 0
int nb_ = 0
double atol_ = 0
double t_assemble_ = 0
double t_factor_ = 0
bool factored_ = true
std::atomic<bool> over_ = {false}
bool sym_ = false
std::atomic<size_t> held_ = {0}
std::atomic<size_t> done_ = {0}
std::vector<int> order_
std::vector<int> start_
std::vector<blrk::Tile<Sc>> T_
std::vector<std::vector<Sc>> LU_
std::vector<std::vector<int>> piv_
int dense0_ = 0
int lowrank0_ = 0
int singular_ = 0
long rank0_ = 0
size_t bytes0_ = 0
namespace blrk

Functions

static double wall()
static void *capsule(const char *mod, const std::string &name)
template<class T>
static const Lapack<T> &lapack()
template<class Sc>
static void gemm(char ta, char tb, int m, int n, int k, Sc alpha, const Sc *A, int lda, const Sc *B, int ldb, Sc beta, Sc *C, int ldc)
template<class Sc>
static void trsm(char side, char uplo, char trans, char diag, int m, int n, const Sc *A, int lda, Sc *B, int ldb)
template<class Sc>
static void swaps(Sc *A, int ld, int ncols, const int *ipiv, int m)
template<class Sc>
static void recompress(Tile<Sc> &t, int m, int n, std::vector<Sc> &U, std::vector<Sc> &V, int r, double atol, int rmax)
template<class Sc>
static bool aca_full(std::vector<cd> &R, int m, int n, double atol, int rmax, std::vector<Sc> &U, std::vector<Sc> &V, int &k)
template<class T>
struct Lapack

Public Types

typedef T::value_type R
typedef void (*gemm_t)(char*, char*, int*, int*, int*, T*, T*, int*, T*, int*, T*, T*, int*)
typedef void (*trsm_t)(char*, char*, char*, char*, int*, int*, T*, T*, int*, T*, int*)
typedef void (*getrf_t)(int*, int*, T*, int*, int*, int*)
typedef void (*geqrf_t)(int*, int*, T*, int*, T*, T*, int*, int*)
typedef void (*ungqr_t)(int*, int*, int*, T*, int*, T*, T*, int*, int*)
typedef void (*gesvd_t)(char*, char*, int*, int*, T*, int*, R*, T*, int*, T*, int*, T*, int*, R*, int*)

Public Members

gemm_t gemm
trsm_t trsm
getrf_t getrf
geqrf_t geqrf
ungqr_t ungqr
gesvd_t gesvd
template<class Sc>
struct Tile

Public Functions

inline size_t bytes() const
inline void dense()

Public Members

char kind = 'N'
int m = 0
int n = 0
int r = 0
std::vector<Sc> D
std::vector<Sc> U
std::vector<Sc> V

gfdtd

The FDTD update, shared by the GPU kernels (Vulkan) and the CPU core.

Defines

GF_TEMPLATE
GF_T(C)
GF_SIMD
GF_ADD(p, v)
GF_G(G, D, kind, ax, idx)
GF_PML_DECODE

Typedefs

typedef long long idx_t

Functions

inline void gf_h_node(int i, int j, int k, idx_t t, const float *V, float *I, const float *G, Dims D, float kh)
template<typename C>
inline void gf_e_comp(int a, idx_t t, float c, float geo, float *V, const C *code, const float *tvv, const float *ts, const int *tpole, const float *tkb, const float *tka, const float *th, int P, const int *slot, float *pol, float dt, idx_t n)
template<typename C>
inline void gf_e_node(int i, int j, int k, idx_t t, float *V, const float *I, const C *code, const float *tvv, const float *ts, const int *tpole, const float *tkb, const float *tka, const float *th, int P, const int *slot, float *pol, const float *G, Dims D, float ke, float dt)
template<typename C>
inline double gf_energy_node(int i, int j, int k, idx_t t, const float *V, const float *I, const C *code, const float *ts, const float *G, Dims D, float ke, float kh)
inline void gf_pml_e(idx_t e, idx_t m, float *V, const float *I, float *psi, const float *b, const float *c, const float *k1, const float *k2, Dims D, int a, int s0, int cnt)
inline void gf_pml_h(idx_t e, idx_t m, const float *V, float *I, float *psi, const float *b, const float *c, const float *k1, const float *k2, Dims D, int a, int s0, int cnt)
inline void gf_ferrite_cell(idx_t c, int nc, const int *ce, const float *ck, float *cs, float *cd, const idx_t *ei, const float *eli, const float *em, const float *I)
inline void gf_ferrite_cell3(idx_t c, int nc, const int *ce, const float *ck, float *cs, float *cd, const idx_t *ei, const float *eli, const float *em, const float *I)
inline void gf_ferrite_edge(idx_t e, const int *ec, const float *ew, const float *cd, float *em, float *I, const idx_t *ei, const float *el)
inline void gf_h_row(int i, int j, const float *V, float *I, const float *G, Dims D, float kh)
template<typename C>
inline void gf_e_row_comp(int a, idx_t t0, int kn, float *Vr, const float *Pp, const float *Pm, const float *Qp, const float *Qm, const float *geo_k, float f, const C *code, const float *tvv, const float *ts, const int *tpole, const float *tkb, const float *tka, const float *th, int P, const int *slot, float *pol, float dt, idx_t n, float *old, bool poles)
template<typename C>
inline void gf_e_row(int i, int j, float *V, const float *I, const C *code, const float *tvv, const float *ts, const int *tpole, const float *tkb, const float *tka, const float *th, int P, const int *slot, float *pol, const float *G, Dims D, float ke, float dt, float *scratch, bool poles)
inline float gf_iv(int a, const int ii[3], const float *G, Dims D, float kh)
inline float gf_vi(int a, const int ii[3], const float *G, Dims D, float ke, float s)
template<typename C>
inline void gf_pml_node(bool E, int i, int j, int k, idx_t t, float *V, float *I, float *psi, const float *b, const float *c, const idx_t *desc, int ns, const int *box, const C *code, const float *ts, const float *G, Dims D, float kf)
struct Dims
#include <fdtd_core.h>

Public Members

int nx
int ny
int nz

Typedefs

template<typename T>
using arr = py::array_t<T, py::array::c_style | py::array::forcecast>

Functions

template<typename T>
static T *ptr(arr<T> &a)
static void update_h(arr<float> V, arr<float> I, arr<float> G, int nx, int ny, int nz, float kh)
template<typename C>
static void update_e(arr<float> V, arr<float> I, arr<C> code, arr<float> tvv, arr<float> ts, arr<int32_t> tpole, arr<float> tkb, arr<float> tka, arr<float> th, int P, arr<int32_t> slot, arr<float> pol, arr<float> G, int nx, int ny, int nz, float ke, float dt)
static void mur_pre(arr<float> V, arr<int64_t> i0, arr<int64_t> i1, arr<float> o0, arr<float> o1)
static void mur_post(arr<float> V, arr<int64_t> i0, arr<int64_t> i1, arr<float> k, arr<float> o0, arr<float> o1)
template<typename C>
static double energy(arr<float> V, arr<float> I, arr<C> code, arr<float> ts, arr<float> G, int nx, int ny, int nz, float ke, float kh)
template<bool E>
static void pml(arr<float> V, arr<float> I, arr<float> psi, arr<float> b, arr<float> c, arr<float> k1, arr<float> k2, int nx, int ny, int nz, int a, int s0, int cnt)
template<int NA>
static void ferrite(arr<float> I, arr<int32_t> ce, arr<float> ck, arr<float> cs, arr<float> cd, arr<int64_t> ei, arr<float> el, arr<float> eli, arr<int32_t> ec, arr<float> ew, arr<float> em)
PYBIND11_MODULE(_core, m)
struct FlushDenormals