code: def _updateA(X, A, R, P, Z, lmbdaA, orthogonalize):
      
      n, rank = A.shape
      F = zeros((n, rank), dtype=A.dtype)
      E = zeros((rank, rank), dtype=A.dtype)
  
      AtA = dot(A.T, A)
  
      for i in range(len(X)):
          F += X[i].dot(dot(A, R[i].T)) + X[i].T.dot(dot(A, R[i]))
          E += dot(R[i], dot(AtA, R[i].T)) + dot(R[i].T, dot(AtA, R[i]))
  
      # regularization
      I = lmbdaA * eye(rank, dtype=A.dtype)
  
      # attributes
      for i in range(len(Z)):
          F += P[i].dot(Z[i].T)
          E += dot(Z[i], Z[i].T)
  
      # finally compute update for A
      A = solve(I + E.T, F.T).T
      return orth(A) if orthogonalize else A
docs: Update step for A