Skip to content

Commit

Permalink
switch to Kronecker.kronecker only at very high orders
Browse files Browse the repository at this point in the history
  • Loading branch information
jlchan committed Aug 2, 2024
1 parent 5e46b21 commit ab52105
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/RefElemData_polynomial.jl
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,17 @@ function RefElemData(elem::Hex,
# form kronecker products of multidimensional matrices to invert/multiply
# use dense matrix "kron" if N is small.
# use memory-saving "kronecker" if N is large.
build_kronecker_product = (N < 8) ? kron : kronecker
build_kronecker_product = (N > 10) ? kronecker : kron

VDM = build_kronecker_product(VDM_1D, VDM_1D, VDM_1D)
invVDM = build_kronecker_product(invVDM_1D, invVDM_1D, invVDM_1D)
invM = build_kronecker_product(invM_1D, invM_1D, invM_1D)

# always use the more efficient Kronecker product to compute invVDM
# since we multiply by it to compute Dr, Ds, Dt
invVDM = kronecker(invVDM_1D, invVDM_1D, invVDM_1D)

M = build_kronecker_product(M1D, M1D, M1D)

_, Vr, Vs, Vt = basis(elem, N, r, s, t)
Dr, Ds, Dt = (A -> Matrix(A * invVDM)).((Vr, Vs, Vt))

Expand Down

0 comments on commit ab52105

Please sign in to comment.