作者joejoe321321 (鴟夷子皮)
看板NTU-Exam
標題[試題] 99下 林智仁 數值方法 第二次期中考
時間Tue May 10 13:04:32 2011
課程名稱︰數值方法
課程性質︰計算機運算處理
課程教師︰林智仁
開課學院:電機資訊學院
開課系所︰資工所
考試日期(年月日)︰100/05/10
考試時限(分鐘):150
是否需發放獎勵金:是
(如未明確表示,則不予發放)
試題 :
Problem 1(15%):
Give an n by n matrix A, what is
|A| = max |Ax| ?
∞ |x| = 1
∞
That is, write |A| as an expression of A's elements.
∞
Problem 2(25%):
Assume A is symmetric and invertible. Formally prove that
cond(A) >= 1
where cond(.) is the condition number. Assume 2-norm is used.
Hint: no need to check eigenvalues of matrices
Problem 3(20%):
Assume L is a lower triangular square matrix stored in the compressed row
format. That is, assume arrays val, col_ind, and row_ptr are already
available. No need to worry about declaring variables and memory allocation.
Write the MATLAB code to solve
Lx = b
We further make the following assumptions and requirements:
(1) L ≠ 0, for all i
ii
(2) In col_ind, indices of each row are in ascending order.
(3) Assume simple loops are used (It is like that you are writing
Fortran/C/Java code though you use MATLAB syntax here and assume
arrays start with index 1. Thus, you cannot use thinds such as
x(i:j), find, etc.).
(4) The complexity must be no more than O(nnz).
Problem 4(30%):
Assume a square matrix A is stroed in the compressed column format and we
would like to find
T
B = A .
We stroe B in compressed column format as well.
In the beginning, we try to find the number of non-zero elements in each
column of B:
for i=1:n+1
bcol_ptr(i) = 0;
nnz = acol_ptr(n+1)-1;
for i=1:nnz
bcol_ptr(arow_ind(i)+1) = bcol_ptr(arow_ind(i)+1) +1;
bcol_ptr(1) = 1;
for i=2:n+1
bcol_ptr(i) = bcol_ptr(i) + bcol_ptr(i-1);
Explain this segment of code and continue to finish the MATLAB code
for obtaining B.
We further make the following assumptions and requirements:
(1) Assume simple loops are used (It is like that your are writing
Fortran/C/Java code though you use MATLAB syntax and assume
arrays start with index 1. Thus, you cannot use thins such as
x(i:j), find, etc.).
(2) The complexity must be no more than O(nnz).
(3) You can use only arrays aval, arow_ind, acol_ptr, bval, bcol_ind,
brow_ptr. That is, you cannot allocate other arrays.
Problem 5(10%):
Given a linear system
[ 1 2 1] [-1]
[ 3 1 -2] x = [ 1]
[ 1 2 1] [ 2]
[0]
Use [0] as the initial point.
[0]
(a) Do three itreations of the Jacobi method
(b) Do three iterations of the Gauss-seidal method
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.29.127
1F:推 andy74139 :已收錄至資訊系!! 05/11 00:03
※ 編輯: joejoe321321 來自: 140.112.30.133 (06/02 15:12)