How to chose elliptic curve in RELIC library? - cryptography

RELIC cryptography library is supporting the following pairing curves now.
BN_158, BN_254, BN_256, BN_382, BN_446, KSS_508, B12_381, B12_455, B24_477, BN_638, SS_1536
I got this list from src/fp/relic_fp_param.c. Does RELIC support any pairing curves other than these?
I didn't understand how to select the curve. In order to select B24_477 curve, should I just it build relic using
cmake -DFP-PRIME=477
For all these curves, what should I set BN-PRECI to? Are there any other parameters that I need to set? Can I chose the pairing curve to use in my code directly?
What happens if I initialize FP-PRIME to a number not in the above list?

Related

Kernel or Bezier curve smoothing for Kaplan-Meier Survival Estimate

I am a civil engineering grad student working on survival modeling of bridges. I am using SAS with Kaplan-Meier method to analyze the data. I would like to overlay the survival probability plot with a smooth curve using either Kernel smoothing or Bezier smoothing. But since these methods are not available in statistic packages, I exported the survival probability to an excel in order to produce it manually (I may be wrong on doing this). After several attempt I could not figure out on how to do it in Excel.
I am attaching an excel file image with data and the Kaplan Meier curve I am working and would be grateful if someone could help me by coding either the kernel smoothing or Bezier smoothing steps and overlay the curve and repost the file here to me. Or, more effeciently provide me with an excel add in to do this or a SAS code to do this.
If a parametric model providing a smoothed description of the survival data isn't appropriate, you could use smoothing splines or loess curves, compared on this page for example. For smoothing, multiple Bézier curves are combined to form one type of spline, and loess is one form of a kernel smoother. These are easily implemented in standard statistical software packages; for example, in SAS TRANSREG provides splines and LOESS implements that locally-weighted regression.*
That said, baseline survival curves in clinical studies are typically presented as the type of step function that you display, without smoothing. Also, it seems that your underlying data might only provide information at 1-year intervals. If so, then presenting a smooth curve might be somewhat misrepresenting the smoothness of your data. If you do have individual event and censoring times for each bridge, then your smoothed curve should be based on the survival probabilities at each event time to provide the closest representation of your data.
*I would be wary of using Excel for any serious statistical work. I have found it too easy to make unforced errors that avoid detection in Excel.

Parameterization of Triangulated Surface Meshes

I’d like to perform a surface parametrization of a triangle mesh (for the purpose of texture mapping).
I tried using some of CGAL’s algorithms, e.g. ARAP, Discrete Conformal Map etc.
The problem is that the surface parameterization methods proposed by CGAL only deal with meshes which are homeomorphic (topologically equivalent) to discs.
Meshes with arbitrary topology can be parameterized, provided that the user specifies a cut graph (a set of edges), which defines the border of a topological disc.
So the problem now becomes – how to cut the graph properly (using CGAL’s interface).
I found a similar question from 3 years ago that went unanswered.
P.S.
If someone can point me to a different library that can do the job, that’ll be just as great.
Thanks.

Creating General_polygon_2 from a Polyline

Since CGAL 4.3, Arr_polyline_traits_2 has the ability to reverse the direction of X_monotone_curves. Does this mean I can break up a Polyline into X_montone_curves to generate a General_Polygon_2?
In the book CGAL Arragements and their applications. I've read that you needed to use Segments, not Polylines. Is this still the case? Is the book is out of date?
While the book provides information that does not exist in the manual, it is already a bit out of date, at least with respect to polylines, and will get even more so when CGAL 4.7 comes out.
With CGAL 4.6 you can create a general polygon the boundary of which comprises x-monotone polylines. This is possible due to the flexibility you mention, that is, a polyline can be directed from left to right or vise versa
With CGAL 4.7, the next coming release, you will be able create a general polygon the boundary of which comprises x-monotone polycurve, which are piecewise curves that are not necessarily linear, such as conic arcs, circular arcs, Bezier curves, line segments, or even other polycurves.

Library for fitting parametric curves

Does anyone know of a library (any language, though preferably python/R/matlab) for parametric curve fitting, i.e. if you have a set of points in the plane {(x_i,y_i)} you can find parameter estimates for two (polynomial) functions y=f_y(t) and x=f_x(t) for some (arc-length?) parametrization t? This is especially useful if you have some multi-valued function (e.g. a circle) for which regression wouldn't work.
There are a number of papers detailing algorithms (e.g. 'Parametric Curve Fitting', Grossman 1971) but I can't find any corresponding software that would save a lot of time coding up.
For future reference, I ended up using the princurve library in R based on principal curves by Trevor Hastie.

Drawing cartograms with Matplotlib?

In case somebody doesn't know: A cartogram is a type of map where some country/region-dependent numeric property scales the respective regions so that that property's density is (close to) constant. An example is
from worldmapper.org. In this example, countries are scaled according to their population, resulting in near-constant population density.
Needless to say, this is really cool. Does anyone know of a Matplotlib-based library for drawing such maps? The method used at worldmapper.org is described in (1), so it would surprise me if no one has implemented this yet...
I'm also interested in hearing about other cartogram libraries, even if they're not made for Matplotlib.
(1) Michael T. Gastner and M. E. J. Newman,
Diffusion-based method for producing density-equalizing maps,
Proc. Nat. Acad. Sci. USA, 101, 7499-7504 (2004). Available at arXiv.
There's this, though it's based and a different algorithm (and though it's on the ESRI site, it doesn't require ArcGIS). Of course, once you have the cartogram you can plot it in matplotlib.
Here is a Javascript plugin to make cartograms using D3. It is a good, simple solution if you are not too concerned about the regions being sized accurately. If accuracy is important, there are other options available that give you more freedom to play with the algorithm's parameters to get to a more accurate result.
Here are two great standalone programs I know of:
Scapetoad
Carto3F
Scapetoad is very easy to use. Just give it a shapefile, tell it which attribute to use for the scaling, and set a few accuracy parameters. If there is any doubt, this post describes the process.
Carto3F is more complex and allows for greater accuracy, though it is a bit trickier to figure out - lots of parameter settings without much documentation explaining them.
There is also a QGIS cartogram plugin, written in Python. Though I have not been able to get it to work, so cannot comment on that one.
In short, no. But Newman has an excellent little implementation of his and Gastner's method on his website. Installing it is easy and it works from the command line. Here's an example of a workflow using this software that worked for me.
Compute a grid of density estimates over some region, e.g. in Python. Store it as a matrix of numbers.
Run the cart program with your density matrix as input from the command line or from as subprocess in Python.
The program returns a list of new coordinates for each grid point.
Pipe your shapefile points through the interp program and into a new shapefile to get the transformed map.
There are nice instructions on the main page.
The geoplot.cartogram function in
Geoplot: geospatial data visualization — geoplot 0.2.0
says it is a high-level Python geospatial plotting library, and an extension to cartopy and matplotlib.
Try this library if you are using geopandas, it is quick and doesnt require much customization. https://github.com/mthh/cartogram_geopandas