Directly pass sparsity.maps to build_sparsity_pattern
Use typed memory views instead of malloc'ing by hand