Commit e6ca645f authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

tutorial: lesson 1 InputNg has exercises

parent 30650fa9
......@@ -121,5 +121,32 @@ though, but display a message saying that the GSL is needed.
\ptexPaste{InputNg_main1}
\ptexPaste{InputNg_Recap}
\subsection*{Exercises}
We'll use stars * next to the exercise to mark the most difficult ones.
The ones marked with M may lead to mainstream inclusion.
1 In the tutorial, we printed the value of the scalar. Do the same
for the vector and the string.
2 Read a matrix from the input file. Use PsimagLite::Matrix for
the type, and use $mymatrix=[[1,2],[3,4]];$ in the input file.
Print the matrix observing that PsimagLite::Matrix has operator \verb!<<!
3* (M) The need for Writeable and Readable implies the need for
two statements for actually reading the file.
This may seem cumbersome. Therefore, create a new class, say,
MyInputNg, with a constructor that takes the filename and with
client code
\begin{lstlisting}
MyInput io(filename);
\end{lstlisting}
where now the object io can be used as Readable.
Discuss if it's better to use inheritance or not.
Discuss the private members of your class, their memory usage, and lifetime.
4 Check the tutorial for memory leaks.
\end{document}
......@@ -186,5 +186,4 @@ will remain ``default'', and no error will be issued.
\subsection*{Recap}
In this lesson we have learned, blah blah.
\subsection*{Exercises}
*/
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment