Add SparseAE and complete compute_cost