abstract gradient squares