jacobian

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 879128a1e0e33613f443252ce125f9681aa70e46
parent 4d9a93e3a40b568021b0c671ca2fbc5f300616ea
Author: David Freifeld <freifeld.david@gmail.com>
Date:   Tue, 30 Jun 2020 21:00:09 -0700

Beginnings of Strassen tests

Diffstat:
Atests/strassen.cpp | 25+++++++++++++++++++++++++
1 file changed, 25 insertions(+), 0 deletions(-)

diff --git a/tests/strassen.cpp b/tests/strassen.cpp @@ -0,0 +1,25 @@ +// +// strassen.cpp +// Experimental benchmarking of Strassen's Algorithm vs plain Eigen matrix multipy +// +// While naive multiplication is O(n^3), Strassen's Algorithm for matrix multiply is O(n^2.8074) +// which means significant differences will begin to manifest for large matrices. All faster algorithms are galactic. +// + +#include <Eigen/Dense> + +// Not extensible, just initial test. +Eigen::MatrixXd strassen_mul(Eigen::MatrixXd a, Eigen::MatrixXd b) +{ + block_len = a.rows()/4; +} + +Eigen::MatrixXd a = Eigen::MatrixXd::Random(5000, 5000); +Eigen::MatrixXd b = Eigen::MatrixXd::Random(5000, 5000); + +auto eigen_begin = std::chrono::high_resolution_clock::now(); +Eigen::MatrixXd product = a * b; +auto eigen_end = std::chrono::high_resolution_clock::now(); + +auto strassen_begin = std::chrono::high_resolution_clock::now(); +auto strassen_end = std::chrono::high_resolution_clock::now();