Question: We are not supposed to use numpy, i don't think. At least for the question that says we can't use the built in matrix multiplication

 We are not supposed to use numpy, i don't think. At
We are not supposed to use numpy, i don't think. At least for the question that says we can't use the built in matrix multiplication of python.

Problem 1 Write a function matrix_multiply in Python. The function should take in 2 inputs: matrix X and Y. (2pts) Test to see if the dimensions of the 2 input matrices are eligible for multiplication X* Y. If not, display an error message. (2pts) Calculate matrix Z=X*Y. You CAN NOT use the built in matrix multiplication of Python. Doing this get no credits. (Remember for loops?) (5pts) Output matrix Z (2pts) In your code, write: matrix_multiply(X,Y) (1pts) Problem 2 Write a Python function my_quadratic: The function takes 3 input: Hessian matrix Q, vector b, and vector x. (2pts) Test to see if the inputs have proper dimension dimensions of vectors are not correct. (2pts) Print an error message if the Function returns 2 ouput: first is the quadratic function value evaluated at point x, second is the gradient of the function at point x. (6pts) Test to see if the quadratic is convex or not. Display a message if it is convex or not. You can use the a built-in function in Python that returns the eigenvalues of a matrix A. (5pts). Problem 3 The fused lasso regularization for a vector x is defined as follow: FL(x) = - 12 + Skin where l-li denotes absolute value. Write a function fused_lasso that inputs a vector x and return the value of FL(x). You can not use built-in function. (5pts)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!