Creating a custom high-order Lagrangian element with Hierarchical shape functions using basix

I read the documentation for Basix and it seems that Lagrangian elements using Hierarchical shape functions are not included among the pre-provided element types. So I decided to try creating a custom element.

But it seems there is no way to attach multiple DOFs to one node. Take the triangular element based on Hierarchical shape functions as an example:

As shown in the figure, using Hierarchical shape functions can increase the element order without changing the original shape functions.
But I refer to the example in Creating a custom element — Basix 0.9.0.0 documentation which seems unable to create such the element. I’ve tried many combinations, adding elements of wcoeff and x, changing the size of M, and all produce dimension errors, or NaN output. If I’m missing something please let me know, I’d be very grateful.

The definition of custom elements in Basix is based on the Ciarlet definition of a finite element: the basis functions are defined by a set of functionals that evaluate to 1 when applied to one of the basis functions and 0 when applied to any other basis functions.

It’s possible to fit elements defined in other ways into this definition - I can explain this with your example once I’ve understood it.

I’m a little confused by your example element: I’d expect a quadratic element on a triangle to have 6 basis functions rather than 9. It looks to me in your example that \phi_5 and \phi_7 are equal. Do you have a reference for where this example is defined?