code: def add_projection(self, A, alpha = 1.0, beta = 1.0, reordered=False):
          
          assert self.is_factor is False, "cannot project matrix onto a cspmatrix factor"
          assert isinstance(A, matrix), "argument A must be a dense matrix"
          
          symb = self.symb
          blkval = self.blkval
  
          n = symb.n
          snptr = symb.snptr
          snode = symb.snode
          relptr = symb.relptr
          snrowidx = symb.snrowidx
          sncolptr = symb.sncolptr
          blkptr = symb.blkptr
  
          if self.symb.p is not None and reordered is False:
              A = tril(A)
              A = A+A.T
              A[::A.size[0]+1] *= 0.5
              A = A[self.symb.p,self.symb.p]
  
          # for each block ...
          for k in range(self.symb.Nsn):
              nn = snptr[k+1]-snptr[k]
              na = relptr[k+1]-relptr[k]
              nj = nn + na
               
              blkval[blkptr[k]:blkptr[k+1]] = beta*blkval[blkptr[k]:blkptr[k+1]] + alpha*(A[snrowidx[sncolptr[k]:sncolptr[k+1]],snode[snptr[k]:snptr[k+1]]][:])
          
          return
docs: Add projection of a dense matrix :math:`A` to :py:class:`cspmatrix`.
  
              X := alpha*proj(A) + beta*X