Question: Java code for comparing Strassen's Algorithms and ordinary multiplication. The code needs to count individual multiplications to use as a basis for comparison and timing.
Java code for comparing Strassen's Algorithms and ordinary multiplication. The code needs to count individual multiplications to use as a basis for comparison and timing. it is only necessary to handle where size is a power of 2.
I know there are a lot of solutions online, but I'm looking to get the output below.
The users will provide the input (i.e txt file). The format:
The first line should contain the order of the matrix, then the first matrix, in row-major order, then the second matrix. This is followed by a blank line, then the order of the next matrix pair and so on. You need to collect enough data to have a meaningful comparison of the theoretical efficiency to the observed efficiency
Given input:
2
2 1 6 7
1 5 4 3
Output:
Naive solution:
16 17
26 22
Strassen solution:
16 17
26 22
Input Matrix 1:
2 1
1 5
Input Matrix 2:
6 7
4 3
Solutions are the same: true
n = 2
Naive multiplications: 8
Strassen multiplications: 7
Strassenadditions: 18
Strassen Mulitpications vs Naive: 0.875
Strassen setps vs Naive:3.125
Step by Step Solution
There are 3 Steps involved in it
Below is the Java code that compares Strassens Algorithm and ordinary multiplication based on the provided input format import javautilScanner public ... View full answer
Get step-by-step solutions from verified subject matter experts
