• Keine Ergebnisse gefunden

A lower triangular matrixL∈Rn×n with L

N/A
N/A
Protected

Academic year: 2021

Aktie "A lower triangular matrixL∈Rn×n with L"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Dirk Praetorius, Sommersemester 2018

Gregor Gantner 12.06.2018

Ubungen zur Vorlesung¨

Einf¨uhrung in das Programmieren f¨ur TM Serie 11

Aufgabe 11.1. A lower triangular matrixL∈Rn×n with

L=

`11 0

`21 `22

`31 `32 `33

... ... ... . ..

`n1 `n2 `n3 . . . `nn

has at most n(n+1)2 =Pn

j=1jnontrivial coefficients. Write a classmatrixLto save the coefficientsLij in a dynamical vector with length n(n+1)2 together with the dimension n∈N. Save the matrixL row-wise.

Implement the following features:

• constructor, copy-constructor, destructor,

• assignment operator,

• access to the coefficients via L(i,j)and

• the possibility to print a lower triangular matrixLon screen viacout << L.

Moreover, write a main-program to test your implementation.

Aufgabe 11.2. Overload the operator + for the class MatrixL from Exercise 11.1 to be able to add to lower triangular matrices with matching dimensions. Moreover, write a main-programm to test your implementation.

Aufgabe 11.3. Overload the operator*to compute the matrix-vector-producty=L*xof a lower trian- gular matrix Land a vector x. Here, let L be of the type MatrixL from exercise 11.1 andx an object of the class Vector from the lecture (cf. Slide 306ff). Access non-trivial entries of the matrix L only!

Moreover, write a main program in order to test your implementation accurately.

Aufgabe 11.4. Use the formula for the matrix-matrix product to show that the product of two lower triangular matrices is a lower triangular matrix. Then, overload the operator * for the class MatrixL from Exercise 11.1 to be able to perform the matrix-matrix product for two lower triangular matrices with matching dimensions. Moreover, write a main-program to test your implementation.

Aufgabe 11.5. LetL∈Rn×n be a lower triangular matrix such that `jj 6= 0 for all 1≤j ≤n. Given b∈Rn, there exists a uniquex∈Rn such that Lx=b. Implement also the feature to solve the system Lx=bfor a lower triangular matrixL∈Rn×nand a vectorb∈Rnby using the commandx=L|b.Lhas the typeMatrixLfrom Exercise 11.1 andbhas the well-known typeVectorfrom the lecture. Moreover, write a main-program to test your implementation.

Aufgabe 11.6. What is the computational cost to solve a linear equation system like in exercise 11.5?

Write down your results in theO-notation.

Aufgabe 11.7. Adapt the Code from the classMatrixL from Exercise 11.1, so that newresp.delete is used instead of mallocresp. free(if you have not already implemented it that way). What are the differences betweennewresp.deleteandmallocresp.free? What is the “Rule of three“ saying? Why is this rule important in that context?

(2)

Aufgabe 11.8. Write aMakefilefor the exercises of this sheet. It should contain:

• The compilation of all solved exercises.

• The generation of a library and an example of its usage.

Referenzen

ÄHNLICHE DOKUMENTE

Although a mathematical insider of such methods would be able to produce lower bounds on the GHZ- type entanglement in some generic cases the problem for the practitioner has

We have used periodic orbit theory to analyze a strong enhancement of shell effects in a nonintegrable billiard sys- tem, which is closely connected to the bifurcation of a peri-

Reverse Std. Selectable cursor blinking Std. Addressable/readable cursor Both std. Addressable only Both std. Protected format Std. Partial screen transmit Std. No No

No 45 Gero Erdmann: Ethnicity, Voter Alignment and Political Party Affiliation – an African Case: Zambia; March 2007. No 44 Andreas Ufen: Political Party and Party

From the hint we need only note that if the matrix is a upper triangular matrix, then the Komatrix will be a lower triangular matrix, as removing the ith column and jth row, when (i,

Among males, the return to the usual or reference years of education for the native born is 12.3 percent (see Table 2, column (ii)), which is almost five percentage points higher

Bransfield Strait, HM: Hesperides Mouth, SOP: South Orkney Plateau, OP: Orkney Passage, BP: Bruce Passage, DP: Discovery Passage, SIR: South Indian Ridge, EL: Enderby Land. Water

The implementation of this policy requires monetary authority to commit into a forward guidance policy that keeps in‡ation target above its long-run level even after the demand