covMaterniso3.cpp
Go to the documentation of this file.
00001 #include "covMaterniso3.h"
00002 
00003 using namespace Eigen;
00004 
00005 MatrixXf dist(const MatrixXf &x, const MatrixXf &z) {
00006     MatrixXf d(x.rows(), z.rows());
00007     for(int i=0; i<x.rows(); ++i) {
00008         d.row(i) = (z.rowwise() - x.row(i)).rowwise().norm();
00009     }
00010     return d;
00011 }
00012 
00013 MatrixXf covMaterniso3(const MatrixXf &x, const MatrixXf &z, double sf2, double ell, bool diag) {
00014     MatrixXf K;
00015     if(diag) {
00016         K = MatrixXf::Zero(x.rows(), 1);
00017     } else {
00018         K = dist(1.73205/ell/ell*x, 1.73205/ell/ell*z);
00019     }
00020     return ((1+K.array())*exp(-K.array())).matrix()*sf2;
00021 }
00022 


turtlebot_exploration_3d
Author(s): Bona , Shawn
autogenerated on Thu Jun 6 2019 20:57:59