Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
using BenchmarkTools | |
function zeros_calloc{S, N}(T::Type, dims::Vararg{S, N}) | |
data = ccall((:calloc, "libc"), | |
Ptr{Void}, | |
(Csize_t, Csize_t), | |
prod(dims), sizeof(T)) | |
data == C_NULL && error("Failed to allocate memory") | |
ccall(:jl_ptr_to_array, | |
Array{T, N}, |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
% Set Helvetica Font in Text and Math in LaTeX % | |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
\renewcommand{\familydefault}{\sfdefault} | |
\usepackage[scaled=1]{helvet} | |
\usepackage[helvet]{sfmath} | |
\everymath={\sf} |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!