Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public static void main(String[] args) { int firstarray[][] = {{1, 2, -2, 0}, {-3, 4, 7, 2}, {6, 0, 3, 1}}; int secondarray[][] = {{-1,

public static void main(String[] args) {

int firstarray[][] = {{1, 2, -2, 0}, {-3, 4, 7, 2}, {6, 0, 3, 1}};

int secondarray[][] = {{-1, 3}, {0, 9}, {1, -11}, {4, -5}};

int [][] result = new int[firstarray.length][secondarray[0].length];

for (int i = 0; i < firstarray.length; i++) {

for (int j = 0; j < secondarray[0].length; j++) {

for (int k = 0; k < firstarray[0].length; k++) {

result[i][j] += firstarray[i][k] * secondarray[k][j];

}

}

}

}

IN JAVA

Please uses parallelStreams() in java to parallelize the for loops for matrix multiplication. It says you cannot use paralleStreams on ints. If that is true please adjust starter code

example of parallelstreams

firstarray.parallelStream().forEach(i->{

System.out.println("hi");

});

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are the steps in the performance appraisal process?

Answered: 1 week ago

Question

Explain in detail the developing and developed economy of India

Answered: 1 week ago

Question

Problem: Evaluate the integral: I = X 52+7 - 1)(x+2) dx

Answered: 1 week ago

Question

What is gravity?

Answered: 1 week ago

Question

What is the Big Bang Theory?

Answered: 1 week ago

Question

Do you currently have a team agreement?

Answered: 1 week ago

Question

c. How is trust demonstrated?

Answered: 1 week ago

Question

c. Will leaders rotate periodically?

Answered: 1 week ago