\RequirePackage{amsmath}
\RequirePackage{amsfonts}
\RequirePackage{bm}
\RequirePackage[bbsymbols]{bboldx}
\RequirePackage{mleftright}
\RequirePackage{xcolor} 
\newcommand{\term}[1]{\emph{\color{emphcolor}#1}}

\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\card}[1]{\left\lvert#1\right\rvert}

\DeclareOption{mlr}{
    % Use mleft, mright versions for vertical delimiters
    \renewcommand{\norm}[1]{\mleft\lVert#1\mright\rVert}
    \renewcommand{\card}[1]{\mleft\lvert#1\mright\rvert}
}
\DeclareOption{bmbold}{ 
    % Use bm instead of computer modern bf for boldface symbols
    \let\mathbf\relax
    \newcommand{\mathbf}[1]{\bm{#1}}
}
\DeclareOption{amsbb}{
    % Revert to AMS blackboard font for mathbb symbols
    \let\mathbb\relax
    \DeclareSymbolFontAlphabet{\mathbb}{AMSb}
}
\ProcessOptions\relax

\newcommand{\set}[1]{\left\{ {#1} \right\}}
\newcommand{\floor}[1]{\left\lfloor {#1} \right\rfloor}
\newcommand{\inprod}[2]{\left\langle{#1},{#2}\right\rangle}
\newcommand{\commentout}[1]{}
\newcommand{\TODO}[1]{{\color{red} [TODO: {#1}]}}

\def\vzero{{\bm{0}}}
\def\vone{{\bm{1}}} 
\def\va{{\bm{a}}}
\def\vb{{\bm{b}}}
\def\vc{{\bm{c}}}
\def\vd{{\bm{d}}}
\def\ve{{\bm{e}}}
\def\vf{{\bm{f}}}
\def\vg{{\bm{g}}}
\def\vh{{\bm{h}}}
\def\vi{{\bm{i}}}
\def\vj{{\bm{j}}}
\def\vk{{\bm{k}}}
\def\vl{{\bm{l}}}
\def\vm{{\bm{m}}}
\def\vn{{\bm{n}}}
\def\vo{{\bm{o}}}
\def\vp{{\bm{p}}}
\def\vq{{\bm{q}}}
\def\vr{{\bm{r}}}
\def\vs{{\bm{s}}}
\def\vt{{\bm{t}}}
\def\vu{{\bm{u}}}
\def\vv{{\bm{v}}}
\def\vw{{\bm{w}}}
\def\vx{{\bm{x}}}
\def\vy{{\bm{y}}}
\def\vz{{\bm{z}}}
\def\mA{{\bm{A}}}
\def\mB{{\bm{B}}}
\def\mC{{\bm{C}}}
\def\mD{{\bm{D}}}
\def\mE{{\bm{E}}}
\def\mF{{\bm{F}}}
\def\mG{{\bm{G}}}
\def\mH{{\bm{H}}}
\def\mI{{\bm{I}}}
\def\mJ{{\bm{J}}}
\def\mK{{\bm{K}}}
\def\mL{{\bm{L}}}
\def\mM{{\bm{M}}}
\def\mN{{\bm{N}}}
\def\mO{{\bm{O}}}
\def\mP{{\bm{P}}}
\def\mQ{{\bm{Q}}}
\def\mR{{\bm{R}}}
\def\mS{{\bm{S}}}
\def\mT{{\bm{T}}}
\def\mU{{\bm{U}}}
\def\mV{{\bm{V}}}
\def\mW{{\bm{W}}}
\def\mX{{\bm{X}}}
\def\mY{{\bm{Y}}}
\def\mZ{{\bm{Z}}}

\newcommand{\gradx}{\nabla_{\!\vx\,}}
\newcommand{\grady}{\nabla_{\!\vy\,}}
\newcommand*{\zero}{\mathbf{0}}
\newcommand*{\id}{\mI}
\newcommand*{\mLam}{\bm{\Lambda}}
\newcommand*{\mSig}{\bm{\Sigma}}
\newcommand*{\mPhi}{\bm{\Phi}}
\newcommand*{\vdelta}{\bm{\delta}}
\newcommand*{\veps}{\bm{\epsilon}}
\newcommand*{\vzeta}{\bm{\zeta}}
\newcommand*{\vtheta}{\bm{\theta}}
\newcommand*{\vmu}{\bm{\mu}}
\newcommand*{\vomega}{\bm{\omega}}
\newcommand*{\range}{\mathcal{R}}
\newcommand*{\nullsp}{\mathcal{N}}
\newcommand*{\nn}{\mathbb{N}}
\newcommand*{\zz}{\mathbb{Z}}
\newcommand*{\Qq}{\mathbb{Q}}
\newcommand*{\rr}{\mathbb{R}}
\newcommand*{\cc}{\mathbb{C}}
\newcommand*{\sS}{\mathbb{S}}
\newcommand*{\sym}{\mathbb{S}}
\newcommand*{\prob}{\mathbb{P}}

\let\oldRe\Re 
\let\oldIm\Im
\let\Re\relax
\let\Im\relax
\let\limsup\relax
\let\liminf\relax
\DeclareMathOperator*{\Re}{Re}
\DeclareMathOperator*{\Im}{Im}
\DeclareMathOperator*{\limsup}{limsup}
\DeclareMathOperator*{\liminf}{liminf}
\DeclareMathOperator*{\argmax}{argmax}
\DeclareMathOperator*{\argmin}{argmin}
\DeclareMathOperator*{\argminimax}{argminimax}
\DeclareMathOperator{\prox}{prox}
\DeclareMathOperator{\fixpt}{Fix}
\DeclareMathOperator{\dom}{dom}
\DeclareMathOperator{\graph}{graph}
\DeclareMathOperator{\epi}{epi}
\DeclareMathOperator{\rank}{rank}
\DeclareMathOperator{\trace}{\mathbf{tr}}
\DeclareMathOperator{\diag}{diag}
\DeclareMathOperator{\spec}{spec}
\DeclareMathOperator{\intr}{int}
\DeclareMathOperator{\dist}{dist}
\DeclareMathOperator{\relint}{relint}
\DeclareMathOperator{\expt}{\mathbb{E}}