{% macro simple_tabular(X,xlabels,ylabels, corner ="", multicolumn=None, split=True) %}
{% set nx = X.shape[1] + 1 %}
{% set ny = X.shape[0] + 1 %}
\begin{tabular}{c{{'|' if split else '' }}{{ 'c' * nx }} }		\toprule
{%- if multicolumn %}
{% for m in multicolumn %}
{% if loop.index > 1 %}& {% endif %}
{% if m[0] > 1 %} \multicolumn{{m[0]|bracket}}{c}{{m[1]|bracket}} {% endif %}
{%- endfor -%} \\
{%- set ncounts = [] -%}
{% for m in multicolumn -%}
{%- if m[0] > 1 -%}
\cmidrule(r){ {{ncounts|sum +1}}-{{ncounts|sum + m[0]}} }
{%- endif -%}
{% if ncounts.append(m[0]) %} {% endif %}
{%- endfor -%}
{% endif %}
{% if xlabels is not none and len(xlabels) > 0 %} {{ corner}} {% for j in range(nx-1) %} & {{ xlabels[j] }} {% endfor %} \\ \hline {% endif %}
{% for i in range(ny-1) %}
{{ ylabels[i]  }}
{% for j in range(nx-1) %} & {{ '%.0f'%X[i,j] if ceil(X[i,j]) == floor(X[i,j]) else X[i,j]}} {% endfor %} \\
{% endfor %}
\bottomrule
\end{tabular}
{% endmacro %}


{% macro array(X) -%}
{% set X = ensure_numpy(X) %}
{% for i in range(X.shape[0]) %}
{% if i > 0 %} \\{% endif %}{% for j in range(X.shape[1]) %}{% if j > 0 %} & {% endif %}{{X[i,j]}} {% endfor %}
{% endfor %}
	{% if X.shape[0] == 0 %}
\,
	{% endif %}
{%- endmacro %}

{% macro bmatrix(X) -%}
\begin{bmatrix}{{ array(X)}}\end{bmatrix}
{%- endmacro %}
