function out = spbroadcast(A,b)
  % ========================
  % https://guiard.org/pages/octave/spbroadcast.html
  % =========================
  %
  % Elementwise matrix multiplication with sparse matrix A and vector b
  % Version 1.00
  %
  % A: sparse matrix
  % b: vectorize

  R = spdiags (vec(b),0,length(b),length(b));

  out = -1;

  if iscolumn(b)
    out = R*A;
  endif

  if isrow(b)
    out = A*R;
  endif

endfunction

