1. 学习
  2. /
  3. 课程
  4. /
  5. Optimizing R Code with Rcpp

Connected

练习

Euclidean distance from 0

For your second function, you will compute the distance from 0 to a point in a 2D space.

Unless otherwise noted, assume that Rcpp is loaded in your workspace.

说明

100 XP

Write a C++ function euclidean_distance() that takes two arguments x and y (both double) and returns another double that is the euclidian distance between (0, 0) and (x, y) points.