• Keine Ergebnisse gefunden

Programmiermethoden des Wissenschaftlichen Rechnens

N/A
N/A
Protected

Academic year: 2021

Aktie "Programmiermethoden des Wissenschaftlichen Rechnens"

Copied!
2
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Programmiermethoden des Wissenschaftlichen Rechnens

Winter semester 2018/2019 Prof. Dr. Marc Alexander Schweitzer Clelia Albrecht and Albert Ziegenhagel

Exercise sheet 4.

Exercise 28. (Regular types for linear algebra)

a) Inspect your linear algebra library from the last exercise with respect to regularity of your types. Are they already regular? If not, what is missing?

b) If your types are not yet regular, make them so.

c) What influence has the regularity of your types on the interface and implementation of operations such as addition and multiplication? Pay special attention to usability and performance. Improve your operations so that they make use of the regularity of your types. Explain what improvements you could apply to your functions because of the regularity of your types. If your types where regular already explain what properties of regularities you have used in your interfaces/implementations.

Exercise 29. (Generic types for linear algebra)

a) Make your linear algebra library generic with respect to the scalar type. Test your matrix/vector operations with at leastfloat,doubleand std::complex<double>.

b) Think about your solver library: Why is it not so easy to make it work with complex numbers as with real numbers?

c) Make your solver library generic with respect to the scalar type. Test your solvers with at leastfloat anddouble.

Exercise 30. (Revisiting B-Splines)

a) Inspect your B-Spline library from the last exercise with respect to regularity of your types. Are they already regular? If not, what is missing?

b) If your types are not yet regular, make them so.

c) What influence has the regularity of your types on the interface and implementation of your evaluation and interpolation functions? Pay special attention to usability and performance. Improve your operations so that they make use of the regularity of your types. Explain what improvements you could apply to your functions because of the regularity of your types. If your types where regular already explain what properties of regularities you have used in your interfaces/implementations.

d) Make your B-Spline library generic with respect to the scalar type and the space dimension. Test your library in 1, 2 and 3 space dimensions.

1

(2)

Exercise 31. (Inheritance for a hierarchy of solvers - individual hand-in) a) Make yourself familiar with the concept of class inheritance in C++.

b) Make sure you understood:

• Public, protected and private inheritance.

• Inheritance of interfaces vs. inheritance of implementation.

• Virtual and pure-virtual functions.

• Virtual destructors (their meaning and when/why you need them).

• Abstract classes.

• Theoverridespecifier.

c) Write a short summary (2-3 sentences per point) about class inheritance as provided by C++.

d) Design a class hierarchy for your solvers and preconditioners. How does this improve your library with respect to:

• Usability

• Performance

• Extensibility

• Readability

e) What are potential drawbacks of using polymorphism to model your solvers?

2

Referenzen

ÄHNLICHE DOKUMENTE

A map f dened on a given open convex set that is n + 1 times continuously dierentiable and is such that its derivatives are bounded is Lipschitz- n on that set (assuming that the

Together with your classmate do some brainstorming which jobs you are qualified to do after secondary vocational college?. You may browse the Internet

In the user study we only focused on the process of scanning an individual ballot and verifying that the human- readable part matches the machine-readable part. Although by

Maunsell and McAdams (2001) suggested that receptive field shifts in higher visual areas, such as area MT, spring from multiplicative attentional effects in

Late additions maintain a higher level of reduced and total glutathione towards the end of fermentation.. Addition of reduced glutathione at the start of fermentation slows

Users of the PACE TR-48 Analog Computer will find the High Speed Repetitive Operation Group a· valuable aid in the solution of a variety of computing

In 2012, the OECD and the European Commission reported that in the EU (plus Switzerland, Croatia, Iceland and Norway), there were 828 cities, including two global cities (London

Using the original interface, between 42% (ex- ploratory study) and 33% (main study) of incorrect votes were not detected because the participants did not check the return codes.