Lines and Surfaces
A target can be carried by a mesh Mesh gives one as soon as its simplices have fewer than
target = sdot.Mesh( nodes, triangles ) # nodes [ n, 3 ], triangles [ m, 3 ]: a surface in 3D
target = sdot.Mesh( nodes, segments, values = rho ) # segments [ m, 2 ]: lines in 2D or 3D, rho at the nodesWhat is computed
The cells of the transport are integrated exactly on
A measure on
with width, and ends with the measure on
These densities are integrated in closed form, on the envelope of alpha wide, and over-estimates
When the starting point already gives a mass to every cell ( diracs on
Parameters
sdot.Mesh( nodes, simplices, values = None, width = None, alpha = 15, margin = 0.25, smoothed = False )values:at the nodes, ones by default; width: the narrowest smoothed density, before the measure itself. By default,times the diagonal of . Wider, some cells of the last smoothed stage stay in layers along without crossing it, and they would be empty for the measure; alpha: the widest angle of the fans of the envelope, in degrees;margin: the domain of the smoothed densities is the box of, widened by margintimes its diagonal;smoothed = True: the target is the smoothed density atwidthrather than the measure on.
The envelope is built once, with the target. In 3D it is the largest cost: on a laptop, 3 s for a torus of 1000 triangles, 25 s for 4000, and 45 s for the 2880 triangles of the bottle below, whose sheets come close to each other.
Quantization of a Klein bottle
sdot.quantization works on these targets as on any other one ( see Lloyd quantization ). Given a number of diracs, it draws them on
The surface is the bottle immersion of the Klein bottle in
nodes, triangles = klein_bottle() # 2880 triangles, see the script below
target = sdot.Mesh( nodes, triangles )
x = sdot.quantization( target, 6000, seed = 0 )The diracs end at the barycenters of their cells: slightly inside the curved parts of the surface, by the sagitta of a cell.
A density on the surface
The same bottle, with
h = ( nodes[ :, 1 ] - nodes[ :, 1 ].min() ) / np.ptp( nodes[ :, 1 ] ) # y is the height
target = sdot.Mesh( nodes, triangles, values = 0.1 + 0.9 * h ** 2 )
x = sdot.quantization( target, 6000, seed = 0 )Reproducing the pages
The viewers are written by docs/guide/distributions/codim_mesh_figures.py, which also builds the bottle:
python docs/guide/distributions/codim_mesh_figures.py # both
python docs/guide/distributions/codim_mesh_figures.py klein-rho # or one of themLimits
- CPU only for now.
- The smoothed stages are much slower than the measure on
: a first solve from diracs far from can take minutes on a few thousand triangles. Starting on avoids them. - Points ( a codimension equal to the dimension ) are not meshes: use
SumOfGaussiansfor them.