mirror of https://github.com/CGAL/cgal
*Add a model for SVDTraits using Eigen and use it by default. Update the doc.
*Add non-sparse matrix class (thus renamimg of the existing one) *specialisation of the matrix class in Eigen_solver_traits according whether this is a symmetric or asymmetric matrix *update use-files of lapack and Taucs to get definitions
This commit is contained in:
parent
df4bd83797
commit
62ed832e2b
|
|
@ -1819,6 +1819,7 @@ Jet_fitting_3/doc_tex/Jet_fitting_3/david-dirmaxkmin-white-back.jpg -text svneol
|
|||
Jet_fitting_3/doc_tex/Jet_fitting_3/jet_fitting_basis.gif -text svneol=unset#image/gif
|
||||
Jet_fitting_3/doc_tex/Jet_fitting_3/jet_fitting_basis.pdf -text svneol=unset#application/pdf
|
||||
Jet_fitting_3/doc_tex/Jet_fitting_3/ppal_curv_poly2x2+y2.jpg -text svneol=unset#image/jpeg
|
||||
Jet_fitting_3/doc_tex/Jet_fitting_3_ref/Eigen_svd.tex -text
|
||||
Jet_fitting_3/doc_tex/Jet_fitting_3_ref/template_dependence.jpg -text svneol=unset#image/jpeg
|
||||
Jet_fitting_3/doc_tex/Jet_fitting_3_ref/template_dependence.pdf -text svneol=unset#application/pdf
|
||||
Jet_fitting_3/examples/Jet_fitting_3/data/ellipe0.003.off -text svneol=unset#application/octet-stream
|
||||
|
|
@ -3461,6 +3462,7 @@ Snap_rounding_2/test/Snap_rounding_2/cgal_test_base -text
|
|||
Snap_rounding_2/test/Snap_rounding_2/cgal_test_with_cmake eol=lf
|
||||
Solver_interface/include/CGAL/Eigen_matrix.h -text
|
||||
Solver_interface/include/CGAL/Eigen_solver_traits.h -text
|
||||
Solver_interface/include/CGAL/Eigen_svd.h -text
|
||||
Solver_interface/include/CGAL/Eigen_vector.h -text
|
||||
Spatial_searching/TODO.txt -text
|
||||
Spatial_searching/benchmark/Spatial_searching/Compare_ANN_STANN_CGAL.cpp -text
|
||||
|
|
|
|||
|
|
@ -34,5 +34,7 @@ if ( LAPACK_FOUND AND NOT CGAL_LAPACK_SETUP )
|
|||
# Setup is done
|
||||
set ( CGAL_LAPACK_SETUP TRUE )
|
||||
|
||||
add_definitions(-DCGAL_LAPACK_ENABLED)
|
||||
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -24,5 +24,7 @@ if ( TAUCS_FOUND AND NOT CGAL_TAUCS_SETUP )
|
|||
# Setup is done
|
||||
set ( CGAL_TAUCS_SETUP TRUE )
|
||||
|
||||
add_definitions(-DCGAL_TAUCS_ENABLED)
|
||||
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -249,11 +249,11 @@ version provided in the download section.
|
|||
|
||||
|
||||
\subsection{Eigen \label{thirdparty:Eigen}}
|
||||
{\sc Eigen} is a matrix manipulation library. \ccc{Eigen} supports all
|
||||
matrix sizes, various matrix decomposition methods and sparse linear solvers. In \cgal, {\sc Eigen} is used as
|
||||
\eigen is a matrix manipulation library. \eigen supports all
|
||||
matrix sizes, various matrix decomposition methods and sparse linear solvers. In \cgal, \eigen is used as
|
||||
an alternative to \taucs\ which also provides sparse linear solvers.
|
||||
|
||||
The {\sc Eigen} web site is \ccAnchor{http://eigen.tuxfamily.org}{\path|http://eigen.tuxfamily.org|}.
|
||||
The \eigen web site is \eigenpage.
|
||||
|
||||
\subsection{Blas \label{thirdparty:Blas}}
|
||||
|
||||
|
|
@ -1142,7 +1142,7 @@ usage of TAUCS-METIS will be disabled.
|
|||
\index{cgal!general-config-cmake-vars-dep-eigen}\index{cgal configuration cmake variables - dependencies - eigen}
|
||||
\subsubsection{Eigen library}
|
||||
|
||||
{\sc Eigen} is a header-only template library.
|
||||
\eigen is a header-only template library.
|
||||
Only the {\em directory} containing the header files is needed.
|
||||
|
||||
{\ccTexHtml{\small}{}
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ This package allows the estimation of local differential quantities of
|
|||
a surface from a point sample, given either as a mesh or as point
|
||||
cloud.
|
||||
|
||||
Note that this package needs the third party libraries
|
||||
\ccThirdPartyLapack\ and \ccThirdPartyBlas\ to be installed to compile
|
||||
the example code.
|
||||
Note that this package either needs the third party library
|
||||
\ccThirdPartyEigen, or \ccThirdPartyLapack\ and \ccThirdPartyBlas\
|
||||
to be installed to compile the example code.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Introduction\label{sec:intro}}
|
||||
|
|
@ -258,14 +258,13 @@ the coordinate system of the PCA (in which the fitting is performed).
|
|||
|
||||
This concept provides the types for the input sample points, together
|
||||
with $3d$ vectors and a number type. It is used as template for the
|
||||
classe \ccc{Monge_via_jet_fitting<DataKernel, LocalKernel =
|
||||
Cartesian<double>, SvdTraits = lapack_svd>} . Typically, one can use
|
||||
class \ccc{Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>} . Typically, one can use
|
||||
\ccc{CGAL::Cartesian<double>}.
|
||||
|
||||
\subsubsection{Template parameter \texttt{LocalKernel}}
|
||||
%%%%%%%%%%%
|
||||
This is a parameter of the class
|
||||
\ccc{Monge_via_jet_fitting<DataKernel, LocalKernel = Cartesian<double>, SvdTraits = lapack_svd>}.
|
||||
\ccc{Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>}.
|
||||
This concept defines the vector and number types used for local
|
||||
computations and to store the PCA basis data.
|
||||
|
||||
|
|
@ -281,7 +280,7 @@ one can use
|
|||
|
||||
This concept provides the number, vector and matrix types for algebra
|
||||
operations required by the fitting method in
|
||||
\ccc{Monge_via_jet_fitting<DataKernel, LocalKernel = Cartesian<double>, SvdTraits = lapack_svd>}
|
||||
\ccc{Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>}
|
||||
. The main method is a linear solver using a singular value decomposition.
|
||||
|
||||
\subsubsection{Compatibility requirements}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
curvature lines, etc. This package allows the estimation of local
|
||||
differential quantities of a surface from a point sample.}
|
||||
|
||||
\ccPkgDependsOn{Solvers as \ccThirdPartyLapack\ and \ccThirdPartyBlas.}
|
||||
\ccPkgDependsOn{either \ccThirdPartyEigen, or \ccThirdPartyLapack\ and \ccThirdPartyBlas for solvers.}
|
||||
\ccPkgIntroducedInCGAL{3.3}
|
||||
\ccPkgLicense{\ccLicenseQPL}
|
||||
%\ccPkgDemo{Operations on Polyhedra}{polyhedron_3.zip}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
\begin{ccRefClass}{Eigen_svd}
|
||||
|
||||
\ccDefinition
|
||||
|
||||
The class \ccRefName\ provides an algorithm to solve in the least
|
||||
square sense a linear system with a singular value decomposition using
|
||||
\ccc{Eigen}. The field type is \ccc{double}.
|
||||
|
||||
\ccInclude{CGAL/Eigen_svd.h}
|
||||
|
||||
\ccIsModel
|
||||
\ccc{SvdTraits}
|
||||
|
||||
\end{ccRefClass}
|
||||
|
||||
% +------------------------------------------------------------------------+
|
||||
%%RefPage: end of main body, begin of footer
|
||||
% EOF
|
||||
% +------------------------------------------------------------------------+
|
||||
|
||||
|
|
@ -30,7 +30,8 @@ the particular information returned depending on the degrees specified
|
|||
for the polynomial fitting and for the Monge form.
|
||||
|
||||
The default for the template \ccc{LocalKernel} is
|
||||
\ccc{Cartesian<double>} and the default for \ccc{SvdTraits} is \ccc{Lapack_svd}.
|
||||
\ccc{Cartesian<double>} and the default for \ccc{SvdTraits} is \ccc{Eigen_svd} if \ccc{CGAL_EIGEN3_ENABLED}
|
||||
is defined and \ccc{Lapack_svd} otherwise.
|
||||
|
||||
\ccInclude{CGAL/Monge_via_jet_fitting.h}
|
||||
|
||||
|
|
@ -160,6 +161,7 @@ algebra algorithm required by the fitting method.
|
|||
|
||||
\ccSeeAlso
|
||||
|
||||
\ccc{Eigen_svd},
|
||||
\ccc{Lapack_svd},
|
||||
\ccc{Monge_form}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ number of $M$. The solution is stored in $B$.}
|
|||
|
||||
\ccHasModels
|
||||
% +------------------------------------------------------------------
|
||||
\ccc{Eigen_svd},
|
||||
\ccc{Lapack_svd}.
|
||||
|
||||
\ccSeeAlso
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ Surfaces via Polynomial Fitting\label{ref_chap:Jet_fitting_3}}
|
|||
\subsection*{Classes}
|
||||
\ccRefIdfierPage{CGAL::Monge_via_jet_fitting< DataKernel, LocalKernel, SvdTraits>::Monge_form}\\
|
||||
\ccRefIdfierPage{CGAL::Monge_via_jet_fitting<DataKernel, LocalKernel, SvdTraits>}\\
|
||||
\ccRefIdfierPage{CGAL::Eigen_svd}\\
|
||||
\ccRefIdfierPage{CGAL::Lapack_svd}\\
|
||||
|
||||
\subsection*{Global Functions}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
\input{Jet_fitting_3_ref/intro.tex}
|
||||
|
||||
\input{Jet_fitting_3_ref/DataKernel.tex}
|
||||
\input{Jet_fitting_3_ref/Eigen_svd.tex}
|
||||
\input{Jet_fitting_3_ref/Lapack_svd.tex}
|
||||
\input{Jet_fitting_3_ref/LocalKernel.tex}
|
||||
\input{Jet_fitting_3_ref/Monge_form.tex}
|
||||
|
|
|
|||
|
|
@ -21,12 +21,18 @@ if ( CGAL_FOUND )
|
|||
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
# Link with BLAS and LAPACK (required)
|
||||
# use either Eigen or BLAS/LAPACK
|
||||
find_package(Eigen3)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
find_package(LAPACK)
|
||||
if(LAPACK_FOUND)
|
||||
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
endif(LAPACK_FOUND)
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
if(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
# Link with Boost.ProgramOptions (optional)
|
||||
find_package(Boost QUIET COMPONENTS program_options)
|
||||
if(Boost_PROGRAM_OPTIONS_FOUND)
|
||||
|
|
@ -44,11 +50,11 @@ if ( CGAL_FOUND )
|
|||
create_single_source_cgal_program( "Mesh_estimation.cpp" )
|
||||
create_single_source_cgal_program( "Single_estimation.cpp" )
|
||||
|
||||
else(LAPACK_FOUND)
|
||||
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
message(STATUS "NOTICE: This program requires LAPACK, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This program requires either Eigen 3 (or greater) or LAPACK, and will not be compiled.")
|
||||
|
||||
endif(LAPACK_FOUND)
|
||||
endif(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
else()
|
||||
|
||||
|
|
|
|||
|
|
@ -23,10 +23,15 @@
|
|||
#include <CGAL/Linear_algebraCd.h>
|
||||
#include <CGAL/eigen.h>
|
||||
#include <CGAL/Cartesian_converter.h>
|
||||
#include <CGAL/Lapack/Linear_algebra_lapack.h>
|
||||
#include <math.h>
|
||||
#include <utility>
|
||||
|
||||
#ifdef CGAL_EIGEN3_ENABLED
|
||||
#include <CGAL/Eigen_svd.h>
|
||||
#else
|
||||
#include <CGAL/Lapack/Linear_algebra_lapack.h>
|
||||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
inline
|
||||
|
|
@ -37,7 +42,11 @@ unsigned int fact(unsigned int n){
|
|||
}
|
||||
|
||||
////////////////////// CLASS Monge_via_jet_fitting ////////////////////////
|
||||
#ifdef CGAL_EIGEN3_ENABLED
|
||||
template < class DataKernel, class LocalKernel = Cartesian<double>, class SvdTraits = Eigen_svd >
|
||||
#else
|
||||
template < class DataKernel, class LocalKernel = Cartesian<double>, class SvdTraits = Lapack_svd>
|
||||
#endif
|
||||
class Monge_via_jet_fitting {
|
||||
public:
|
||||
//////////////////////begin nested CLASS Monge_form ///////////////////
|
||||
|
|
|
|||
|
|
@ -21,22 +21,29 @@ if ( CGAL_FOUND )
|
|||
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
# Link with BLAS and LAPACK (required)
|
||||
# use either Eigen or BLAS/LAPACK
|
||||
find_package(Eigen3)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
find_package(LAPACK)
|
||||
|
||||
if(LAPACK_FOUND)
|
||||
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
endif(LAPACK_FOUND)
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
|
||||
if(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
include_directories (BEFORE ../../include)
|
||||
|
||||
create_single_source_cgal_program( "blind_1pt.cpp" )
|
||||
|
||||
else(LAPACK_FOUND)
|
||||
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
message(STATUS "NOTICE: This program requires LAPACK, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This program requires either Eigen 3 (or greater) or LAPACK, and will not be compiled.")
|
||||
|
||||
endif(LAPACK_FOUND)
|
||||
endif(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
else()
|
||||
|
||||
|
|
|
|||
|
|
@ -253,6 +253,7 @@
|
|||
\newcommand{\ccThirdPartyBlas}{\ccThirdParty{Blas}}
|
||||
\newcommand{\ccThirdPartyAtlas}{\ccThirdParty{Atlas}}
|
||||
\newcommand{\ccThirdPartyRS}{\ccThirdParty{RS}}
|
||||
\newcommand{\ccThirdPartyEigen}{\ccThirdParty{Eigen}}
|
||||
|
||||
|
||||
% --------- plain names of thirdparty stuff -------
|
||||
|
|
@ -273,6 +274,7 @@
|
|||
\newcommand{\atlas}{\textsc{atlas}}
|
||||
\newcommand{\lapack}{\textsc{lapack}}
|
||||
\newcommand{\exacus}{\textsc{Exacus}}
|
||||
\newcommand{\eigen}{\textsc{Eigen}}
|
||||
|
||||
|
||||
% macros for WWW pages
|
||||
|
|
@ -301,7 +303,7 @@
|
|||
\newcommand{\cpackpage}{\path'http://www.cmake.org/cmake/help/cpack2.6docs.html'}
|
||||
\newcommand{\nsispage}{\path'http://nsis.sourceforge.net/Main\_Page'}
|
||||
\newcommand{\fhs}{\path'http://www.pathname.com/fhs/pub/fhs-2.3.html'}
|
||||
|
||||
\newcommand{\eigenpage}{\path'http://eigen.tuxfamily.org'}
|
||||
|
||||
% Implement the two columns layout for the HTML converted part
|
||||
% ------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -59,11 +59,26 @@ if(QT4_FOUND)
|
|||
find_package(QGLViewer )
|
||||
endif(QT4_FOUND)
|
||||
|
||||
|
||||
|
||||
# Eigen is now used by default
|
||||
find_package(Eigen3)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
# Find LAPACK (optional), for curvatures estimation
|
||||
find_package(LAPACK)
|
||||
if(LAPACK_FOUND)
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
endif(LAPACK_FOUND)
|
||||
|
||||
# Find TAUCS (optionnal), for parametrization
|
||||
find_package(TAUCS)
|
||||
if(TAUCS_FOUND)
|
||||
include( ${TAUCS_USE_FILE} )
|
||||
endif(TAUCS_FOUND)
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
|
||||
if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
||||
|
||||
|
|
@ -71,21 +86,15 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
|||
|
||||
include_directories ( ${QGLVIEWER_INCLUDE_DIR} )
|
||||
|
||||
# Link with BLAS, LAPACK and TAUCS (optional)
|
||||
if(TAUCS_FOUND)
|
||||
include( ${TAUCS_USE_FILE} )
|
||||
add_definitions(-DCGAL_TAUCS_ENABLED)
|
||||
else(TAUCS_FOUND)
|
||||
message(STATUS "NOTICE: TAUCS is not found. parametrization will not be available.")
|
||||
endif(TAUCS_FOUND)
|
||||
# Parameterization needs Eigen3 or TAUCS
|
||||
if(NOT EIGEN3_FOUND AND NOT TAUCS_FOUND)
|
||||
message(STATUS "NOTICE: Eigen 3 and TAUCS is not found. parametrization will not be available.")
|
||||
endif(NOT EIGEN3_FOUND AND NOT TAUCS_FOUND)
|
||||
|
||||
# Link with BLAS and LAPACK only (optional)
|
||||
if(LAPACK_FOUND)
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
add_definitions(-DCGAL_LAPACK_ENABLED)
|
||||
else(LAPACK_FOUND)
|
||||
message(STATUS "NOTICE: LAPACK is not found. curvatures estimation will not be available.")
|
||||
endif(LAPACK_FOUND)
|
||||
# Curvature estimation needs Eigen3 or LAPACK
|
||||
if(NOT EIGEN3_FOUND AND NOT LAPACK_FOUND)
|
||||
message(STATUS "NOTICE: Eigen 3 and LAPACK is not found. curvatures estimation will not be available.")
|
||||
endif(NOT EIGEN3_FOUND AND NOT LAPACK_FOUND)
|
||||
|
||||
qt4_wrap_ui( MainWindowUI_files MainWindow.ui )
|
||||
qt4_wrap_ui( Show_point_dialogUI_FILES Show_point_dialog.ui )
|
||||
|
|
@ -158,11 +167,11 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
|||
Scene_edit_polyhedron_item.cpp Scene_edit_polyhedron_item.moc)
|
||||
target_link_libraries(scene_edit_polyhedron_item scene_polyhedron_item demo_framework)
|
||||
|
||||
if(TAUCS_FOUND)
|
||||
if(EIGEN3_FOUND OR TAUCS_FOUND)
|
||||
add_library(scene_textured_polyhedron_item SHARED
|
||||
Scene_textured_polyhedron_item.cpp texture.cpp Scene_textured_polyhedron_item.moc)
|
||||
target_link_libraries(scene_textured_polyhedron_item demo_framework)
|
||||
endif(TAUCS_FOUND)
|
||||
endif(EIGEN3_FOUND OR TAUCS_FOUND)
|
||||
|
||||
add_library(scene_polygon_soup_item SHARED
|
||||
Scene_polygon_soup_item.cpp Scene_polygon_soup_item.moc)
|
||||
|
|
@ -194,7 +203,7 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
|||
# Viewer_moc.cpp
|
||||
${MainWindowUI_files} ${RESOURCE_FILES} )
|
||||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Polyhedron_3 )
|
||||
if(TAUCS_FOUND)
|
||||
if(EIGEN3_FOUND OR TAUCS_FOUND)
|
||||
# add_executable( Polyhedron_3 Scene_tex_rendering.cpp Scene_tex_polyhedron_operations.cpp )
|
||||
endif()
|
||||
# else(POLYHEDRON_DEMO_ENABLE_FORWARD_DECL)
|
||||
|
|
@ -297,10 +306,10 @@ if(CGAL_Qt4_FOUND AND QT4_FOUND AND OPENGL_FOUND AND QGLVIEWER_FOUND)
|
|||
polyhedron_demo_plugin(pca_plugin Polyhedron_demo_pca_plugin)
|
||||
target_link_libraries(pca_plugin scene_polyhedron_item scene_basic_objects)
|
||||
|
||||
if(TAUCS_FOUND)
|
||||
if(EIGEN3_FOUND OR TAUCS_FOUND)
|
||||
polyhedron_demo_plugin(parameterization_plugin Polyhedron_demo_parameterization_plugin)
|
||||
target_link_libraries(parameterization_plugin scene_polyhedron_item scene_textured_polyhedron_item )
|
||||
endif(TAUCS_FOUND)
|
||||
endif(EIGEN3_FOUND OR TAUCS_FOUND)
|
||||
|
||||
polyhedron_demo_plugin(self_intersection_plugin Polyhedron_demo_self_intersection_plugin)
|
||||
target_link_libraries(self_intersection_plugin scene_polyhedron_item)
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@
|
|||
mesh. Such curvature related features are curves: ridges or
|
||||
crests, and points: umbilics.}
|
||||
|
||||
\ccPkgDependsOn{Solvers as \ccThirdPartyLapack\ and
|
||||
\ccThirdPartyBlas.}
|
||||
\ccPkgDependsOn{either \ccThirdPartyEigen, or \ccThirdPartyLapack\ and \ccThirdPartyBlas for solvers.}
|
||||
|
||||
\ccPkgIntroducedInCGAL{3.3} \ccPkgLicense{\ccLicenseQPL}
|
||||
\ccPkgIllustration{Ridges_3/RidgesMechPartDetail.png}{Ridges_3/mecanic-sub1_crestTweight1Tsharp7-jpg.png}
|
||||
|
|
|
|||
|
|
@ -37,8 +37,8 @@ algorithms; such quantities may be computed by the package {\em
|
|||
Estimation of Local Differential Properties of Sampled Surfaces via
|
||||
Polynomial Fitting}.
|
||||
|
||||
Note that this package needs the third party libraries
|
||||
\ccThirdPartyLapack\ and \ccThirdPartyBlas\ for linear algebra operations.
|
||||
Note that this package needs either the third party library \ccThirdPartyEigen,
|
||||
or the third party libraries \ccThirdPartyLapack\ and \ccThirdPartyBlas\ for linear algebra operations.
|
||||
|
||||
\subsection{Overview}
|
||||
%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
|
|
|||
|
|
@ -17,12 +17,19 @@ if ( CGAL_FOUND )
|
|||
include( ${CGAL_USE_FILE} )
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
# Link with BLAS and LAPACK (required)
|
||||
# use either Eigen or BLAS/LAPACK
|
||||
find_package(Eigen3)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
find_package(LAPACK)
|
||||
if(LAPACK_FOUND)
|
||||
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
endif(LAPACK_FOUND)
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
|
||||
if(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
# Link with Boost.ProgramOptions (optional)
|
||||
find_package(Boost QUIET COMPONENTS program_options)
|
||||
if(Boost_PROGRAM_OPTIONS_FOUND)
|
||||
|
|
@ -41,11 +48,11 @@ if ( CGAL_FOUND )
|
|||
add_to_cached_list( CGAL_EXECUTABLE_TARGETS Compute_Ridges_Umbilics )
|
||||
target_link_libraries(Compute_Ridges_Umbilics ${CGAL_LIBRARIES})
|
||||
|
||||
else(LAPACK_FOUND)
|
||||
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
message(STATUS "NOTICE: This program requires LAPACK, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This program requires either Eigen 3 (or greater) or LAPACK, and will not be compiled.")
|
||||
|
||||
endif(LAPACK_FOUND)
|
||||
endif(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
else()
|
||||
|
||||
|
|
|
|||
|
|
@ -21,20 +21,27 @@ if ( CGAL_FOUND )
|
|||
|
||||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
# Link with BLAS and LAPACK (required)
|
||||
# use either Eigen or BLAS/LAPACK
|
||||
find_package(Eigen3)
|
||||
if (NOT EIGEN3_FOUND)
|
||||
find_package(LAPACK)
|
||||
|
||||
if(LAPACK_FOUND)
|
||||
|
||||
include( ${LAPACK_USE_FILE} )
|
||||
endif(LAPACK_FOUND)
|
||||
else()
|
||||
include( ${EIGEN3_USE_FILE} )
|
||||
endif()
|
||||
|
||||
|
||||
if(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
create_single_source_cgal_program( "ridge_test.cpp" )
|
||||
|
||||
else(LAPACK_FOUND)
|
||||
else(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
message(STATUS "NOTICE: This program requires LAPACK, and will not be compiled.")
|
||||
message(STATUS "NOTICE: This program requires either Eigen 3 (or greater) or LAPACK, and will not be compiled.")
|
||||
|
||||
endif(LAPACK_FOUND)
|
||||
endif(EIGEN3_FOUND OR LAPACK_FOUND)
|
||||
|
||||
else()
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
namespace CGAL {
|
||||
|
||||
|
||||
/// The class Eigen_matrix
|
||||
/// The class Eigen_sparse_matrix
|
||||
/// is a C++ wrapper around Eigen' matrix type SparseMatrix<>.
|
||||
///
|
||||
/// This kind of matrix can be either symmetric or not. Symmetric
|
||||
|
|
@ -39,7 +39,7 @@ namespace CGAL {
|
|||
/// @param T Number type.
|
||||
|
||||
template<class T>
|
||||
struct Eigen_matrix
|
||||
struct Eigen_sparse_matrix
|
||||
{
|
||||
// Public types
|
||||
public:
|
||||
|
|
@ -51,7 +51,7 @@ public:
|
|||
public:
|
||||
|
||||
/// Create a square matrix initialized with zeros.
|
||||
Eigen_matrix(int dim, ///< Matrix dimension.
|
||||
Eigen_sparse_matrix(int dim, ///< Matrix dimension.
|
||||
bool is_symmetric = false) ///< Symmetric/hermitian?
|
||||
: m_dynamic(dim,dim), m_matrix(dim,dim)
|
||||
{
|
||||
|
|
@ -63,7 +63,7 @@ public:
|
|||
/// Create a rectangular matrix initialized with zeros.
|
||||
///
|
||||
/// @commentheading Precondition: rows == columns if is_symmetric is true.
|
||||
Eigen_matrix(int rows, ///< Number of rows.
|
||||
Eigen_sparse_matrix(int rows, ///< Number of rows.
|
||||
int columns, ///< Number of columns.
|
||||
bool is_symmetric = false) ///< Symmetric/hermitian?
|
||||
: m_dynamic(rows,columns), m_matrix(rows,columns)
|
||||
|
|
@ -78,7 +78,7 @@ public:
|
|||
}
|
||||
|
||||
/// Delete this object and the wrapped TAUCS matrix.
|
||||
~Eigen_matrix()
|
||||
~Eigen_sparse_matrix()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ public:
|
|||
/// Write access to a matrix coefficient: a_ij <- val.
|
||||
///
|
||||
/// Optimizations:
|
||||
/// - For symmetric matrices, Eigen_matrix stores only the lower triangle
|
||||
/// - For symmetric matrices, Eigen_sparse_matrix stores only the lower triangle
|
||||
/// set_coef() does nothing if (i, j) belongs to the upper triangle.
|
||||
/// - Caller can optimize this call by setting 'new_coef' to true
|
||||
/// if the coefficient does not already exist in the matrix.
|
||||
|
|
@ -126,9 +126,9 @@ public:
|
|||
private:
|
||||
|
||||
|
||||
/// Eigen_matrix cannot be copied (yet)
|
||||
Eigen_matrix(const Eigen_matrix& rhs);
|
||||
Eigen_matrix& operator=(const Eigen_matrix& rhs);
|
||||
/// Eigen_sparse_matrix cannot be copied (yet)
|
||||
Eigen_sparse_matrix(const Eigen_sparse_matrix& rhs);
|
||||
Eigen_sparse_matrix& operator=(const Eigen_sparse_matrix& rhs);
|
||||
|
||||
// Fields
|
||||
private:
|
||||
|
|
@ -140,11 +140,11 @@ private:
|
|||
// Symmetric/hermitian?
|
||||
bool m_is_symmetric;
|
||||
|
||||
}; // Taucs_matrix
|
||||
}; // Eigen_sparse_matrix
|
||||
|
||||
|
||||
|
||||
/// The class Eigen_symmetric_matrix is a C++ wrapper
|
||||
/// The class Eigen_sparse_symmetric_matrix is a C++ wrapper
|
||||
/// around a Eigen sparse matrix (type Eigen::SparseMatrix).
|
||||
///
|
||||
/// Symmetric matrices store only the lower triangle.
|
||||
|
|
@ -155,33 +155,48 @@ private:
|
|||
/// @param T Number type.
|
||||
|
||||
template<class T>
|
||||
struct Eigen_symmetric_matrix
|
||||
: public Eigen_matrix<T>
|
||||
struct Eigen_sparse_symmetric_matrix
|
||||
: public Eigen_sparse_matrix<T>
|
||||
{
|
||||
// Public types
|
||||
public:
|
||||
|
||||
typedef T NT;
|
||||
|
||||
// Public operations
|
||||
public:
|
||||
|
||||
/// Create a square *symmetric* matrix initialized with zeros.
|
||||
Eigen_symmetric_matrix(int dim) ///< Matrix dimension.
|
||||
: Eigen_matrix<T>(dim, true /* symmetric */)
|
||||
Eigen_sparse_symmetric_matrix(int dim) ///< Matrix dimension.
|
||||
: Eigen_sparse_matrix<T>(dim, true /* symmetric */)
|
||||
{
|
||||
}
|
||||
|
||||
/// Create a square *symmetric* matrix initialized with zeros.
|
||||
///
|
||||
/// @commentheading Precondition: rows == columns.
|
||||
Eigen_symmetric_matrix(int rows, ///< Number of rows.
|
||||
Eigen_sparse_symmetric_matrix(int rows, ///< Number of rows.
|
||||
int columns) ///< Number of columns.
|
||||
: Eigen_matrix<T>(rows, columns, true /* symmetric */)
|
||||
: Eigen_sparse_matrix<T>(rows, columns, true /* symmetric */)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template <class FT>
|
||||
struct Eigen_matrix : public ::Eigen::Matrix<FT,::Eigen::Dynamic,::Eigen::Dynamic>
|
||||
{
|
||||
typedef ::Eigen::Matrix<FT,::Eigen::Dynamic,::Eigen::Dynamic> EigenType;
|
||||
Eigen_matrix( std::size_t n1, std::size_t n2):EigenType(n1,n2){}
|
||||
std::size_t number_of_rows () const {return this->rows();}
|
||||
std::size_t number_of_columns () const {return this->cols();}
|
||||
FT operator()( std::size_t i , std::size_t j ) const {return this->operator()(i,j);}
|
||||
void set( std::size_t i, std::size_t j,FT value){
|
||||
this->coeffRef(i,j)=value;
|
||||
}
|
||||
|
||||
const EigenType& eigen_object() const{
|
||||
return static_cast<const EigenType&>(*this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
#endif // CGAL_EIGEN_MATRIX_H
|
||||
|
|
@ -31,6 +31,23 @@
|
|||
namespace CGAL {
|
||||
|
||||
|
||||
namespace internal {
|
||||
template <class EigenSolver,class FT>
|
||||
struct Get_eigen_matrix{
|
||||
typedef Eigen_sparse_matrix<FT> type;
|
||||
};
|
||||
|
||||
template <class FT,class EigenMatrix>
|
||||
struct Get_eigen_matrix< ::Eigen::ConjugateGradient<EigenMatrix>,FT>{
|
||||
typedef Eigen_sparse_symmetric_matrix<FT> type;
|
||||
};
|
||||
|
||||
template <class FT,class EigenMatrix>
|
||||
struct Get_eigen_matrix< ::Eigen::SimplicialCholesky<EigenMatrix>,FT>{
|
||||
typedef Eigen_sparse_symmetric_matrix<FT> type;
|
||||
};
|
||||
} //internal
|
||||
|
||||
/// The class Eigen_solver_traits
|
||||
/// is a generic traits class for solving asymmetric or symmetric positive definite (SPD)
|
||||
/// sparse linear systems using one of the Eigen solvers.
|
||||
|
|
@ -39,16 +56,16 @@ namespace CGAL {
|
|||
///
|
||||
/// @heading Is Model for the Concepts: Model of the SparseLinearAlgebraTraits_d concept.
|
||||
|
||||
template<class EigenSolverT = Eigen::BiCGSTAB<Eigen_matrix<double>::EigenType> >
|
||||
template<class EigenSolverT = Eigen::BiCGSTAB<Eigen_sparse_matrix<double>::EigenType> >
|
||||
class Eigen_solver_traits
|
||||
{
|
||||
typedef typename EigenSolverT::Scalar Scalar;
|
||||
// Public types
|
||||
public:
|
||||
|
||||
typedef Eigen_matrix<Scalar> Matrix;
|
||||
typedef Eigen_vector<Scalar> Vector;
|
||||
typedef Scalar NT;
|
||||
typedef typename internal::Get_eigen_matrix<EigenSolverT,NT>::type Matrix;
|
||||
typedef Eigen_vector<Scalar> Vector;
|
||||
|
||||
|
||||
// Public operations
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2011 INRIA Bordeaux Sud-Ouest (France), All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public License as
|
||||
// published by the Free Software Foundation; version 2.1 of the License.
|
||||
// See the file LICENSE.LGPL distributed with CGAL.
|
||||
//
|
||||
// Licensees holding a valid commercial license may use this file in
|
||||
// accordance with the commercial license agreement provided with the software.
|
||||
//
|
||||
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
||||
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
//
|
||||
// Author(s) : Gael Guennebaud
|
||||
|
||||
#ifndef CGAL_EIGEN_SVD_H
|
||||
#define CGAL_EIGEN_SVD_H
|
||||
|
||||
#include <CGAL/Eigen_matrix.h>
|
||||
#include <CGAL/Eigen_vector.h>
|
||||
#include <Eigen/SVD>
|
||||
|
||||
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
class Eigen_svd{
|
||||
public:
|
||||
typedef double FT;
|
||||
typedef Eigen_vector<FT> Vector;
|
||||
typedef Eigen_matrix<FT> Matrix;
|
||||
//solve MX=B using SVD and return the condition number of M
|
||||
//The solution is stored in B
|
||||
static FT solve(const Matrix& M, Vector& B){
|
||||
Eigen::JacobiSVD<typename Matrix::EigenType> jacobiSvd(M.eigen_object(),::Eigen::ComputeThinU | ::Eigen::ComputeThinV);
|
||||
B.eigen_object()=jacobiSvd.solve(Vector::EigenType(B.eigen_object()));
|
||||
return jacobiSvd.singularValues().array().abs().maxCoeff()/
|
||||
jacobiSvd.singularValues().array().abs().minCoeff();
|
||||
}
|
||||
};
|
||||
|
||||
}//namespace CGAL
|
||||
#endif // CGAL_EIGEN_SVD_H
|
||||
|
|
@ -73,6 +73,13 @@ public:
|
|||
EigenType& eigen_object() {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set(int i,NT value) {
|
||||
this->operator[](i)=value;
|
||||
}
|
||||
|
||||
NT* vector() {return this->data();}
|
||||
|
||||
};
|
||||
|
||||
} //namespace CGAL
|
||||
|
|
|
|||
|
|
@ -114,12 +114,12 @@ Polyhedron* poisson_reconstruct(const Point_set& points,
|
|||
#ifdef CGAL_EIGEN3_ENABLED
|
||||
if(solver_name=="Eigen - built-in simplicial LDLt")
|
||||
{
|
||||
CGAL::Eigen_solver_traits<Eigen::SimplicialCholesky<CGAL::Eigen_matrix<double>::EigenType> > solver;
|
||||
CGAL::Eigen_solver_traits<Eigen::SimplicialCholesky<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
|
||||
ok = function.compute_implicit_function(solver);
|
||||
}
|
||||
if(solver_name=="Eigen - built-in CG")
|
||||
{
|
||||
CGAL::Eigen_solver_traits<Eigen::ConjugateGradient<CGAL::Eigen_matrix<double>::EigenType> > solver;
|
||||
CGAL::Eigen_solver_traits<Eigen::ConjugateGradient<CGAL::Eigen_sparse_matrix<double>::EigenType> > solver;
|
||||
solver.solver().setTolerance(1e-6);
|
||||
solver.solver().setMaxIterations(1000);
|
||||
ok = function.compute_implicit_function(solver);
|
||||
|
|
|
|||
Loading…
Reference in New Issue