+\newtheorem{proposition}{Proposition}
+\newtheorem{theorem}{Theorem}
+\newtheorem{exercise}{Exercise}[chapter]
+\newtheorem{example}{Example}
+\newtheorem{definition}{Definition}
+\newtheorem{proof}{Proof}
+
+\newcommand{\mymat}[1]{\mathcal{#1}}
+\newcommand{\myvec}[1]{\mathbf{#1}}
+
+\newcommand{\mbf}{\mathbf}
+\newcommand{\mc}{\mathcal}
+\newcommand{\N}{\mathcal{N}}
+\newcommand{\B}{\mathcal{B}}
+\newcommand{\bs}{\boldsymbol}
+
+
+
+\let\OLDlstinputlisting\lstinputlisting
+\renewcommand{\lstinputlisting}[2][]{\FloatBarrier\OLDlstinputlisting[#1]{#2}\FloatBarrier}
+
+\DeclareMathOperator*{\argmax}{arg\,max}
+
+
+\lstset{morekeywords={HALF4,HALF3,float2,float3,float4,half,half2,half3,half4,tex2D,dim3,endif,threadIdx,blockIdx,blockDim,gridDim,Dim3,__host__,__global__,__shared__,float}}
+\lstset{
+ language=C,
+ columns=fixed,
+ basicstyle=\footnotesize\ttfamily,
+ numbers=left,
+ firstnumber=1,
+ numberstyle=\tiny,
+ stepnumber=5,
+ numbersep=5pt,
+ tabsize=3,
+ extendedchars=true,
+ breaklines=true,
+ keywordstyle=\textbf,
+ frame=single,
+ % keywordstyle=[1]\textbf,
+ %identifierstyle=\textbf,
+ commentstyle=\color{darkgray}\textbf,
+ stringstyle=\color{darkgray}\ttfamily,
+ % xleftmargin=17pt,
+ % framexleftmargin=17pt,
+ % framexrightmargin=5pt,
+ % framexbottommargin=4pt,
+ backgroundcolor=\color{lightgray},
+ basicstyle=\scriptsize
+ }
+
+ %% \lstset{
+%% basicstyle=\footnotesize\ttfamily, % Standardschrift
+%% %numbers=left, % Ort der Zeilennummern
+%% numberstyle=\tiny, % Stil der Zeilennummern
+%% %stepnumber=2, % Abstand zwischen den Zeilennummern
+%% numbersep=5pt, % Abstand der Nummern zum Text
+%% tabsize=2, % Groesse von Tabs
+%% extendedchars=true, %
+%% breaklines=true, % Zeilen werden Umgebrochen
+%% keywordstyle=\color{red},
+%% frame=b,
+%% % keywordstyle=[1]\textbf, % Stil der Keywords
+%% % keywordstyle=[2]\textbf, %
+%% % keywordstyle=[3]\textbf, %
+%% % keywordstyle=[4]\textbf, \sqrt{\sqrt{}} %
+%% stringstyle=\color{white}\ttfamily, % Farbe der String
+%% showspaces=false, % Leerzeichen anzeigen ?
+%% showtabs=false, % Tabs anzeigen ?
+%% xleftmargin=17pt,
+%% framexleftmargin=17pt,
+%% framexrightmargin=5pt,
+%% framexbottommargin=4pt,
+%% %backgroundcolor=\color{lightgray},
+%% showstringspaces=false % Leerzeichen in Strings anzeigen ?
+%% }
+%% \lstloadlanguages{% Check Dokumentation for further languages ...
+%% %[Visual]Basic
+%% %Pascal
+%% C
+%% %C++
+%% %XML
+%% %HTML
+%% %Java
+%% }
+%% %\DeclareCaptionFont{blue}{\color{blue}}
+
+%% %\captionsetup[lstlisting]{singlelinecheck=false, labelfont={blue}, textfont={blue}}
+\DeclareCaptionFont{white}{\color{white}}
+\DeclareCaptionFormat{listing}{\colorbox[cmyk]{0.43, 0.35, 0.35,0.01}{\parbox{\textwidth}{\hspace{15pt}#1#2#3}}}
+\captionsetup[lstlisting]{format=listing,labelfont=white,textfont=white, singlelinecheck=false, margin=0pt, font={bf,footnotesize}}
+