[mlpack-git] [mlpack/mlpack] Descriptive Statistics command-line program (#742)

Tham notifications at github.com
Fri Jul 29 03:45:51 EDT 2016


> +* Calculates the sum of deviations to the Nth Power
> +*
> +* @param input Vector that captures a dimension of a dataset
> +* @param rowMean Mean of the given vector.
> +* @return sum of nth power deviations
> +*/
> +double SumNthPowerDeviations(const arma::rowvec& input,
> +    const double& rowMean,
> +    const size_t Nth) // Degree of Power
> +{
> +  double sum = 0;
> +  for (size_t i = 0; i < input.n_elem; ++i)
> +  {
> +    sum += pow(input(i) - rowMean, Nth);
> +  }
> +  return sum;

This one could be vectorize, which performance is better need to measure, but it should make the codes shorter and easier to read.

```
return arma::sum(arma::pow(input - rowMean,
                             static_cast<double>(Nth)));
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/mlpack/mlpack/pull/742/files/27ac82e876c3d68637d9e72d28bf0dadbc229ace#r72753244
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.cc.gatech.edu/pipermail/mlpack-git/attachments/20160729/12154c73/attachment.html>


More information about the mlpack-git mailing list