Skip to content

eigen vectors (normal vector alias PC3) #624

Answered by Jean-Romain
DijoG asked this question in Q&A
Discussion options

You must be logged in to vote

5 seconds to 0.5 seconds (10 folds speed-up) using pure C++ copying the example given on gis.stackexchange.

This gives us a 90-100x speed-up compared to your example. You problem is therefore solvable in something like 2 minutes

// [[Rcpp::depends(lidR)]]
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::plugins(openmp)]]

#include <RcppArmadillo.h>
#include <SpatialIndex.h>

using namespace Rcpp;
using namespace lidR;

// [[Rcpp::export]]
NumericMatrix eigen_vector(S4 las, int k, int ncpu = 1)
{
  DataFrame data = as<DataFrame>(las.slot("data"));
  NumericVector X = data["X"];
  NumericVector Y = data["Y"];
  NumericVector Z = data["Z"];
  int npoints = X.size();

  NumericMatrix out(npoints, 

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@DijoG
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@Jean-Romain
Comment options

@DijoG
Comment options

@DijoG
Comment options

@Jean-Romain
Comment options

@DijoG
Comment options

Answer selected by DijoG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants