The energy of graphs and matrices