Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please design a function to calculate the matrix multiplication PYTHON CODE: you need to design a matrix multiplication function MaxProduct() There are two inputs (A,B)

Please design a function to calculate the matrix multiplication PYTHON CODE:

you need to design a matrix multiplication function "MaxProduct()"

There are two inputs (A,B) and one ouput (the production of the two input A*B).

Assume all the inputs and test cases are orgnized in the format of 2-D array, i.e., row vector is a matrix with only 1 row and colomn vector is a matrix with only 1 column.

Assume the inputs are both matrix, you need to first check if the demension of the two matrix meets the requirment or not. If so, you will calculation the multiplication of the two. Otherwise please display the error info.

Assume one of the input could be a vector, you need to make sure your code could also work.

Assume both of the inputs could be vector, you need to make sure your code could also work

---------------------------------------------------------

def MaxProduct(A,B):

# Please add your code below

return C

# do not change the following code. Please use the following code to test your code.

a=[[1,2],[3,4],[5,6],[7,8]]

b=[[1,2,3],[1,2,3]]

c=[[1,2,3]]

d=[[1],[2]]

e=[[2,3,4,5,6]]

print(MaxProduct(a,b))

print(MaxProduct(b,a))

print(MaxProduct(a,c))

print(MaxProduct(a,d))

print(MaxProduct(c,a))

print(MaxProduct(d,c))

print(MaxProduct(b,e))

print(MaxProduct(e,d))

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

Recommended Textbook for

Advances In Spatial And Temporal Databases 8th International Symposium Sstd 2003 Santorini Island Greece July 2003 Proceedings Lncs 2750

Authors: Thanasis Hadzilacos ,Yannis Manolopoulos ,John F. Roddick ,Yannis Theodoridis

2003rd Edition

3540405356, 978-3540405351

Students also viewed these Databases questions

Question

=+/ Is this objective clearly measurable?

Answered: 1 week ago