Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE THE CODE IN C++ Write a code that implements both the classical and the modified GramSchmidt orthogonalization to find the reduced QR factorization of

WRITE THE CODE IN C++

Write a code that implements both the classical and the modified GramSchmidt orthogonalization to find the reduced QR factorization of a given matrix A. Your code should detect if the columns are linearly dependent and abort with an appropriate message.

To detect linear dependence of the column vectors, it's sufficient to check for zero before normalizing vectors vj in the Classical Gramm-Schmidt (CGS), vi in the Modified Gramm-Schmidt (MGS) and vk in the Householder (H) methods, respectively. At least for CGS and MGS it should be clear that zero length of these vectors means that they are in the span of all previous q vectors. Recall that for each j=1:n, span{a1,..,aj} = span{q1,...,qj}. So in short, in CGS you have to stop the routine if rjj=0; likewise in MGS if rii=0; in H if norm(vk)=0.

image text in transcribed

image text in transcribed

Classical Gram-Schmidt orthogonalization Let Aj, j = l, .. ., n be linearly independent vectors. for j=1,2, ,n for i = 1 , 2. ,j-1 end end Modified Gram-Schmidt orthogonalization Let AN = 1, , n be linearly independent vectors. for j =1,2, ,n for i = 1 , 2. . J-1 y = y-rijq end Classical Gram-Schmidt orthogonalization Let Aj, j = l, .. ., n be linearly independent vectors. for j=1,2, ,n for i = 1 , 2. ,j-1 end end Modified Gram-Schmidt orthogonalization Let AN = 1, , n be linearly independent vectors. for j =1,2, ,n for i = 1 , 2. . J-1 y = y-rijq end

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