implement compatibility with sparse matrices

Status Name Job ID Coverage
  Static Checks
canceled check_no_asserts #1373866

 
  Build Docker
canceled build_docker_from_cache #1373867

 
  Test
canceled test_mpi #1373869

canceled test_serial #1373868

 
  Demo Runs
canceled run_bernoulli #1373877

canceled run_curve_fitting #1373878

canceled run_getting_density #1373876

canceled run_getting_started_1 #1373872

canceled run_getting_started_2 #1373873

canceled run_getting_started_3 #1373874

canceled run_getting_started_mf #1373875

canceled run_ipynb0 #1373870

canceled run_ipynb1 #1373871

canceled run_meanfield #1373880

canceled run_nonlinearity_guide #1373881

canceled run_visual_vi #1373879