Skip to content

Instantly share code, notes, and snippets.

View qutab's full-sized avatar

Muhammad Qutab-ud-din qutab

  • Tampere, Finland
View GitHub Profile
enp100s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.168.49.139 netmask 255.255.255.0 broadcast 10.168.49.255
inet6 fe80::7e31:2284:8ad9:49b4 prefixlen 64 scopeid 0x20<link>
ether 48:21:0b:3b:f3:b1 txqueuelen 1000 (Ethernet)
RX packets 173370263 bytes 16832781816 (16.8 GB)
RX errors 0 dropped 62936960 overruns 0 frame 0
TX packets 3568410 bytes 832004594 (832.0 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0x84200000-842fffff
@qutab
qutab / imperative_rms.cpp
Created May 25, 2019 22:22
Imperative RMS
void square(std::vector<double>& v)
{
std::transform(v.begin(), v.end(), v.begin(), [](double d) { return d*d; });
}
double rms(std::vector<double>& v)
{
square(v);
double the_mean = mean(v);
double the_rms = std::sqrt(the_mean);