added functions in SGNDArray

@iglesias @hushell
Could you help me to check this patch? Thanks!
Not for clone, it is a function of assignment. All elements are assigned the same value `val`.