-
-
Save zed/7c1921a7bca7094136f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <opencv2/opencv.hpp> | |
int main(void) { | |
using namespace cv; | |
Mat m(8192, 81, CV_32FC1); | |
randu(m, Scalar(0), Scalar(1)); | |
int64 tic = getTickCount(); | |
Mat m2 = m * m.t(); | |
std::cout << (getTickCount() - tic) / getTickFrequency() << std::endl; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
m = rand(8192, 81); | |
tic; | |
result = m * m'; | |
toc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from timeit import default_timer as timer | |
m = np.random.rand(8192, 81) | |
tic = timer() | |
result = np.dot(m, m.T) | |
print (timer() - tic) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.PHONY: timeit | |
timeit: geoff.py geoff.m geoff | |
@./geoff | |
@python geoff.py | |
@octave geoff.m | |
# 9.02029 | |
# 2.83632302284 | |
# 2.10921 | |
geoff: geoff.cpp Makefile | |
g++ -O2 $< -lopencv_core -o $@ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment