diagonal function update