Coder Social home page Coder Social logo

ofloveandhate / bertini_real Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 24.0 97.13 MB

software for real algebraic sets

Home Page: https://bertinireal.com

License: Other

C++ 62.87% MATLAB 9.41% TeX 5.96% Lex 0.52% Makefile 0.11% M4 2.57% C 0.01% Python 8.07% Shell 0.01% OpenSCAD 0.78% M 0.06% C# 9.64%
bertini polynomials polynomial-systems algebraic-geometry numerical-methods real-algebraic-geometry curves surfaces

bertini_real's Introduction

note: please clone this repository recursively (git clone --recursive) to pick up these submodules:

otherwise some Matlab code won't work correctly, and you'll get warnings and errors, and have to init them later.


Bertini_real: software for real algebraic sets

This software implements a numerical algorithm for decomposing real surfaces of arbitrary dimension, using Bertini as the computational engine.

For documentation, please visit bertinireal.com and doc.bertinireal.com

Notes

Bertini_real is implemented in C++ and compiles against a number of libraries. It has been developed and tested in Linux and OSX, and been tested in Cygwin. It has never been compiled in Windows without another helper environment like MinGW or Cygwin.

The libraries against which Bertini_real compiles are:

  • MPFR,
  • GMP,
  • Bertini, compiled from source into a library,
  • Boost,
  • MPI.

Bertini_real is built from source using standard methods, and requires the C++11 standard.

I do not recommend the use of Matlab 2018b for visualization on OSX. It's unusably slow when adjusting options in the plot window

Input and output formats

Input and output are through plain-text files written to disk.

Input

The necessary input files for Bertini_real are:

  1. The same Bertini input file from which the user acquires a numerical irreducible decomposition;
  2. The witness_data file created by Bertini after computing a numerical irreducible decomposition.

Many systems have multiple components. Bertini_real therefore processes witness_data for each component, and offers the user a choice if there is one. That is, if there is a single component of dimension one or two, Bertini_real will automatically and implicitly decompose that component. If there are multiple components, Bertini_real will prompt the user for their choice. They may only decompose a single dimension at a time, but they may elect to decompose as many components as they wish simultaneously, provided that they all have the same deflation sequence. For example, the system in \S\ref{sec:curveexamplefrompaper} has multiple components of dimension one, some of which are nonsingular, and several of which must be deflated. The images in this example were produced by decomposing several components at the same time.

Optionally, the user may supply:

  • a sphere file, consisting of the radius and center; and/or`
  • a projection file, prefaced by the number of variables, and containing the coefficients of the linear projections $\pi_i$.

The user indicates the names of the files using flags to the command line; e.g., the calling sequence is: bertini_real -sphere mysphere -pi myprojection

Output

There are two kinds of output:

  1. temporary files generated by the Bertini parser and produced input files, and
  2. the end-result deposited into a subfolder of the current working directory.

The temporaries are unavoidable but inconsequential, so they are not discussed here. The writing of files is incremental, and happens after each major stage, so that if the program fails for some reason, the user gets the most recent good state as a parsable set of data.

Files common to all decompositions

  • vertex_set The number of vertices, the number of projections, the number of natural variables, and the number of input files referenced. Coefficients of the $\pi_i$ projections. The input file names. Then the vertices, appearing as the number of variables, the coordinates, the number of projection values stored, the projection values, and the integer index of the filename for which the point was originally found and committed.
  • input file Copied verbatim into the folder. Needed for sampling and future reference.
  • original witness_data file Copied verbatim into the folder. This file is part of the generating data, and so is deemed part of the decomposition.
  • decomp file The name of the input file, the number of variables, and the dimension of the decomposition. All of the $\pi_i$ projections used. The patches. The center and radius of the sphere.

Files specific to curve decompositions

  • E.edge Contains all edges of the curve, listed as integers into vertex_set, being line-delimited as left mid right.

Files specific to surface decompositions

  • S.surf The number of faces, the number of critical slices, and the number of midslices, along with the number of singular curves, their `multiplicities', and the number of each multiplicity.
  • All curve sub-decompositions, written to their own sub-folders critical curve, sphere curve, singular curves, and all mid and critslices.

Full documentation of input and output for Bertini_real is in the pdf manual, and detailed using Doxygen, and is available at the Bertini_real documentation webpage.

bertini_real's People

Contributors

chrislembo avatar dan90210 avatar esudkamp avatar foongminwong avatar ofloveandhate avatar reganmargaret1 avatar samanthasherman avatar scavender95 avatar stellarraccoon avatar travisw1 avatar xqueezeme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bertini_real's Issues

Indices Command

I'm having issues with selecting which coordinates to plot in the case of a curve of dimension >2. A bertini_real_plotter option to choose the indices would make it easier to plot projections. Thanks!

Overwrite nullspace.hpp

When trying to install bertini_real, the command make install keeps returning this error message.

/usr/bin/install: will not overwrite just-created '/usr/local/include/bertini_real/sphere_intersection.hpp' with 'include/symbolics/sphere_intersection.hpp'
/usr/bin/install: will not overwrite just-created '/usr/local/include/bertini_real/nullspace.hpp' with 'include/symbolics/nullspace.hpp'

Unable to decompose 'Suss' with python

I'm trying to run bertini_real -E python for Suss. It works using matlab, but not python.

Here's the screen output from my attempt

bertini_real -E python


NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 2.060251000000e+00, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024


 BertiniReal(TM) v1.6.0

 D.A. Brake with
 D.J. Bates, W. Hao, J.D. Hauenstein,
 A.J. Sommese, C.W. Wampler

(using GMP v6.1.2, MPFR v4.0.1)


  Library-linked Bertini(TM) v1.6
   (May 22, 2018)

 D.J. Bates, J.D. Hauenstein,
 A.J. Sommese, C.W. Wampler

(using GMP v6.1.2, MPFR v4.0.1)


NOTE: Please make sure that you have also put the proper test points for the membership test in 'member_points'.



NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 2.060251000000e+00, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024


Testing membership: 1 point to test.
Testing 0 of 1

It appears that point 0 lies on component 0 of dimension 2.



************* Witness Set Decomposition *************

| dimension | components | classified | unclassified
-----------------------------------------------------
|   2       |   1        |   6        |  0
-----------------------------------------------------

************** Decomposition by Degree **************

Dimension 2: 1 classified component
-----------------------------------------------------
   degree 6: 1 component

*****************************************************

Performing a stabilization test


NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 2.060251000000e+00, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024

Testing for a component of dimension 2.

Bertini verified that a witness point is a smooth
point on a 2 dimensional generically reduced component.


Isosingular deflation was successful!

Number of deflations: 0
Deflation sequence: 2, ...

Deflated system printed to 'input_dim_2_comp_0_deflated'.


NOTE: Please make sure that you have also put the proper test points for the membership test in 'member_points'.



NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 2.060251000000e+00, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024


Testing membership: 2 points to test.
Testing 0 of 2

It appears that point 0 lies on component 0 of dimension 2.

It appears that point 1 lies on component 0 of dimension 2.



************* Witness Set Decomposition *************

| dimension | components | classified | unclassified
-----------------------------------------------------
|   2       |   1        |   6        |  0
-----------------------------------------------------

************** Decomposition by Degree **************

Dimension 2: 1 classified component
-----------------------------------------------------
   degree 6: 1 component

*****************************************************

computing witness points for the critical curve
tracking path 0 of 30
tracking path 20 of 30
using python to create critical system


splitting points for multiplicity 6 singular curve
Performing a stabilization test


NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 6.101861000000e+01, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024

Testing for a component of dimension 3.

Bertini was unable to verify that a witness point is a smooth
point on a 3 dimensional generically reduced component.


Performing an isosingular deflation


NOTE: You have requested to use adaptive path tracking.  Please make sure that you have
setup the following tolerances appropriately:
CoeffBound: 1.047285000000e+01, DegreeBound: 6.000000000000e+00
AMPSafetyDigits1: 1, AMPSafetyDigits2: 1, AMPMaxPrec: 1024

ERROR: The point does not sufficiently satisfy the original system (residual: 1.785821e+00, tolerance: 1.000000e-10).
Bertini will now exit due to this error.

--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode 7.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

if curve is just points, matlab plotter won't render

for the example x^2+y^2=0, the decomposition runs fine, but the matlab code chokes. here's the error:

bertini_real_plotter
Index exceeds matrix dimensions.
Error in bertini_real_plotter/sphere_plot (line 4)
center = real(br_plotter.BRinfo.center(br_plotter.indices));
Error in bertini_real_plotter/curve_plot (line 38)
sphere_plot(br_plotter);
Error in bertini_real_plotter/plot (line 292)
					curve_plot(br_plotter);
Error in bertini_real_plotter (line 131)
			plot(br_plotter); 

to be fair, it's not matlab's fault. the center is in fact empty.

plotting curves fails if not sampled

Example error message:

gathering data from output_dim_1_comp_0
no samples to gather
Traceback (most recent call last):
  File "/Users/amethyst/git_repos/bertini_real/test/curve/circle/plot.py", line 3, in <module>
    br.gather_and_plot()
  File "/opt/homebrew/lib/python3.11/site-packages/bertini_real/__init__.py", line 40, in gather_and_plot
    return bertini_real.plot.plot(decomposition)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/bertini_real/plot/__init__.py", line 942, in plot
    plotter.plot(data)
  File "/opt/homebrew/lib/python3.11/site-packages/bertini_real/plot/__init__.py", line 243, in plot
    self.options.visibility.auto_adjust(decomposition)
  File "/opt/homebrew/lib/python3.11/site-packages/bertini_real/plot/__init__.py", line 95, in auto_adjust
    self._adjust_for_curve(decomposition)
  File "/opt/homebrew/lib/python3.11/site-packages/bertini_real/plot/__init__.py", line 127, in _adjust_for_curve
    if len(curve.sampler_data)==0:
       ^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()

Screen Output Not Suppressing

I've tried using bertini_real -verb 0
bertini_real -verb 1
and bertini_real -verb 2 to try and get bertini_real to stop outputting to the screen...doesn't seem to be working. I still am getting a looooot--if not all--the output to the screen that bertini_real normally does. However, perhaps there is a difference that I'm just not catching, and maybe bertini_real prints to the screen in case there are things that the user needs to further input (which I've seen before while using bertini_real but is not the case for any of the things I'm using it to do right now.)

I'd like to have 0 output to the terminal if possible. I don't know if that's an option.

MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD with errorcode -2363.

I am getting the following error:

$ bertini_real input -debug
--------------------------------------------------------------------------
[[29200,1],0]: A high-performance Open MPI point-to-point messaging module
was unable to find any relevant network interfaces:

Module: OpenFabrics (openib)
  Host: mule

Another transport will be used instead, although this may result in
lower performance.

NOTE: You can disable this warning by setting the MCA parameter
btl_base_warn_component_unused to 0.
--------------------------------------------------------------------------
these options were not processed: input 
bertini_real quitting
--------------------------------------------------------------------------
MPI_ABORT was invoked on rank 0 in communicator MPI_COMM_WORLD
with errorcode -2363.

NOTE: invoking MPI_ABORT causes Open MPI to kill all MPI processes.
You may or may not see output from other processes, depending on
exactly when Open MPI kills them.
--------------------------------------------------------------------------

Any help welcome.

sampler doesn't run if containing folder name has spaces. also if folder is moved.

so this is a stupid problem. the sampler module doesn't run if your folder's path has a space in it. also, since the sampler reads in Dir_name (a relic of early work on the program), and it contains the data folder's absolute path, if a data folder is moved the sampler will break. ugh.

on a mac, you'll get this error:

libc++abi.dylib: terminating with uncaught exception of type std::runtime_error: invalid dimension of object to sample.  you sure you have a valid decomposition?

[Error] Decomposing a surface 'Eistute' using Python as symbolic engine

I'm trying to decompose a surface called "Eistute" and got the following error:

  File "python_deflate.py", line 38
    function f_2_1, f_2_2, f_2_3, f_2_4, f_2_5, f_2_6, f_2_7, f_2_8, f_2_9, f_2_10, f_2_11, f_2_12;
                 ^
SyntaxError: invalid syntax
ERROR: Trying to redefine f_2_1 in system statement 21.
Statement 21 up to error: 'function f_2_1'
Bertini will now exit due to this error.```

Screen and Output Issue

The screen output should output to a file as well in order to resolve failed decompositions.

Wrong Homology Output

#1: I tried using bertini_real + polyTop to get me some homology of things like the variety corresponding to x^2 + y^2 + z^2 + w^2 - 1, f(x,y,z,w) where f is a random degree 3 homogeneous polynomial in x y z w, i.e. a random cubic surface living on S^3, something which should have at most 3 components, all of which contribute 1 to the rank of H^2. Aaaaand polyTop was giving me three components but rank 2 for H^2, which...lies. Cannot be so. So I went to check the torus example given here: http://www.bertinireal.com/gallery.html

#2: The torus example didn't go well. The first time I attempted it, literally just copy-pasting what's in the gallery to an input file, running bertini input, bertini_real, gather_br_samples in matlab, then polyTop in matlab, I got like rank 3 for H^1, rank 1 for H^0, and nothing for H^2 :/ Then I scraped everything, re-downloaded gather_br_samples (as I think that's where the issue is), and ran it again. And...somehow got more genus (rank of H^1) but still no H^2 at all.

I then tried just running some of polyTop in the command line. For face 1 of BRinfo, I tried checking out the left_points and right_points, only to find that they were empty... I did this after running all of polyTop in the command line, too, and still got empty matrices for left_points and right_points.

I'm thinking there's some issue in the gather_br_samples.m code but don't really know what happens under the hood with bertini real. (While waiting for responses, I'll be delving into that and seeing what I can
see.)

gather_br_samples fails to save for large files

if saving a large decomposition (>2GB), you get this warning from matlab:

gather_br_samples
done gathering decomposition.
writing data to file.
Warning: Variable 'BRinfo' was not saved. For variables larger than 2GB use MAT-file
version 7.3 or later. 

Wrong number of components ?

The following file should produce a sextic plane curve with 11 real components. Even
speciying a large sphere, bertini_real only gives 1 component. Unfortunatly I do not have matlab, so I can not see
the curve.

CONFIG

tracktype: 1;
mptype: 2;
END;

INPUT

variable_group x,y;
function f1;
f1= 5902958103587057/295147905179352825856*x^6 + 40531964440273725/72057594037927936*x^4*y^2 + 25036959739963005/72057594037927936*x^4*y + 1920267795234525/36028797018963968*
x^4 + -5/288230376151711744*x^3*y^2 + 1/36028797018963968*x^3*y + 1/288230376151711744*x^3 + -27015689041511865/72057594037927936*x^2*y^4 + 4173100506748115/18014398509481984
*x^2*y^3 + 7681560821320809/72057594037927936*x^2*y^2 + -16171977850148559/576460752303423488*x^2*y + -4618832124818515/576460752303423488*x^2 + -5/288230376151711744*x*y^4 +
 -1/1152921504606846976*x*y^3 + 3/576460752303423488*x*y^2 + -19/36893488147419103232*x + 4505040779251255/72057594037927936*y^6 + -4173335654696659/36028797018963968*y^5 + 1
920512623176073/36028797018963968*y^4 + 673871944243585/72057594037927936*y^3 + -2309574197692173/288230376151711744*y^2 + 3172797267229483/73786976294838206464;

END;

Unable to run after compiling

Im using Ubuntu 18.04.1 (64-bit, fresh install.) Both Bertini and bertini_real seem to compile, but only bertini seems to work---sample output come from the "Steiner surface" example in online gallery.

I gather from the output that bertini_real is trying to parse the filename as an option? In any case, the error seems to be MPI-related.

One thing I'm not sure how to check is what MPI the software are using (I think I have open mpi and mpich both somewhere on my system.) I did get this message after "make":

/usr/bin/x86_64-linux-gnu-ld: warning: libmpi.so.40, needed by //usr/local/lib/libbertini-parallel.so, may conflict with libmpi.so.20
/usr/bin/x86_64-linux-gnu-ld: warning: libmpi.so.40, needed by //usr/local/lib/libbertini-parallel.so, may conflict with libmpi.so.20

Its possible I messed up some dependencies (I installed some using linuxbrew, then apt.) But I wouldn't expect this to cause any problems after compilation.

breal_output.txt
bertini_output.txt

floating point exception(core dump)

while trying to run bertini_real on a cube surface, we ran into this error. to solve the error we changed printpathmodulus : 0 in the input file to printpathmodulus : 100

Topology with bertini_real + poly_Top

I am trying to determine the topology of a cubic surface living on S^3 which is the preimage of a random cubic surface in RP^3, i.e. the subset to the reals of a smooth and irreducible surface in CP^3.

After significantly reducing the tolerances for input to bertini_real and sharpening the digits a ton, I came up with an even worse problem. With tracktolbeforeg and tracktolduringeg tolerances on the order of 10e-40 or 10e-50, the output from bertini could not be processed by bertini_real. Instead, bertini_real just notices that there is no dimension 2 component to these surfaces.

I am using bertini_real -sphere sphere_file -dim 2 -nomerge to try and make things as correct as possible. My surfaces are defined as living on the 3-sphere in R^4 anyway, so my sphere_file just corresponds to the 3-sphere of radius 2 centered at the origin in R^4. I have also tried taking out the tolerancebeforeeg and toleranceduringeg to instead use just highly sharpened digits (and then progressively less sharpened digits to see if I could make things work), and I am still getting incorrect output for the homology of at least one of these (hundred, random) cubic surfaces in S^3. There is a classification of these things, which are just preimages of cubic hypersurfaces in RP^3, and the output disagrees with the classification and really, even with more just common sense. Specifically, I am getting things like h^0 = 1, h^1 = 4 (or something), and h^2 = 0, which is impossible considering that these are compact real orientable surfaces which must necessarily obey the classification of compact real orientable 2-manifolds. (This is with h^i representing the ith Betti number of this surface, i.e. the rank/dimension of the ith homology group.)

I am thinking that there might be some issue in polyTop, or maybe I'm just making a goof-up somewhere that I can't find. I may look at the polyTop source code at some point today. Currently I'm reading the articles in support of/leading to bertini_real so that I can understand the details of how it works and better understand the output which is then fed into polyTop (so that I can read the source code for polyTop).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.