Merge branch 'devel'

This commit is contained in:
alemuntoni 2021-07-19 17:46:44 +02:00
commit 8132239bfa
347 changed files with 9520 additions and 6039 deletions

View File

@ -1,12 +1,12 @@
name: BuildSamplesUbuntu
name: BuildExamplesLinux
on:
[push, pull_request]
jobs:
ubuntu_build_tests:
name: Build Samples (Ubuntu)
runs-on: ubuntu-latest #in order to deploy, need to use oldest supported version
name: Build Examples (Linux)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -14,5 +14,7 @@ jobs:
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
mkdir build
cd build
cmake -DVCG_BUILD_EXAMPLES=ON ..
make -j4

View File

@ -1,11 +1,11 @@
name: BuildSamplesMacOS
name: BuildExamplesMacOS
on:
[push, pull_request]
jobs:
macos_build_tests:
name: Build Samples (MacOS)
name: Build Examples (MacOS)
runs-on: macos-latest
steps:
@ -14,5 +14,7 @@ jobs:
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
mkdir build
cd build
cmake -DVCG_BUILD_EXAMPLES=ON ..
make -j4

View File

@ -0,0 +1,31 @@
name: BuildExamplesWindows
on: [push, pull_request]
jobs:
windows_build_tests:
name: Build Examples (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Download Jom
run: |
Invoke-WebRequest -Uri "http://mirrors.ukfast.co.uk/sites/qt.io/official_releases/jom/jom_1_1_3.zip" -OutFile "jom_1_1_3.zip"
New-Item -Name "jom" -ItemType "directory"
Expand-Archive -Path jom_1_1_3.zip -DestinationPath .\jom
echo "$(Get-Location)\jom" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Setup env variables
id: envs
run: |
echo "VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC" >> $GITHUB_ENV
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Install Qt
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
mkdir build
cd build
cmake -G "NMake Makefiles" -DVCG_BUILD_EXAMPLES=ON ..
jom -j4

View File

@ -1,29 +0,0 @@
name: BuildSamplesWindows
on: [push, pull_request]
jobs:
windows_build_tests:
name: Build Samples (Windows)
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Downlaod Jom
run: |
Invoke-WebRequest -Uri "http://download.qt.io/official_releases/jom/jom_1_1_3.zip" -OutFile "jom_1_1_3.zip"
New-Item -Name "jom" -ItemType "directory"
Expand-Archive -Path jom_1_1_3.zip -DestinationPath .\jom
echo "::add-path::$(Get-Location)\jom"
- name: Setup env variables
id: envs
run: |
echo '::set-env name=VCINSTALLDIR::C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC'
- name: Setup MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Install Qt
uses: jurplel/install-qt-action@v2
- name: Build Samples
run: |
qmake apps/sample/sample.pro
jom -j4

302
CMakeLists.txt Normal file
View File

@ -0,0 +1,302 @@
# Copyright 2019, 2020, Collabora, Ltd.
# Copyright 2019, 2021, Visual Computing Lab, ISTI - Italian National Research Council
# SPDX-License-Identifier: BSL-1.0
cmake_minimum_required(VERSION 3.10)
project(VCGLib)
# Eigen options
option(ALLOW_BUNDLED_EIGEN "Allow use of bundled Eigen source" ON)
option(ALLOW_SYSTEM_EIGEN "Allow use of system-provided Eigen" ON)
# VCG options
option(VCG_HEADER_ONLY "Use VCG library in header only mode" ON)
option(VCG_BUILD_EXAMPLES "Build a set of examples of the library" OFF)
set (VCG_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR})
set (VCG_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR} PARENT_SCOPE)
### Build settings
set(CMAKE_CXX_STANDARD 11)
### Eigen
set(VCG_EIGEN_DIR ${CMAKE_CURRENT_LIST_DIR}/eigenlib)
if(ALLOW_SYSTEM_EIGEN AND EIGEN3_INCLUDE_DIR)
message(STATUS "- Eigen - using system-provided library")
set(EIGEN_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
elseif(ALLOW_BUNDLED_EIGEN AND EXISTS "${VCG_EIGEN_DIR}/Eigen/Eigen")
message(STATUS "- Eigen - using bundled source")
set(EIGEN_INCLUDE_DIRS ${VCG_EIGEN_DIR})
else()
message(
FATAL_ERROR
"Eigen is required - at least one of ALLOW_SYSTEM_EIGEN or ALLOW_BUNDLED_EIGEN must be enabled and found.")
endif()
### VCGLib headers and sources
set(VCG_HEADERS
vcg/complex/append.h
vcg/complex/all_types.h
vcg/complex/complex.h
vcg/complex/allocate.h
vcg/complex/exception.h
vcg/complex/algorithms/overlap_estimation.h
vcg/complex/algorithms/dual_meshing.h
vcg/complex/algorithms/intersection.h
vcg/complex/algorithms/clip.h
vcg/complex/algorithms/geodesic.h
vcg/complex/algorithms/parametrization/poisson_solver.h
vcg/complex/algorithms/parametrization/uv_utils.h
vcg/complex/algorithms/parametrization/distortion.h
vcg/complex/algorithms/parametrization/tangent_field_operators.h
vcg/complex/algorithms/parametrization/voronoi_atlas.h
vcg/complex/algorithms/edge_collapse.h
vcg/complex/algorithms/hole.h
vcg/complex/algorithms/align_pair.h
vcg/complex/algorithms/closest.h
vcg/complex/algorithms/tetra_implicit_smooth.h
vcg/complex/algorithms/bitquad_support.h
vcg/complex/algorithms/skeleton.h
vcg/complex/algorithms/symmetry.h
vcg/complex/algorithms/voronoi_volume_sampling.h
vcg/complex/algorithms/polygon_polychord_collapse.h
vcg/complex/algorithms/inside.h
vcg/complex/algorithms/local_optimization/tri_edge_flip.h
vcg/complex/algorithms/local_optimization/quad_diag_collapse.h
vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric.h
vcg/complex/algorithms/local_optimization/tri_edge_collapse_quadric_tex.h
vcg/complex/algorithms/local_optimization/tri_edge_collapse.h
vcg/complex/algorithms/local_optimization/tetra_edge_collapse.h
vcg/complex/algorithms/polygonal_algorithms.h
vcg/complex/algorithms/inertia.h
vcg/complex/algorithms/mesh_assert.h
vcg/complex/algorithms/cut_tree.h
vcg/complex/algorithms/nring.h
vcg/complex/algorithms/tetra/tetfuse_collapse.h
vcg/complex/algorithms/stat.h
vcg/complex/algorithms/ransac_matching.h
vcg/complex/algorithms/refine.h
vcg/complex/algorithms/outline_support.h
vcg/complex/algorithms/convex_hull.h
vcg/complex/algorithms/clean.h
vcg/complex/algorithms/mesh_to_matrix.h
vcg/complex/algorithms/quadrangulator.h
vcg/complex/algorithms/isotropic_remeshing.h
vcg/complex/algorithms/smooth.h
vcg/complex/algorithms/autoalign_4pcs.h
vcg/complex/algorithms/local_optimization.h
vcg/complex/algorithms/curve_on_manifold.h
vcg/complex/algorithms/clustering.h
vcg/complex/algorithms/refine_loop.h
vcg/complex/algorithms/cylinder_clipping.h
vcg/complex/algorithms/pointcloud_normal.h
vcg/complex/algorithms/bitquad_creation.h
vcg/complex/algorithms/crease_cut.h
vcg/complex/algorithms/implicit_smooth.h
vcg/complex/algorithms/voronoi_remesher.h
vcg/complex/algorithms/polygon_support.h
vcg/complex/algorithms/point_sampling.h
vcg/complex/algorithms/create/mc_lookup_table.h
vcg/complex/algorithms/create/mc_trivial_walker.h
vcg/complex/algorithms/create/extrude.h
vcg/complex/algorithms/create/resampler.h
vcg/complex/algorithms/create/ball_pivoting.h
vcg/complex/algorithms/create/readme.txt
vcg/complex/algorithms/create/zonohedron.h
vcg/complex/algorithms/create/platonic.h
vcg/complex/algorithms/create/marching_cubes.h
vcg/complex/algorithms/create/plymc/voxel.h
vcg/complex/algorithms/create/plymc/simplemeshprovider.h
vcg/complex/algorithms/create/plymc/tri_edge_collapse_mc.h
vcg/complex/algorithms/create/plymc/volume.h
vcg/complex/algorithms/create/plymc/plymc.h
vcg/complex/algorithms/create/plymc/svoxel.h
vcg/complex/algorithms/create/tetramesh_support.h
vcg/complex/algorithms/create/advancing_front.h
vcg/complex/algorithms/textcoord_optimization.h
vcg/complex/algorithms/bitquad_optimization.h
vcg/complex/algorithms/halfedge_quad_clean.h
vcg/complex/algorithms/voronoi_processing.h
vcg/complex/algorithms/update/quality.h
vcg/complex/algorithms/update/selection.h
vcg/complex/algorithms/update/fitmaps.h
vcg/complex/algorithms/update/component_ep.h
vcg/complex/algorithms/update/texture.h
vcg/complex/algorithms/update/curvature_fitting.h
vcg/complex/algorithms/update/normal.h
vcg/complex/algorithms/update/position.h
vcg/complex/algorithms/update/halfedge_topology.h
vcg/complex/algorithms/update/topology.h
vcg/complex/algorithms/update/flag.h
vcg/complex/algorithms/update/bounding.h
vcg/complex/algorithms/update/halfedge_indexed.h
vcg/complex/algorithms/update/color.h
vcg/complex/algorithms/update/curvature.h
vcg/complex/algorithms/point_outlier.h
vcg/complex/algorithms/harmonic.h
vcg/complex/algorithms/point_matching_scale.h
vcg/complex/algorithms/attribute_seam.h
vcg/complex/foreach.h
vcg/complex/base.h
vcg/complex/used_types.h
vcg/container/entries_allocation_table.h
vcg/container/container_allocation_table.h
vcg/container/derivation_chain.h
vcg/container/vector_occ.h
vcg/container/simple_temporary_data.h
vcg/space/segment2.h
vcg/space/fitting3.h
vcg/space/tetra3.h
vcg/space/triangle2.h
vcg/space/ray2.h
vcg/space/deprecated_point2.h
vcg/space/point4.h
vcg/space/box2.h
vcg/space/ray3.h
vcg/space/planar_polygon_tessellation.h
vcg/space/texcoord2.h
vcg/space/deprecated_point3.h
vcg/space/intersection/triangle_triangle3.h
vcg/space/distance2.h
vcg/space/point3.h
vcg/space/deprecated_point.h
vcg/space/space.h
vcg/space/point.h
vcg/space/colorspace.h
vcg/space/rect_packer.h
vcg/space/triangle3.h
vcg/space/obox3.h
vcg/space/point2.h
vcg/space/smallest_enclosing.h
vcg/space/color4.h
vcg/space/polygon3.h
vcg/space/line3.h
vcg/space/index/octree.h
vcg/space/index/grid_util2d.h
vcg/space/index/grid_closest.h
vcg/space/index/grid_static_ptr.h
vcg/space/index/grid_util.h
vcg/space/index/spatial_hashing.h
vcg/space/index/closest2d.h
vcg/space/index/grid_static_obj.h
vcg/space/index/kdtree/kdtree.h
vcg/space/index/kdtree/priorityqueue.h
vcg/space/index/kdtree/kdtree_face.h
vcg/space/index/kdtree/mlsutils.h
vcg/space/index/octree_template.h
vcg/space/index/aabb_binary_tree/kclosest.h
vcg/space/index/aabb_binary_tree/closest.h
vcg/space/index/aabb_binary_tree/ray.h
vcg/space/index/aabb_binary_tree/frustum_cull.h
vcg/space/index/aabb_binary_tree/aabb_binary_tree.h
vcg/space/index/aabb_binary_tree/base.h
vcg/space/index/grid_closest2d.h
vcg/space/index/spatial_hashing2d.h
vcg/space/index/space_iterators.h
vcg/space/index/grid_static_ptr2d.h
vcg/space/index/base2d.h
vcg/space/index/base.h
vcg/space/index/perfect_spatial_hashing.h
vcg/space/index/space_iterators2d.h
vcg/space/line2.h
vcg/space/point_matching.h
vcg/space/intersection3.h
vcg/space/deprecated_point4.h
vcg/space/rasterized_outline2_packer.h
vcg/space/box.h
vcg/space/plane3.h
vcg/space/outline2_packer.h
vcg/space/segment3.h
vcg/space/intersection2.h
vcg/space/sphere3.h
vcg/space/box3.h
vcg/space/distance3.h
vcg/math/quadric5.h
vcg/math/factorial.h
vcg/math/eigen_matrix_addons.h
vcg/math/quadric.h
vcg/math/perlin_noise.h
vcg/math/shot.h
vcg/math/spherical_harmonics.h
vcg/math/eigen_matrixbase_addons.h
vcg/math/quaternion.h
vcg/math/similarity.h
vcg/math/disjoint_set.h
vcg/math/random_generator.h
vcg/math/camera.h
vcg/math/linear.h
vcg/math/matrix44.h
vcg/math/eigen.h
vcg/math/old_lin_algebra.h
vcg/math/similarity2.h
vcg/math/gen_normal.h
vcg/math/old_matrix44.h
vcg/math/old_deprecated_matrix.h
vcg/math/old_matrix33.h
vcg/math/polar_decomposition.h
vcg/math/base.h
vcg/math/histogram.h
vcg/math/legendre.h
vcg/math/matrix33.h
vcg/math/old_matrix.h
vcg/simplex/edge/distance.h
vcg/simplex/edge/topology.h
vcg/simplex/edge/pos.h
vcg/simplex/edge/component.h
vcg/simplex/edge/base.h
vcg/simplex/tetrahedron/tetrahedron.h
vcg/simplex/tetrahedron/topology.h
vcg/simplex/tetrahedron/pos.h
vcg/simplex/tetrahedron/component.h
vcg/simplex/tetrahedron/base.h
vcg/simplex/face/component_occ.h
vcg/simplex/face/component_ep.h
vcg/simplex/face/jumping_pos.h
vcg/simplex/face/distance.h
vcg/simplex/face/component_polygon.h
vcg/simplex/face/topology.h
vcg/simplex/face/pos.h
vcg/simplex/face/component.h
vcg/simplex/face/component_ocf.h
vcg/simplex/face/base.h
vcg/simplex/vertex/component_occ.h
vcg/simplex/vertex/component_sph.h
vcg/simplex/vertex/distance.h
vcg/simplex/vertex/component.h
vcg/simplex/vertex/component_ocf.h
vcg/simplex/vertex/base.h
vcg/connectors/halfedge_pos.h
vcg/connectors/hedge.h
vcg/connectors/hedge_component.h
#wrap
wrap/callback.h
)
set(SOURCES
)
if (VCG_HEADER_ONLY)
if (NOT TARGET vcglib) # to be sure that vcglib target is created just one time
add_library(vcglib INTERFACE)
target_include_directories(
vcglib INTERFACE
${CMAKE_CURRENT_LIST_DIR}
${EIGEN_INCLUDE_DIRS})
#just to show headers in ide
add_custom_target(vcglib_ide SOURCES ${VCG_HEADERS})
else()
message(STATUS "- VCGLib - jumped - already included")
endif()
else()
#TODO make vcglib that includes all the wrap sources, checking everytime
# if the the required targets (e.g. qt, gl, glew...) exists
endif()
if(VCG_BUILD_EXAMPLES)
#TODO make the list of samples to build
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/apps)
endif()

View File

@ -1,8 +1,8 @@
The **_Visualization and Computer Graphics Library_** (VCGlib for short) is a open source, portable, C++, templated, no dependency, library for manipulation, processing, cleaning, simplifying triangle meshes.
![BuildSamplesUbuntu](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesUbuntu/badge.svg)
![BuildSamplesMacOS](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesMacOS/badge.svg)
![BuildSamplesWindows](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildSamplesWindows/badge.svg)
![BuildExamplesLinux](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesLinux/badge.svg)
![BuildExamplesMacOS](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesMacOS/badge.svg)
![BuildExamplesWindows](https://github.com/cnr-isti-vclab/vcglib/workflows/BuildExamplesWindows/badge.svg)
The library, composed by more than 100k lines of code, is released under the GPL license, and it is the base of most of the software tools of the [Visual Computing Lab](http://vcg.isti.cnr.it) of the Italian National Research Council Institute ISTI, like MeshLab, metro and many others.

View File

@ -1,9 +1,7 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
include_directories(../)
include_directories(../eigenlib)
cmake_minimum_required(VERSION 3.13)
project(VCGApps)
add_subdirectory(sample)
add_subdirectory(metro)
add_subdirectory(tridecimator)

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -64,10 +64,10 @@ class CMesh : public vcg::tri::TriMesh< std::vector<CVertex>, std::vector<CFac
class GLArea:public QGLWidget
{
Q_OBJECT
Q_OBJECT
public:
GLArea (QWidget * parent = 0);
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
enum DrawMode{SMOOTH=0,POINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
public slots:
/// widget-based user interaction slots
@ -89,7 +89,7 @@ protected:
void mousePressEvent(QMouseEvent*e);
void mouseMoveEvent(QMouseEvent*e);
void mouseReleaseEvent(QMouseEvent*e);
void wheelEvent(QWheelEvent*e);
void wheelEvent(QWheelEvent*e);
private:
/// the active mesh instance
CMesh mesh;

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -65,13 +65,13 @@ public:
class GLArea:public QGLWidget
{
Q_OBJECT
Q_OBJECT
public:
GLArea (SharedDataOpenGLContext* sharedcontext,MainWindow* parent);
~GLArea();
void resetTrackBall();
//unsigned int getId() const {return areaid;}
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
signals:
/// signal for setting the statusbar message
@ -88,7 +88,7 @@ protected:
void mousePressEvent(QMouseEvent*e);
void mouseMoveEvent(QMouseEvent*e);
void mouseReleaseEvent(QMouseEvent*e);
void wheelEvent(QWheelEvent*e);
void wheelEvent(QWheelEvent*e);
private:
MainWindow* parwin;

View File

@ -8,7 +8,7 @@
* \ *
* All rights reserved. *
* *
* This program is free software; you can redistribute it and/or modify *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
@ -24,7 +24,7 @@
/**
* Minimal trimesh viewer made with AntTweakBar and freglut
*
* This sample shows how to use togheter:
* This sample shows how to use togheter:
* - the trimesh loading and initialization
* - basic usage of the default manipulators (the "Trackball")
*/
@ -75,7 +75,7 @@ vcg::Trackball track;
/// window size
int width,height;
/// we choosed a subset of the avaible drawing modes
/// we chose a subset of the available drawing modes
enum DrawMode{SMOOTH=0,PERPOINTS,WIRE,FLATWIRE,HIDDEN,FLAT};
/// the current drawmode
@ -101,7 +101,7 @@ static vcg::Trackball::Button GLUT2VCG (int glut_button, int )
return vcg::Trackball::Button (vcgbt);
}
@ -124,29 +124,29 @@ void Display(){
glPushMatrix();
float d=1.0f/mesh.bbox.Diag();
vcg::glScale(d);
glTranslate(-glWrap.m->bbox.Center());
glTranslate(-glWrap.m->bbox.Center());
// the trimesh drawing calls
switch(drawmode)
{
case SMOOTH:
case SMOOTH:
glWrap.Draw<vcg::GLW::DMSmooth, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case PERPOINTS:
case PERPOINTS:
glWrap.Draw<vcg::GLW::DMPoints, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case WIRE:
case WIRE:
glWrap.Draw<vcg::GLW::DMWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case FLATWIRE:
case FLATWIRE:
glWrap.Draw<vcg::GLW::DMFlatWire, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case HIDDEN:
case HIDDEN:
glWrap.Draw<vcg::GLW::DMHidden, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
case FLAT:
case FLAT:
glWrap.Draw<vcg::GLW::DMFlat, vcg::GLW::CMNone,vcg::GLW::TMNone> ();
break;
default:
default:
break;
}
@ -185,7 +185,7 @@ void initMesh()
}
void TW_CALL loadMesh(void *)
{
{
if(filename==0) return;
int err=vcg::tri::io::ImporterPLY<CMesh>::Open(mesh,(char*)filename);
if(err!=0){
@ -276,7 +276,7 @@ int main(int argc, char *argv[])
// (note that AntTweakBar could also be intialized after GLUT, no matter)
if( !TwInit(TW_OPENGL, NULL) )
{
// A fatal error occured
// A fatal error occured
fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError());
return 1;
}
@ -311,12 +311,12 @@ int main(int argc, char *argv[])
glutKeyboardFunc(keyPressEvent);
glutKeyboardUpFunc(keyReleaseEvent);
glutMouseWheelFunc(wheelEvent);
bar = TwNewBar("TweakBar");
TwCopyCDStringToClientFunc (CopyCDStringToClient);
TwAddVarRW(bar,"Input",TW_TYPE_CDSTRING,&filename," label='Filepath' group=SetMesh help=` Name of the file to load` ");
TwAddButton(bar,"Load from file",loadMesh,0, " label='Load Mesh' group=SetMesh help=`load the mesh` ");
TwAddButton(bar,"Use tetrahedron",loadTetrahedron,0, " label='Make Tetrahedron' group=SetMesh help=`use tetrahedron.` ");

View File

@ -1,2 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project (metro)
add_executable(metro metro.cpp ../../wrap/ply/plylib.cpp)
if (VCG_HEADER_ONLY)
set(SOURCES
metro.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(metro
${SOURCES})
target_link_libraries(
metro
PUBLIC
vcglib
)

View File

@ -112,7 +112,7 @@ template<class TriMeshType>
// ALNParser::ParseALN(rmaps, alnName);
// for(size_t i=0; i<rmaps.size(); i++)
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].trasformation, rmaps[i].quality);
// AddSingleMesh(rmaps[i].filename.c_str(), rmaps[i].transformation, rmaps[i].quality);
return true;
}

View File

@ -0,0 +1,64 @@
cmake_minimum_required(VERSION 3.13)
project(VCGExamples)
set(VCG_EXAMPLE_PROJECTS
aabb_binary_tree
colorspace
polygonmesh_base
polygonmesh_dual
polygonmesh_optimize
polygonmesh_polychord_collapse
polygonmesh_smooth
space_index_2d
space_packer
space_rasterized_packer
trimesh_align_pair
trimesh_allocate
trimesh_attribute
trimesh_attribute_saving
trimesh_ball_pivoting
trimesh_base
trimesh_closest
trimesh_clustering
trimesh_color
trimesh_copy
trimesh_create
trimesh_curvature
trimesh_cylinder_clipping
trimesh_disk_parametrization
trimesh_fitting
trimesh_geodesic
trimesh_harmonic
trimesh_hole
trimesh_implicit_smooth
trimesh_indexing
trimesh_inertia
trimesh_intersection_plane
trimesh_intersection_mesh
trimesh_isosurface
trimesh_join
trimesh_kdtree
trimesh_montecarlo_sampling
trimesh_normal
trimesh_optional
trimesh_pointmatching
trimesh_pointcloud_sampling
trimesh_ray
trimesh_refine
trimesh_remeshing
trimesh_sampling
trimesh_select
trimesh_smooth
trimesh_split_vertex
trimesh_texture
trimesh_texture_clean
trimesh_topology
trimesh_topological_cut
trimesh_voronoi
trimesh_voronoiatlas
trimesh_voronoiclustering
trimesh_voronoisampling)
foreach(VCG_EXAMPLE ${VCG_EXAMPLE_PROJECTS})
add_subdirectory(${VCG_EXAMPLE})
endforeach()

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.13)
project(aabb_binary_tree)
set(SOURCES
aabb_binary_tree.cpp)
add_executable(aabb_binary_tree
${SOURCES})
target_link_libraries(
aabb_binary_tree
PUBLIC
vcglib
)

View File

@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 3.13)
project(colorspace)
set(SOURCES
colorspace.cpp)
add_executable(colorspace
${SOURCES})
target_link_libraries(
colorspace
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_base)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_base
${SOURCES})
target_link_libraries(
polygonmesh_base
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_dual)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_dual.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_dual
${SOURCES})
target_link_libraries(
polygonmesh_dual
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_optimize)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_optimize.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_optimize
${SOURCES})
target_link_libraries(
polygonmesh_optimize
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_polychord_collapse)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_polychord_collapse.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_polychord_collapse
${SOURCES})
target_link_libraries(
polygonmesh_polychord_collapse
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(polygonmesh_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
polygonmesh_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(polygonmesh_smooth
${SOURCES})
target_link_libraries(
polygonmesh_smooth
PUBLIC
vcglib
)

View File

@ -60,4 +60,4 @@ SUBDIRS = \
trimesh_voronoi \
trimesh_voronoiatlas \
trimesh_voronoiclustering \
trimesh_voronoisampling \
trimesh_voronoisampling

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(space_index_2d)
if (VCG_HEADER_ONLY)
set(SOURCES
space_index_2d.cpp)
endif()
add_executable(space_index_2d
${SOURCES})
target_link_libraries(
space_index_2d
PUBLIC
vcglib
)

View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.13)
project(space_packer)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
space_packer.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(space_packer
${SOURCES})
target_link_libraries(
space_packer
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping space_packer example")
endif()

View File

@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.13)
project(space_rasterized_packer)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
space_rasterized_packer.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(space_rasterized_packer
${SOURCES})
target_link_libraries(
space_rasterized_packer
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping space_rasterized_packer example")
endif()

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_align_pair)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_align_pair.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_align_pair
${SOURCES})
target_link_libraries(
trimesh_align_pair
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_allocate)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_allocate.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_allocate
${SOURCES})
target_link_libraries(
trimesh_allocate
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_attribute)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_attribute.cpp)
endif()
add_executable(trimesh_attribute
${SOURCES})
target_link_libraries(
trimesh_attribute
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_attribute_saving)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_attribute_saving.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_attribute_saving
${SOURCES})
target_link_libraries(
trimesh_attribute_saving
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_ball_pivoting)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_ball_pivoting.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_ball_pivoting
${SOURCES})
target_link_libraries(
trimesh_ball_pivoting
PUBLIC
vcglib
)

View File

@ -1,8 +1,16 @@
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON) #...is required...
set(CMAKE_CXX_EXTENSIONS OFF) #...without compiler extensions like gnu++11
project (trimesh_base)
add_executable(trimesh_base trimesh_base.cpp)
include_directories(../../..)
include_directories(../../../eigenlib)
cmake_minimum_required(VERSION 3.13)
project(trimesh_base)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_base.cpp)
endif()
add_executable(trimesh_base
${SOURCES})
target_link_libraries(
trimesh_base
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_closest)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_closest.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_closest
${SOURCES})
target_link_libraries(
trimesh_closest
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_clustering)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_clustering.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_clustering
${SOURCES})
target_link_libraries(
trimesh_clustering
PUBLIC vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_color)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_color.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_color
${SOURCES})
target_link_libraries(
trimesh_color
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_copy)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_copy.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_copy
${SOURCES})
target_link_libraries(
trimesh_copy
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_create)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_create.cpp)
endif()
add_executable(trimesh_create
${SOURCES})
target_link_libraries(
trimesh_create
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_curvature)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_curvature.cpp)
endif()
add_executable(trimesh_curvature
${SOURCES})
target_link_libraries(
trimesh_curvature
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_cylinder_clipping)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_cylinder_clipping.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_cylinder_clipping
${SOURCES})
target_link_libraries(
trimesh_cylinder_clipping
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_disk_parametrization)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_disk_parametrization.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_disk_parametrization
${SOURCES})
target_link_libraries(
trimesh_disk_parametrization
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_fitting)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_fitting.cpp)
endif()
add_executable(trimesh_fitting
${SOURCES})
target_link_libraries(
trimesh_fitting
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_geodesic)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_geodesic.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_geodesic
${SOURCES})
target_link_libraries(
trimesh_geodesic
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_harmonic)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_harmonic.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_harmonic
${SOURCES})
target_link_libraries(
trimesh_harmonic
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_hole)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_hole.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_hole
${SOURCES})
target_link_libraries(
trimesh_hole
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_implicit_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_implicit_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_implicit_smooth
${SOURCES})
target_link_libraries(
trimesh_implicit_smooth
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_indexing)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_indexing.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_indexing
${SOURCES})
target_link_libraries(
trimesh_indexing
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_inertia)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_inertia.cpp)
endif()
add_executable(trimesh_inertia
${SOURCES})
target_link_libraries(
trimesh_inertia
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_intersection_mesh)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_intersection_mesh.cpp)
endif()
add_executable(trimesh_intersection_mesh
${SOURCES})
target_link_libraries(
trimesh_intersection_mesh
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_intersection_plane)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_intersection_plane.cpp)
endif()
add_executable(trimesh_intersection_plane
${SOURCES})
target_link_libraries(
trimesh_intersection_plane
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_isosurface)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_isosurface.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_isosurface
${SOURCES})
target_link_libraries(
trimesh_isosurface
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_join)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_join.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_join
${SOURCES})
target_link_libraries(
trimesh_join
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_kdtree)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_kdtree.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_kdtree
${SOURCES})
target_link_libraries(
trimesh_kdtree
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_montecarlo_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_montecarlo_sampling.cpp)
endif()
add_executable(trimesh_montecarlo_sampling
${SOURCES})
target_link_libraries(
trimesh_montecarlo_sampling
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_normal)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_normal.cpp)
endif()
add_executable(trimesh_normal
${SOURCES})
target_link_libraries(
trimesh_normal
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_optional)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_optional.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_optional
${SOURCES})
target_link_libraries(
trimesh_optional
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_pointcloud_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_pointcloud_sampling.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_pointcloud_sampling
${SOURCES})
target_link_libraries(
trimesh_pointcloud_sampling
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_pointmatching)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_pointmatching.cpp)
endif()
add_executable(trimesh_pointmatching
${SOURCES})
target_link_libraries(
trimesh_pointmatching
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_ray)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_ray.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_ray
${SOURCES})
target_link_libraries(
trimesh_ray
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_refine)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_refine.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_refine
${SOURCES})
target_link_libraries(
trimesh_refine
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_remeshing)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_remeshing.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_remeshing
${SOURCES})
target_link_libraries(
trimesh_remeshing
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_sampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_sampling.cpp)
endif()
add_executable(trimesh_sampling
${SOURCES})
target_link_libraries(
trimesh_sampling
PUBLIC
vcglib
)

View File

@ -1,3 +1,8 @@
include(../common.pri)
TARGET = trimesh_sampling
SOURCES += trimesh_sampling.cpp
# Awful..
win32{
DEFINES += NOMINMAX
}

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_select)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_select.cpp)
endif()
add_executable(trimesh_select
${SOURCES})
target_link_libraries(
trimesh_select
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_smooth)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_smooth.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_smooth
${SOURCES})
target_link_libraries(
trimesh_smooth
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_split_vertex)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_split_vertex.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_split_vertex
${SOURCES})
target_link_libraries(
trimesh_split_vertex
PUBLIC
vcglib
)

View File

@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_texture)
find_package(
Qt5
COMPONENTS OpenGL Svg)
if (TARGET Qt5::OpenGL AND TARGET Qt5::Svg)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_texture.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/Outline2ToQImage.cpp
${VCG_INCLUDE_DIRS}/wrap/qt/outline2_rasterizer.cpp)
endif()
add_executable(trimesh_texture
${SOURCES})
target_link_libraries(
trimesh_texture
PUBLIC
vcglib
Qt5::OpenGL
Qt5::Svg
)
else()
message(
STATUS "VCG examples - Skipping trimesh_texture example")
endif()

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_texture_clean)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_texture_clean.cpp)
endif()
add_executable(trimesh_texture_clean
${SOURCES})
target_link_libraries(
trimesh_texture_clean
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_topological_cut)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_topological_cut.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_topological_cut
${SOURCES})
target_link_libraries(
trimesh_topological_cut
PUBLIC
vcglib
)

View File

@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_topology)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_topology.cpp)
endif()
add_executable(trimesh_topology
${SOURCES})
target_link_libraries(
trimesh_topology
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoi)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoi.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoi
${SOURCES})
target_link_libraries(
trimesh_voronoi
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoiatlas)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoiatlas.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoiatlas
${SOURCES})
target_link_libraries(
trimesh_voronoiatlas
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoiclustering)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoiclustering.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoiclustering
${SOURCES})
target_link_libraries(
trimesh_voronoiclustering
PUBLIC
vcglib
)

View File

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project(trimesh_voronoisampling)
if (VCG_HEADER_ONLY)
set(SOURCES
trimesh_voronoisampling.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(trimesh_voronoisampling
${SOURCES})
target_link_libraries(
trimesh_voronoisampling
PUBLIC
vcglib
)

View File

@ -1,2 +1,17 @@
cmake_minimum_required(VERSION 3.13)
project (tridecimator)
add_executable(tridecimator tridecimator.cpp ../../wrap/ply/plylib.cpp)
if (VCG_HEADER_ONLY)
set(SOURCES
tridecimator.cpp
${VCG_INCLUDE_DIRS}/wrap/ply/plylib.cpp)
endif()
add_executable(tridecimator
${SOURCES})
target_link_libraries(
tridecimator
PUBLIC
vcglib
)

View File

@ -9,6 +9,7 @@
#define EIGEN_CHOLESKY_MODULE_H
#include "Core"
#include "Jacobi"
#include "src/Core/util/DisableStupidWarnings.h"
@ -31,7 +32,11 @@
#include "src/Cholesky/LLT.h"
#include "src/Cholesky/LDLT.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Cholesky/LLT_LAPACKE.h"
#endif

View File

@ -14,6 +14,22 @@
// first thing Eigen does: stop the compiler from committing suicide
#include "src/Core/util/DisableStupidWarnings.h"
#if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
#define EIGEN_CUDACC __CUDACC__
#endif
#if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
#define EIGEN_CUDA_ARCH __CUDA_ARCH__
#endif
#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
#define EIGEN_CUDACC_VER ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
#elif defined(__CUDACC_VER__)
#define EIGEN_CUDACC_VER __CUDACC_VER__
#else
#define EIGEN_CUDACC_VER 0
#endif
// Handle NVCC/CUDA/SYCL
#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__)
// Do not try asserts on CUDA and SYCL!
@ -37,9 +53,9 @@
#endif
#define EIGEN_DEVICE_FUNC __host__ __device__
// We need math_functions.hpp to ensure that that EIGEN_USING_STD_MATH macro
// We need cuda_runtime.h to ensure that that EIGEN_USING_STD_MATH macro
// works properly on the device side
#include <math_functions.hpp>
#include <cuda_runtime.h>
#else
#define EIGEN_DEVICE_FUNC
#endif
@ -155,6 +171,9 @@
#ifdef __AVX512DQ__
#define EIGEN_VECTORIZE_AVX512DQ
#endif
#ifdef __AVX512ER__
#define EIGEN_VECTORIZE_AVX512ER
#endif
#endif
// include files
@ -229,7 +248,7 @@
#if defined __CUDACC__
#define EIGEN_VECTORIZE_CUDA
#include <vector_types.h>
#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500
#if EIGEN_CUDACC_VER >= 70500
#define EIGEN_HAS_CUDA_FP16
#endif
#endif
@ -260,7 +279,10 @@
#include <cmath>
#include <cassert>
#include <functional>
#include <iosfwd>
#include <sstream>
#ifndef EIGEN_NO_IO
#include <iosfwd>
#endif
#include <cstring>
#include <string>
#include <limits>
@ -321,12 +343,16 @@ inline static const char *SimdInstructionSetsInUse(void) {
#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information
#endif
namespace Eigen {
// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to
// ensure QNX/QCC support
using std::size_t;
// gcc 4.6.0 wants std:: for ptrdiff_t
using std::ptrdiff_t;
}
/** \defgroup Core_Module Core module
* This is the main module of Eigen providing dense matrix and vector support
* (both fixed and dynamic size) with all the features corresponding to a BLAS library
@ -348,10 +374,13 @@ using std::ptrdiff_t;
#include "src/Core/MathFunctions.h"
#include "src/Core/GenericPacketMath.h"
#include "src/Core/MathFunctionsImpl.h"
#include "src/Core/arch/Default/ConjHelper.h"
#if defined EIGEN_VECTORIZE_AVX512
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/SSE/MathFunctions.h"
#include "src/Core/arch/AVX/PacketMath.h"
#include "src/Core/arch/AVX/MathFunctions.h"
#include "src/Core/arch/AVX512/PacketMath.h"
#include "src/Core/arch/AVX512/MathFunctions.h"
#elif defined EIGEN_VECTORIZE_AVX
@ -363,6 +392,7 @@ using std::ptrdiff_t;
#include "src/Core/arch/AVX/MathFunctions.h"
#include "src/Core/arch/AVX/Complex.h"
#include "src/Core/arch/AVX/TypeCasting.h"
#include "src/Core/arch/SSE/TypeCasting.h"
#elif defined EIGEN_VECTORIZE_SSE
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/SSE/MathFunctions.h"
@ -405,6 +435,7 @@ using std::ptrdiff_t;
// on CUDA devices
#include "src/Core/arch/CUDA/Complex.h"
#include "src/Core/IO.h"
#include "src/Core/DenseCoeffsBase.h"
#include "src/Core/DenseBase.h"
#include "src/Core/MatrixBase.h"
@ -452,7 +483,6 @@ using std::ptrdiff_t;
#include "src/Core/Redux.h"
#include "src/Core/Visitor.h"
#include "src/Core/Fuzzy.h"
#include "src/Core/IO.h"
#include "src/Core/Swap.h"
#include "src/Core/CommaInitializer.h"
#include "src/Core/GeneralProduct.h"

View File

@ -10,14 +10,14 @@
#include "Core"
#include "src/Core/util/DisableStupidWarnings.h"
#include "Cholesky"
#include "Jacobi"
#include "Householder"
#include "LU"
#include "Geometry"
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup Eigenvalues_Module Eigenvalues module
*
*
@ -45,7 +45,11 @@
#include "src/Eigenvalues/GeneralizedEigenSolver.h"
#include "src/Eigenvalues/MatrixBaseEigenvalues.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Eigenvalues/RealSchur_LAPACKE.h"
#include "src/Eigenvalues/ComplexSchur_LAPACKE.h"
#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h"

View File

@ -10,12 +10,12 @@
#include "Core"
#include "src/Core/util/DisableStupidWarnings.h"
#include "SVD"
#include "LU"
#include <limits>
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup Geometry_Module Geometry module
*
* This module provides support for:

View File

@ -28,7 +28,11 @@
#include "src/LU/FullPivLU.h"
#include "src/LU/PartialPivLU.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/LU/PartialPivLU_LAPACKE.h"
#endif
#include "src/LU/Determinant.h"

View File

@ -10,12 +10,12 @@
#include "Core"
#include "src/Core/util/DisableStupidWarnings.h"
#include "Cholesky"
#include "Jacobi"
#include "Householder"
#include "src/Core/util/DisableStupidWarnings.h"
/** \defgroup QR_Module QR module
*
*
@ -36,7 +36,11 @@
#include "src/QR/ColPivHouseholderQR.h"
#include "src/QR/CompleteOrthogonalDecomposition.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/QR/HouseholderQR_LAPACKE.h"
#include "src/QR/ColPivHouseholderQR_LAPACKE.h"
#endif

View File

@ -14,7 +14,7 @@
#include "src/Core/util/DisableStupidWarnings.h"
void *qMalloc(size_t size)
void *qMalloc(std::size_t size)
{
return Eigen::internal::aligned_malloc(size);
}
@ -24,10 +24,10 @@ void qFree(void *ptr)
Eigen::internal::aligned_free(ptr);
}
void *qRealloc(void *ptr, size_t size)
void *qRealloc(void *ptr, std::size_t size)
{
void* newPtr = Eigen::internal::aligned_malloc(size);
memcpy(newPtr, ptr, size);
std::memcpy(newPtr, ptr, size);
Eigen::internal::aligned_free(ptr);
return newPtr;
}

View File

@ -37,7 +37,11 @@
#include "src/SVD/JacobiSVD.h"
#include "src/SVD/BDCSVD.h"
#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/SVD/JacobiSVD_LAPACKE.h"
#endif

View File

@ -25,7 +25,9 @@
#include "SparseCore"
#include "OrderingMethods"
#ifndef EIGEN_MPL2_ONLY
#include "SparseCholesky"
#endif
#include "SparseLU"
#include "SparseQR"
#include "IterativeLinearSolvers"

View File

@ -28,7 +28,6 @@
*
*/
#include "OrderingMethods"
#include "src/SparseCore/SparseColEtree.h"
#include "src/SparseQR/SparseQR.h"

View File

@ -14,7 +14,7 @@
#include "Core"
#include <deque>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...)

View File

@ -13,7 +13,7 @@
#include "Core"
#include <list>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...)

View File

@ -14,7 +14,7 @@
#include "Core"
#include <vector>
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 /* MSVC auto aligns in 64 bit builds */
#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */
#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...)

View File

@ -248,7 +248,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
/** \brief Reports whether previous computation was successful.
*
* \returns \c Success if computation was succesful,
* \c NumericalIssue if the matrix.appears to be negative.
* \c NumericalIssue if the factorization failed because of a zero pivot.
*/
ComputationInfo info() const
{
@ -305,7 +305,8 @@ template<> struct ldlt_inplace<Lower>
if (size <= 1)
{
transpositions.setIdentity();
if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
if(size==0) sign = ZeroSign;
else if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
else if (numext::real(mat.coeff(0,0)) < static_cast<RealScalar>(0)) sign = NegativeSemiDef;
else sign = ZeroSign;
return true;
@ -376,6 +377,8 @@ template<> struct ldlt_inplace<Lower>
if((rs>0) && pivot_is_valid)
A21 /= realAkk;
else if(rs>0)
ret = ret && (A21.array()==Scalar(0)).all();
if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed
else if(!pivot_is_valid) found_zero_pivot = true;
@ -568,13 +571,14 @@ void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) cons
// more precisely, use pseudo-inverse of D (see bug 241)
using std::abs;
const typename Diagonal<const MatrixType>::RealReturnType vecD(vectorD());
// In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
// as motivated by LAPACK's xGELSS:
// In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min())
// and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS:
// RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
// However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
// diagonal element is not well justified and leads to numerical issues in some cases.
// Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
// Using numeric_limits::min() gives us more robustness to denormals.
RealScalar tolerance = (std::numeric_limits<RealScalar>::min)();
for (Index i = 0; i < vecD.size(); ++i)
{

View File

@ -24,7 +24,7 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
*
* \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition
* \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper.
* The other triangular part won't be read.
* The other triangular part won't be read.
*
* This class performs a LL^T Cholesky decomposition of a symmetric, positive definite
* matrix A such that A = LL^* = U^*U, where L is lower triangular.
@ -41,14 +41,18 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
* Example: \include LLT_example.cpp
* Output: \verbinclude LLT_example.out
*
* \b Performance: for best performance, it is recommended to use a column-major storage format
* with the Lower triangular part (the default), or, equivalently, a row-major storage format
* with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization
* step, and rank-updates can be up to 3 times slower.
*
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
*
* Note that during the decomposition, only the lower (or upper, as defined by _UpLo) triangular part of A is considered.
* Therefore, the strict lower part does not have to store correct values.
*
* \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT
*/
/* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH)
* Note that during the decomposition, only the upper triangular part of A is considered. Therefore,
* the strict lower part does not have to store correct values.
*/
template<typename _MatrixType, int _UpLo> class LLT
{
public:
@ -146,7 +150,7 @@ template<typename _MatrixType, int _UpLo> class LLT
}
template<typename Derived>
void solveInPlace(MatrixBase<Derived> &bAndX) const;
void solveInPlace(const MatrixBase<Derived> &bAndX) const;
template<typename InputType>
LLT& compute(const EigenBase<InputType>& matrix);
@ -177,7 +181,7 @@ template<typename _MatrixType, int _UpLo> class LLT
/** \brief Reports whether previous computation was successful.
*
* \returns \c Success if computation was succesful,
* \c NumericalIssue if the matrix.appears to be negative.
* \c NumericalIssue if the matrix.appears not to be positive definite.
*/
ComputationInfo info() const
{
@ -425,7 +429,8 @@ LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const EigenBase<InputType>
eigen_assert(a.rows()==a.cols());
const Index size = a.rows();
m_matrix.resize(size, size);
m_matrix = a.derived();
if (!internal::is_same_dense(m_matrix, a.derived()))
m_matrix = a.derived();
// Compute matrix L1 norm = max abs column sum.
m_l1_norm = RealScalar(0);
@ -485,11 +490,14 @@ void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const
*
* This version avoids a copy when the right hand side matrix b is not needed anymore.
*
* \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here.
* This function will const_cast it, so constness isn't honored here.
*
* \sa LLT::solve(), MatrixBase::llt()
*/
template<typename MatrixType, int _UpLo>
template<typename Derived>
void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
void LLT<MatrixType,_UpLo>::solveInPlace(const MatrixBase<Derived> &bAndX) const
{
eigen_assert(m_isInitialized && "LLT is not initialized.");
eigen_assert(m_matrix.rows()==bAndX.rows());

View File

@ -153,8 +153,6 @@ class Array
: Base(std::move(other))
{
Base::_check_template_params();
if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
Base::_set_noalias(other);
}
EIGEN_DEVICE_FUNC
Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
@ -231,10 +229,16 @@ class Array
: Base(other)
{ }
private:
struct PrivateType {};
public:
/** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other)
EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other,
typename internal::enable_if<internal::is_convertible<typename OtherDerived::Scalar,Scalar>::value,
PrivateType>::type = PrivateType())
: Base(other.derived())
{ }

View File

@ -153,8 +153,8 @@ template<typename Derived> class ArrayBase
// inline void evalTo(Dest& dst) const { dst = matrix(); }
protected:
EIGEN_DEVICE_FUNC
ArrayBase() : Base() {}
EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase)
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase)
private:
explicit ArrayBase(Index);
@ -175,7 +175,7 @@ template<typename Derived> class ArrayBase
*/
template<typename Derived>
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
{
call_assignment(derived(), other.derived(), internal::sub_assign_op<Scalar,typename OtherDerived::Scalar>());
@ -188,7 +188,7 @@ ArrayBase<Derived>::operator-=(const ArrayBase<OtherDerived> &other)
*/
template<typename Derived>
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
{
call_assignment(derived(), other.derived(), internal::add_assign_op<Scalar,typename OtherDerived::Scalar>());
@ -201,7 +201,7 @@ ArrayBase<Derived>::operator+=(const ArrayBase<OtherDerived>& other)
*/
template<typename Derived>
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
{
call_assignment(derived(), other.derived(), internal::mul_assign_op<Scalar,typename OtherDerived::Scalar>());
@ -214,7 +214,7 @@ ArrayBase<Derived>::operator*=(const ArrayBase<OtherDerived>& other)
*/
template<typename Derived>
template<typename OtherDerived>
EIGEN_STRONG_INLINE Derived &
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived &
ArrayBase<Derived>::operator/=(const ArrayBase<OtherDerived>& other)
{
call_assignment(derived(), other.derived(), internal::div_assign_op<Scalar,typename OtherDerived::Scalar>());

View File

@ -32,7 +32,8 @@ struct traits<ArrayWrapper<ExpressionType> >
// Let's remove NestByRefBit
enum {
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
Flags = Flags0 & ~NestByRefBit
LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
};
};
}
@ -129,7 +130,8 @@ struct traits<MatrixWrapper<ExpressionType> >
// Let's remove NestByRefBit
enum {
Flags0 = traits<typename remove_all<typename ExpressionType::Nested>::type >::Flags,
Flags = Flags0 & ~NestByRefBit
LvalueBitFlag = is_lvalue<ExpressionType>::value ? LvalueBit : 0,
Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag
};
};
}

View File

@ -39,7 +39,7 @@ public:
enum {
DstAlignment = DstEvaluator::Alignment,
SrcAlignment = SrcEvaluator::Alignment,
DstHasDirectAccess = DstFlags & DirectAccessBit,
DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit,
JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment)
};
@ -83,7 +83,7 @@ private:
&& int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0
&& (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)),
MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit),
MayLinearVectorize = bool(MightVectorize) && MayLinearize && DstHasDirectAccess
MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess)
&& (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic),
/* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
so it's only good for large enough sizes. */
@ -515,7 +515,7 @@ struct dense_assignment_loop<Kernel, LinearTraversal, CompleteUnrolling>
template<typename Kernel>
struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling>
{
EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel)
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
{
typedef typename Kernel::Scalar Scalar;
typedef typename Kernel::PacketType PacketType;
@ -563,7 +563,7 @@ struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, NoUnrolling>
template<typename Kernel>
struct dense_assignment_loop<Kernel, SliceVectorizedTraversal, InnerUnrolling>
{
EIGEN_DEVICE_FUNC static inline void run(Kernel &kernel)
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel)
{
typedef typename Kernel::DstEvaluatorType::XprType DstXprType;
typedef typename Kernel::PacketType PacketType;
@ -701,6 +701,26 @@ protected:
* Part 5 : Entry point for dense rectangular assignment
***************************************************************************/
template<typename DstXprType,typename SrcXprType, typename Functor>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/)
{
EIGEN_ONLY_USED_FOR_DEBUG(dst);
EIGEN_ONLY_USED_FOR_DEBUG(src);
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols());
}
template<typename DstXprType,typename SrcXprType, typename T1, typename T2>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op<T1,T2> &/*func*/)
{
Index dstRows = src.rows();
Index dstCols = src.cols();
if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols)))
dst.resize(dstRows, dstCols);
eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols);
}
template<typename DstXprType, typename SrcXprType, typename Functor>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func)
{
@ -711,10 +731,7 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType
// NOTE To properly handle A = (A*A.transpose())/s with A rectangular,
// we need to resize the destination after the source evaluator has been created.
Index dstRows = src.rows();
Index dstCols = src.cols();
if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
dst.resize(dstRows, dstCols);
resize_if_allowed(dst, src, func);
DstEvaluatorType dstEvaluator(dst);

View File

@ -84,7 +84,8 @@ class vml_assign_traits
struct Assignment<DstXprType, CwiseUnaryOp<scalar_##EIGENOP##_op<EIGENTYPE>, SrcXprNested>, assign_op<EIGENTYPE,EIGENTYPE>, \
Dense2Dense, typename enable_if<vml_assign_traits<DstXprType,SrcXprNested>::EnableVml>::type> { \
typedef CwiseUnaryOp<scalar_##EIGENOP##_op<EIGENTYPE>, SrcXprNested> SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, const assign_op<EIGENTYPE,EIGENTYPE> &/*func*/) { \
static void run(DstXprType &dst, const SrcXprType &src, const assign_op<EIGENTYPE,EIGENTYPE> &func) { \
resize_if_allowed(dst, src, func); \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
if(vml_assign_traits<DstXprType,SrcXprNested>::Traversal==LinearTraversal) { \
VMLOP(dst.size(), (const VMLTYPE*)src.nestedExpression().data(), \
@ -144,7 +145,8 @@ EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(ceil, Ceil, _)
Dense2Dense, typename enable_if<vml_assign_traits<DstXprType,SrcXprNested>::EnableVml>::type> { \
typedef CwiseBinaryOp<scalar_##EIGENOP##_op<EIGENTYPE,EIGENTYPE>, SrcXprNested, \
const CwiseNullaryOp<internal::scalar_constant_op<EIGENTYPE>,Plain> > SrcXprType; \
static void run(DstXprType &dst, const SrcXprType &src, const assign_op<EIGENTYPE,EIGENTYPE> &/*func*/) { \
static void run(DstXprType &dst, const SrcXprType &src, const assign_op<EIGENTYPE,EIGENTYPE> &func) { \
resize_if_allowed(dst, src, func); \
eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \
VMLTYPE exponent = reinterpret_cast<const VMLTYPE&>(src.rhs().functor().m_other); \
if(vml_assign_traits<DstXprType,SrcXprNested>::Traversal==LinearTraversal) \

View File

@ -160,7 +160,7 @@ rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Deco
{
typedef typename Decomposition::RealScalar RealScalar;
eigen_assert(dec.rows() == dec.cols());
if (dec.rows() == 0) return RealScalar(1);
if (dec.rows() == 0) return NumTraits<RealScalar>::infinity();
if (matrix_norm == RealScalar(0)) return RealScalar(0);
if (dec.rows() == 1) return RealScalar(1);
const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec);

View File

@ -977,7 +977,7 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
OuterStrideAtCompileTime = HasSameStorageOrderAsArgType
? int(outer_stride_at_compile_time<ArgType>::ret)
: int(inner_stride_at_compile_time<ArgType>::ret),
MaskPacketAccessBit = (InnerStrideAtCompileTime == 1) ? PacketAccessBit : 0,
MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0,
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator<ArgType>::Flags&LinearAccessBit))) ? LinearAccessBit : 0,
FlagsRowMajorBit = XprType::Flags&RowMajorBit,
@ -987,7 +987,9 @@ struct evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit,
PacketAlignment = unpacket_traits<PacketScalar>::alignment,
Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0,
Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic)
&& (OuterStrideAtCompileTime!=0)
&& (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0,
Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator<ArgType>::Alignment, Alignment0)
};
typedef block_evaluator<ArgType, BlockRows, BlockCols, InnerPanel> block_evaluator_type;
@ -1018,14 +1020,16 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& block)
: m_argImpl(block.nestedExpression()),
m_startRow(block.startRow()),
m_startCol(block.startCol())
m_startCol(block.startCol()),
m_linear_offset(InnerPanel?(XprType::IsRowMajor ? block.startRow()*block.cols() : block.startCol()*block.rows()):0)
{ }
typedef typename XprType::Scalar Scalar;
typedef typename XprType::CoeffReturnType CoeffReturnType;
enum {
RowsAtCompileTime = XprType::RowsAtCompileTime
RowsAtCompileTime = XprType::RowsAtCompileTime,
ForwardLinearAccess = InnerPanel && bool(evaluator<ArgType>::Flags&LinearAccessBit)
};
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -1037,7 +1041,10 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index index) const
{
return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
if (ForwardLinearAccess)
return m_argImpl.coeff(m_linear_offset.value() + index);
else
return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
}
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
@ -1049,7 +1056,10 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Scalar& coeffRef(Index index)
{
return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
if (ForwardLinearAccess)
return m_argImpl.coeffRef(m_linear_offset.value() + index);
else
return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
}
template<int LoadMode, typename PacketType>
@ -1063,8 +1073,11 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_STRONG_INLINE
PacketType packet(Index index) const
{
return packet<LoadMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0);
if (ForwardLinearAccess)
return m_argImpl.template packet<LoadMode,PacketType>(m_linear_offset.value() + index);
else
return packet<LoadMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0);
}
template<int StoreMode, typename PacketType>
@ -1078,15 +1091,19 @@ struct unary_evaluator<Block<ArgType, BlockRows, BlockCols, InnerPanel>, IndexBa
EIGEN_STRONG_INLINE
void writePacket(Index index, const PacketType& x)
{
return writePacket<StoreMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0,
x);
if (ForwardLinearAccess)
return m_argImpl.template writePacket<StoreMode,PacketType>(m_linear_offset.value() + index, x);
else
return writePacket<StoreMode,PacketType>(RowsAtCompileTime == 1 ? 0 : index,
RowsAtCompileTime == 1 ? index : 0,
x);
}
protected:
evaluator<ArgType> m_argImpl;
const variable_if_dynamic<Index, (ArgType::RowsAtCompileTime == 1 && BlockRows==1) ? 0 : Dynamic> m_startRow;
const variable_if_dynamic<Index, (ArgType::ColsAtCompileTime == 1 && BlockCols==1) ? 0 : Dynamic> m_startCol;
const variable_if_dynamic<Index, InnerPanel ? Dynamic : 0> m_linear_offset;
};
// TODO: This evaluator does not actually use the child evaluator;
@ -1556,9 +1573,7 @@ struct evaluator<Diagonal<ArgType, DiagIndex> >
{ }
typedef typename XprType::Scalar Scalar;
// FIXME having to check whether ArgType is sparse here i not very nice.
typedef typename internal::conditional<!internal::is_same<typename ArgType::StorageKind,Sparse>::value,
typename XprType::CoeffReturnType,Scalar>::type CoeffReturnType;
typedef typename XprType::CoeffReturnType CoeffReturnType;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
CoeffReturnType coeff(Index row, Index) const

View File

@ -105,7 +105,7 @@ class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp<NullaryOp
*/
template<typename Derived>
template<typename CustomNullaryOp>
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
DenseBase<Derived>::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func)
{
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(rows, cols, func);
@ -150,7 +150,7 @@ DenseBase<Derived>::NullaryExpr(Index size, const CustomNullaryOp& func)
*/
template<typename Derived>
template<typename CustomNullaryOp>
EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp<CustomNullaryOp, typename DenseBase<Derived>::PlainObject>
DenseBase<Derived>::NullaryExpr(const CustomNullaryOp& func)
{
return CwiseNullaryOp<CustomNullaryOp, PlainObject>(RowsAtCompileTime, ColsAtCompileTime, func);
@ -192,7 +192,7 @@ DenseBase<Derived>::Constant(Index rows, Index cols, const Scalar& value)
* \sa class CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Constant(Index size, const Scalar& value)
{
return DenseBase<Derived>::NullaryExpr(size, internal::scalar_constant_op<Scalar>(value));
@ -208,7 +208,7 @@ DenseBase<Derived>::Constant(Index size, const Scalar& value)
* \sa class CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Constant(const Scalar& value)
{
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
@ -220,7 +220,7 @@ DenseBase<Derived>::Constant(const Scalar& value)
* \sa LinSpaced(Index,Scalar,Scalar), setLinSpaced(Index,const Scalar&,const Scalar&)
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@ -232,7 +232,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, Index size, const Scalar& low, const
* \sa LinSpaced(Scalar,Scalar)
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@ -264,7 +264,7 @@ DenseBase<Derived>::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig
* \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@ -276,7 +276,7 @@ DenseBase<Derived>::LinSpaced(Index size, const Scalar& low, const Scalar& high)
* Special version for fixed size types which does not require the size parameter.
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::RandomAccessLinSpacedReturnType
DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
@ -286,7 +286,7 @@ DenseBase<Derived>::LinSpaced(const Scalar& low, const Scalar& high)
/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */
template<typename Derived>
bool DenseBase<Derived>::isApproxToConstant
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isApproxToConstant
(const Scalar& val, const RealScalar& prec) const
{
typename internal::nested_eval<Derived,1>::type self(derived());
@ -301,7 +301,7 @@ bool DenseBase<Derived>::isApproxToConstant
*
* \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */
template<typename Derived>
bool DenseBase<Derived>::isConstant
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isConstant
(const Scalar& val, const RealScalar& prec) const
{
return isApproxToConstant(val, prec);
@ -312,7 +312,7 @@ bool DenseBase<Derived>::isConstant
* \sa setConstant(), Constant(), class CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
{
setConstant(val);
}
@ -322,7 +322,7 @@ EIGEN_STRONG_INLINE void DenseBase<Derived>::fill(const Scalar& val)
* \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
{
return derived() = Constant(rows(), cols(), val);
}
@ -337,7 +337,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setConstant(const Scalar& val)
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
{
resize(size);
@ -356,7 +356,7 @@ PlainObjectBase<Derived>::setConstant(Index size, const Scalar& val)
* \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
{
resize(rows, cols);
@ -380,7 +380,7 @@ PlainObjectBase<Derived>::setConstant(Index rows, Index cols, const Scalar& val)
* \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op<Scalar,PacketScalar>(low,high,newSize));
@ -400,7 +400,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(Index newSize, con
* \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low, const Scalar& high)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return setLinSpaced(size(), low, high);
@ -423,7 +423,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setLinSpaced(const Scalar& low,
* \sa Zero(), Zero(Index)
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Zero(Index rows, Index cols)
{
return Constant(rows, cols, Scalar(0));
@ -446,7 +446,7 @@ DenseBase<Derived>::Zero(Index rows, Index cols)
* \sa Zero(), Zero(Index,Index)
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Zero(Index size)
{
return Constant(size, Scalar(0));
@ -463,7 +463,7 @@ DenseBase<Derived>::Zero(Index size)
* \sa Zero(Index), Zero(Index,Index)
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Zero()
{
return Constant(Scalar(0));
@ -478,7 +478,7 @@ DenseBase<Derived>::Zero()
* \sa class CwiseNullaryOp, Zero()
*/
template<typename Derived>
bool DenseBase<Derived>::isZero(const RealScalar& prec) const
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isZero(const RealScalar& prec) const
{
typename internal::nested_eval<Derived,1>::type self(derived());
for(Index j = 0; j < cols(); ++j)
@ -496,7 +496,7 @@ bool DenseBase<Derived>::isZero(const RealScalar& prec) const
* \sa class CwiseNullaryOp, Zero()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
{
return setConstant(Scalar(0));
}
@ -511,7 +511,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setZero()
* \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setZero(Index newSize)
{
resize(newSize);
@ -529,7 +529,7 @@ PlainObjectBase<Derived>::setZero(Index newSize)
* \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setZero(Index rows, Index cols)
{
resize(rows, cols);
@ -553,7 +553,7 @@ PlainObjectBase<Derived>::setZero(Index rows, Index cols)
* \sa Ones(), Ones(Index), isOnes(), class Ones
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Ones(Index rows, Index cols)
{
return Constant(rows, cols, Scalar(1));
@ -576,7 +576,7 @@ DenseBase<Derived>::Ones(Index rows, Index cols)
* \sa Ones(), Ones(Index,Index), isOnes(), class Ones
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Ones(Index newSize)
{
return Constant(newSize, Scalar(1));
@ -593,7 +593,7 @@ DenseBase<Derived>::Ones(Index newSize)
* \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase<Derived>::ConstantReturnType
DenseBase<Derived>::Ones()
{
return Constant(Scalar(1));
@ -608,7 +608,7 @@ DenseBase<Derived>::Ones()
* \sa class CwiseNullaryOp, Ones()
*/
template<typename Derived>
bool DenseBase<Derived>::isOnes
EIGEN_DEVICE_FUNC bool DenseBase<Derived>::isOnes
(const RealScalar& prec) const
{
return isApproxToConstant(Scalar(1), prec);
@ -622,7 +622,7 @@ bool DenseBase<Derived>::isOnes
* \sa class CwiseNullaryOp, Ones()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
{
return setConstant(Scalar(1));
}
@ -637,7 +637,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase<Derived>::setOnes()
* \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setOnes(Index newSize)
{
resize(newSize);
@ -655,7 +655,7 @@ PlainObjectBase<Derived>::setOnes(Index newSize)
* \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived&
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
{
resize(rows, cols);
@ -679,7 +679,7 @@ PlainObjectBase<Derived>::setOnes(Index rows, Index cols)
* \sa Identity(), setIdentity(), isIdentity()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
MatrixBase<Derived>::Identity(Index rows, Index cols)
{
return DenseBase<Derived>::NullaryExpr(rows, cols, internal::scalar_identity_op<Scalar>());
@ -696,7 +696,7 @@ MatrixBase<Derived>::Identity(Index rows, Index cols)
* \sa Identity(Index,Index), setIdentity(), isIdentity()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::IdentityReturnType
MatrixBase<Derived>::Identity()
{
EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived)
@ -771,7 +771,7 @@ struct setIdentity_impl<Derived, true>
* \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
{
return internal::setIdentity_impl<Derived>::run(derived());
}
@ -787,7 +787,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity()
* \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity()
*/
template<typename Derived>
EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index cols)
{
derived().resize(rows, cols);
return setIdentity();
@ -800,7 +800,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase<Derived>::setIdentity(Index rows, Index
* \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index newSize, Index i)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i);
@ -815,7 +815,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
* \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::Unit(Index i)
{
EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
return BasisReturnType(SquareMatrixType::Identity(),i);
@ -828,7 +828,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitX()
{ return Derived::Unit(0); }
/** \returns an expression of the Y axis unit vector (0,1{,0}^*)
@ -838,7 +838,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitY()
{ return Derived::Unit(1); }
/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*)
@ -848,7 +848,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitZ()
{ return Derived::Unit(2); }
/** \returns an expression of the W axis unit vector (0,0,0,1)
@ -858,7 +858,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBa
* \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW()
*/
template<typename Derived>
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::BasisReturnType MatrixBase<Derived>::UnitW()
{ return Derived::Unit(3); }
} // end namespace Eigen

View File

@ -121,6 +121,8 @@ class CwiseUnaryViewImpl<ViewOp,MatrixType,Dense>
{
return derived().nestedExpression().outerStride() * sizeof(typename internal::traits<MatrixType>::Scalar) / sizeof(Scalar);
}
protected:
EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(CwiseUnaryViewImpl)
};
} // end namespace Eigen

View File

@ -40,7 +40,7 @@ static inline void check_DenseIndex_is_signed() {
*/
template<typename Derived> class DenseBase
#ifndef EIGEN_PARSED_BY_DOXYGEN
: public DenseCoeffsBase<Derived>
: public DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value>
#else
: public DenseCoeffsBase<Derived,DirectWriteAccessors>
#endif // not EIGEN_PARSED_BY_DOXYGEN
@ -71,7 +71,7 @@ template<typename Derived> class DenseBase
typedef Scalar value_type;
typedef typename NumTraits<Scalar>::Real RealScalar;
typedef DenseCoeffsBase<Derived> Base;
typedef DenseCoeffsBase<Derived, internal::accessors_level<Derived>::value> Base;
using Base::derived;
using Base::const_cast_derived;
@ -296,7 +296,7 @@ template<typename Derived> class DenseBase
EIGEN_DEVICE_FUNC
Derived& operator=(const ReturnByValue<OtherDerived>& func);
/** \ínternal
/** \internal
* Copies \a other into *this without evaluating other. \returns a reference to *this.
* \deprecated */
template<typename OtherDerived>
@ -463,7 +463,17 @@ template<typename Derived> class DenseBase
EIGEN_DEVICE_FUNC
void visit(Visitor& func) const;
inline const WithFormat<Derived> format(const IOFormat& fmt) const;
/** \returns a WithFormat proxy object allowing to print a matrix the with given
* format \a fmt.
*
* See class IOFormat for some examples.
*
* \sa class IOFormat, class WithFormat
*/
inline const WithFormat<Derived> format(const IOFormat& fmt) const
{
return WithFormat<Derived>(derived(), fmt);
}
/** \returns the unique coefficient of a 1x1 expression */
EIGEN_DEVICE_FUNC
@ -474,9 +484,9 @@ template<typename Derived> class DenseBase
return derived().coeff(0,0);
}
bool all() const;
bool any() const;
Index count() const;
EIGEN_DEVICE_FUNC bool all() const;
EIGEN_DEVICE_FUNC bool any() const;
EIGEN_DEVICE_FUNC Index count() const;
typedef VectorwiseOp<Derived, Horizontal> RowwiseReturnType;
typedef const VectorwiseOp<const Derived, Horizontal> ConstRowwiseReturnType;
@ -577,11 +587,12 @@ template<typename Derived> class DenseBase
}
protected:
EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase)
/** Default constructor. Do nothing. */
EIGEN_DEVICE_FUNC DenseBase()
{
/* Just checks for self-consistency of the flags.
* Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down
* Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down
*/
#ifdef EIGEN_INTERNAL_DEBUGGING
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor))

View File

@ -13,9 +13,9 @@
#define EIGEN_MATRIXSTORAGE_H
#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN EIGEN_DENSE_STORAGE_CTOR_PLUGIN;
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN;
#else
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X)
#endif
namespace Eigen {
@ -184,12 +184,16 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
{
internal::plain_array<T,Size,_Options> m_data;
public:
EIGEN_DEVICE_FUNC DenseStorage() {}
EIGEN_DEVICE_FUNC DenseStorage() {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size)
}
EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
: m_data(internal::constructor_without_unaligned_array_assert()) {}
EIGEN_DEVICE_FUNC
DenseStorage(const DenseStorage& other) : m_data(other.m_data) {}
DenseStorage(const DenseStorage& other) : m_data(other.m_data) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size)
}
EIGEN_DEVICE_FUNC
DenseStorage& operator=(const DenseStorage& other)
{
@ -197,7 +201,7 @@ template<typename T, int Size, int _Rows, int _Cols, int _Options> class DenseSt
return *this;
}
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) {
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
eigen_internal_assert(size==rows*cols && rows==_Rows && cols==_Cols);
EIGEN_UNUSED_VARIABLE(size);
EIGEN_UNUSED_VARIABLE(rows);
@ -343,7 +347,7 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(rows), m_cols(cols)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0);
}
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other)
@ -351,6 +355,7 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
, m_rows(other.m_rows)
, m_cols(other.m_cols)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*m_cols)
internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data);
}
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other)
@ -399,11 +404,11 @@ template<typename T, int _Options> class DenseStorage<T, Dynamic, Dynamic, Dynam
if(size != m_rows*m_cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
if (size)
if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
m_rows = rows;
m_cols = cols;
@ -422,7 +427,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_cols(cols)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
eigen_internal_assert(size==rows*cols && rows==_Rows && cols >=0);
EIGEN_UNUSED_VARIABLE(rows);
}
@ -430,6 +435,7 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(_Rows*other.m_cols))
, m_cols(other.m_cols)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_cols*_Rows)
internal::smart_copy(other.m_data, other.m_data+_Rows*m_cols, m_data);
}
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other)
@ -473,11 +479,11 @@ template<typename T, int _Rows, int _Options> class DenseStorage<T, Dynamic, _Ro
if(size != _Rows*m_cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
if (size)
if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
m_cols = cols;
}
@ -495,7 +501,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size)), m_rows(rows)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
eigen_internal_assert(size==rows*cols && rows>=0 && cols == _Cols);
EIGEN_UNUSED_VARIABLE(cols);
}
@ -503,6 +509,7 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
: m_data(internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(other.m_rows*_Cols))
, m_rows(other.m_rows)
{
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*_Cols)
internal::smart_copy(other.m_data, other.m_data+other.m_rows*_Cols, m_data);
}
EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other)
@ -546,11 +553,11 @@ template<typename T, int _Cols, int _Options> class DenseStorage<T, Dynamic, Dyn
if(size != m_rows*_Cols)
{
internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
if (size)
if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative
m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
else
m_data = 0;
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
}
m_rows = rows;
}

View File

@ -21,7 +21,7 @@ namespace Eigen {
* \param MatrixType the type of the object in which we are taking a sub/main/super diagonal
* \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal.
* A positive value means a superdiagonal, a negative value means a subdiagonal.
* You can also use Dynamic so the index can be set at runtime.
* You can also use DynamicIndex so the index can be set at runtime.
*
* The matrix is not required to be square.
*
@ -70,7 +70,10 @@ template<typename MatrixType, int _DiagIndex> class Diagonal
EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal)
EIGEN_DEVICE_FUNC
explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {}
explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index)
{
eigen_assert( a_index <= m_matrix.cols() && -a_index <= m_matrix.rows() );
}
EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal)

View File

@ -31,7 +31,8 @@ struct dot_nocheck
typedef scalar_conj_product_op<typename traits<T>::Scalar,typename traits<U>::Scalar> conj_prod;
typedef typename conj_prod::result_type ResScalar;
EIGEN_DEVICE_FUNC
static inline ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
EIGEN_STRONG_INLINE
static ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
{
return a.template binaryExpr<conj_prod>(b).sum();
}
@ -43,7 +44,8 @@ struct dot_nocheck<T, U, true>
typedef scalar_conj_product_op<typename traits<T>::Scalar,typename traits<U>::Scalar> conj_prod;
typedef typename conj_prod::result_type ResScalar;
EIGEN_DEVICE_FUNC
static inline ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
EIGEN_STRONG_INLINE
static ResScalar run(const MatrixBase<T>& a, const MatrixBase<U>& b)
{
return a.transpose().template binaryExpr<conj_prod>(b).sum();
}
@ -65,6 +67,7 @@ struct dot_nocheck<T, U, true>
template<typename Derived>
template<typename OtherDerived>
EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE
typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType
MatrixBase<Derived>::dot(const MatrixBase<OtherDerived>& other) const
{
@ -102,7 +105,7 @@ EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scala
* \sa lpNorm(), dot(), squaredNorm()
*/
template<typename Derived>
inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
EIGEN_STRONG_INLINE typename NumTraits<typename internal::traits<Derived>::Scalar>::Real MatrixBase<Derived>::norm() const
{
return numext::sqrt(squaredNorm());
}
@ -117,7 +120,7 @@ inline typename NumTraits<typename internal::traits<Derived>::Scalar>::Real Matr
* \sa norm(), normalize()
*/
template<typename Derived>
inline const typename MatrixBase<Derived>::PlainObject
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject
MatrixBase<Derived>::normalized() const
{
typedef typename internal::nested_eval<Derived,2>::type _Nested;
@ -139,7 +142,7 @@ MatrixBase<Derived>::normalized() const
* \sa norm(), normalized()
*/
template<typename Derived>
inline void MatrixBase<Derived>::normalize()
EIGEN_STRONG_INLINE void MatrixBase<Derived>::normalize()
{
RealScalar z = squaredNorm();
// NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU
@ -160,7 +163,7 @@ inline void MatrixBase<Derived>::normalize()
* \sa stableNorm(), stableNormalize(), normalized()
*/
template<typename Derived>
inline const typename MatrixBase<Derived>::PlainObject
EIGEN_STRONG_INLINE const typename MatrixBase<Derived>::PlainObject
MatrixBase<Derived>::stableNormalized() const
{
typedef typename internal::nested_eval<Derived,3>::type _Nested;
@ -185,7 +188,7 @@ MatrixBase<Derived>::stableNormalized() const
* \sa stableNorm(), stableNormalized(), normalize()
*/
template<typename Derived>
inline void MatrixBase<Derived>::stableNormalize()
EIGEN_STRONG_INLINE void MatrixBase<Derived>::stableNormalize()
{
RealScalar w = cwiseAbs().maxCoeff();
RealScalar z = (derived()/w).squaredNorm();

Some files were not shown because too many files have changed in this diff Show More