Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 . Write a function that accepts a matrix A and a positive integer s . Use your function from Problem 1 or scipy.linalg.svd

Problem 3. Write a function that accepts a matrix A and a positive integer s.
Use your function from Problem 1 or scipy.linalg.svd() to compute the compact SVD
of A, then form the truncated SVD by stripping off the appropriate columns and entries
from U1,1, and V1. Return the best rank s approximation As of A(with respect to the
induced 2-norm and Frobenius norm).
Also return the number of entries required to store the truncated form widehat(U)widehat()widehat(V)H(where widehat()
is stored as a one-dimensional array, not the full diagonal matrix). The number of entries
stored in NumPy array can be accessed by its size attribute.
If s is greater than the number of nonzero singular values of A(meaning s>rank(A)),
raise a ValueError.
Use np.linalg.matrix_rank() to verify the rank of your approximation.
image text in transcribed

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

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

Students also viewed these Databases questions