1
#include <Rcpp.h>
2
using namespace Rcpp;
3

4
// [[Rcpp::export]]
5 1
NumericMatrix resistanceDistance(NumericMatrix C, int n) {
6 1
  NumericMatrix R(n,n);
7 1
  for(int i=0; i<n; ++i){
8 1
    for(int j=i; j<n; ++j){
9 1
      R(i,j)=C(i,i)+C(j,j)-2*C(i,j);
10 1
      R(j,i)=R(i,j);
11
    }
12
  }
13 1
  return R;
14
}
15

Read our documentation on viewing source code .

Loading