SInce we're at it, should this be here or in `utils.extmath`?