Add sign function; fix scalar transpose