arrays - Compact storage coefficients of a multivariate polynomial -



arrays - Compact storage coefficients of a multivariate polynomial -

the setup

i writing code dealing polynomials of grade n on d-dimensional variable x , ran problem others have faced in past. such polynomial can characterized coefficients c(alpha) corresponding x^alpha, alpha length d multi-index specifying powers d variables must raised to.

the dimension , order general, known @ compile time, , high n = 30 , d = 10, though not @ same time. coefficients dense, in sense coefficients non-zero.

the number of coefficients required specify such polynomial n + d take n, in high dimensions much less n^d coefficients fill cube of side length n. result, in situation have store coefficients rather compactly. @ price, because retrieving coefficient given multi-index alpha requires knowing location.

the question

is there (straightforward) function mapping d-dimensional multi-index alpha position in array of length (n + d) take n?

ordering combinations

a well-known way order combinations can found on this wikipedia page. briefly order combinations lexically can count number of lower combinations. explanation can found in sections ordering combinations , place of combination in ordering.

precomputing binomial coefficients speed index calculation.

associating monomials combinations

if can associate each monomial combination can order them method above. since each coefficient corresponds such monomial provide reply you're looking for. luckily if

alpha = (a[1], a[2], ..., a[d])

then combination you're looking is

combination = (a[1] + 0, a[1] + a[2] + 1, ..., a[1] + a[2] + ... + a[d] + d - 1)

the index can readily calculated formula wikipedia page.

arrays algorithm math

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -