Error Analysis of Modern Gram Schmidt Technique -code bug

In summary, the conversation is about computing A = QR using the Modified Gram-Schmidt algorithm. The person is trying to find the error using the one norm of (Q transpose * Q) - I and is sharing their code for reference. They are also mentioning an error of 1.00 and seeking help to identify the mistake in their code.
  • #1
SchrodingersMu
14
0
Hi all,

I am to compute A = QR using the Modified Gram-Schmidt algorithm. I need to find the error using

the one norm of : (Q transpose * Q) - I.

Here is my code:
Code:
%Modern Gram Schmidt
p=zeros(5,5);
e=zeros(5,5);
g=zeros(5,5);

for k=1:n;
    p(:,k)=(A(:,k));
end
%j=k, i=u, r=g, q=e, v=p
for u=1:n
    g(u,u)=norm(p(:,u),2);
    e(:,u)=p(:,u)/g(u,u);
    for k=u+1:n
        g(u,k)=e(:,u)'*p(:,k);
        p(:,k)=p(:,k)-(e(:,u)*g(u,k));
    end
end

W=((p*p')-I);
errormod=norm(W,1);

save errorMGS.dat errormod -ascii
I am getting an errormod of 1.00 . It obviously should be way less than this. I can't see what I am doing wrong, though. I modeled my code after an example proided by my prof: (The left part of the powerpoint)

upload_2015-2-26_0-15-21.png


Any help is appreciated!
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Reading through your code, it looks like you are saving the p as the full-scale matrix, where e is the normalized matrix.
Try setting p(:,u)=e(:.u) at the end of the loop for each u.
 

1. What is Error Analysis in the context of Modern Gram Schmidt Technique?

Error Analysis is a process of identifying and quantifying the errors or inaccuracies in a given method or technique. In the case of Modern Gram Schmidt Technique, it involves analyzing the code for any potential bugs or mistakes that may affect the accuracy of the results.

2. Why is Error Analysis important in Modern Gram Schmidt Technique?

Error Analysis is crucial in Modern Gram Schmidt Technique because even small errors in the code can significantly impact the accuracy of the results. This technique involves multiple iterative steps, and any mistake in the code can propagate and lead to substantial errors in the final output.

3. How can one identify code bugs in Modern Gram Schmidt Technique?

Identifying code bugs in Modern Gram Schmidt Technique involves carefully reviewing the code and looking for possible errors or inconsistencies. It also helps to test the code with different input values and compare the results with expected outputs. Additionally, using debugging tools and techniques can also help in identifying and fixing code bugs.

4. What are the consequences of not performing Error Analysis in Modern Gram Schmidt Technique?

The consequences of not performing Error Analysis in Modern Gram Schmidt Technique can be significant. The code bugs or errors can lead to inaccurate results, which can misguide the entire analysis or research. This can result in wasted time, effort, and resources. In some cases, it can even lead to incorrect conclusions and potentially harm the credibility of the research.

5. Can Error Analysis be completely eliminated in Modern Gram Schmidt Technique?

No, it is not possible to completely eliminate Error Analysis in Modern Gram Schmidt Technique or any other scientific method. However, by carefully reviewing and testing the code, using best practices, and continuously improving the code, the frequency and impact of errors can be minimized. It is also essential to document and communicate any known limitations or errors in the code to ensure transparency and credibility of the research.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
9
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
2K
  • Calculus and Beyond Homework Help
Replies
2
Views
363
  • Calculus and Beyond Homework Help
Replies
16
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
886
  • Engineering and Comp Sci Homework Help
Replies
2
Views
825
  • Engineering and Comp Sci Homework Help
Replies
6
Views
3K
  • Advanced Physics Homework Help
Replies
5
Views
1K
  • Math Proof Training and Practice
Replies
10
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
15
Views
2K
Back
Top