필터 지우기
필터 지우기

How to code block lanczos algorithm?

조회 수: 11 (최근 30일)
Omar B.
Omar B. 2021년 6월 29일
편집: Omar B. 2021년 7월 2일
  댓글 수: 1
Omar B.
Omar B. 2021년 6월 30일
Any help would be much appreciated.

댓글을 달려면 로그인하십시오.

답변 (1개)

Steven Lord
Steven Lord 2021년 6월 29일
function [T]=bsymLanczos2(A,v,m)
m=13;
n=100;
r = -5 + (5+5).*rand(n);
A = triu(r) + triu(r,1)';
v=rand(n,2); % 2*2 block vector
You ask the user to pass A, v, and m into your function then promptly throw the user-specified values in the garbage and use other values. If you're creating these to test that your function works correctly move them out of the bsymLanczos2 function and pass the variables created by running these lines into bsymLanczos2 as input arguments.
I'm also assuming there are some lines of code beyond what you've posted, as the code as written will only return an all zero matrix. All the code that calculates the alpha, delta, and V arrays has no impact on what bsymLanczos2 returns.
Since I'm guessing this is homework, to check that your code works as you expect see if your textbook has any examples worked out step by step. If it does run your code on the data from one or more of those examples using the debugging tools in MATLAB to step through the code line by line. Check that at each step you get the same answer as in the textbook example and if you don't that you understand why not.
  댓글 수: 1
Omar B.
Omar B. 2021년 6월 29일
This is not a homework. I just asked how to initialize a block vectoer because I wrote V(:,:,1) and was not sure about this. Also how to write detla and alpha as block values. I did not post the whole code I need first to find all delta and aplha and then get the matrix T.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Sources에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by