/* * call-seq: * dvector[int] = number * dvector[start, length] = number or a_dvector or an_array or nil * dvector[range] = number or a_dvector or an_array or nil * * Element Assignment---Sets the element at index _int_, * or replaces a subvector starting at _start_ and * continuing for _length_ elements, or replaces a subvector * specified by _range_. Returns the assigned object as value. * If indices are greater than * the current capacity of the vector, the vector grows * automatically by adding zeros. Negative indices will count backward * from the end of the vector. Inserts elements if _length_ is * zero. If +nil+ is used in the second and third forms, * deletes elements from _dvector_. A 1D Array of numbers can be used on the right in the second * and third forms in place of a Dvector. An +IndexError+ is raised if a * negative index points past the beginning of the vector. See also * <code>Dvector#push</code>, and <code>Dvector#unshift</code>. * * a = Dvector.new * a[4] = 4; -> Dvector[ 0, 0, 0, 0, 4 ] * a[0, 3] = [ 1, 2, 3 ] -> Dvector[ 1, 2, 3, 0, 4 ] * a[1..2] = [ 1, 2 ] -> Dvector[ 1, 1, 2, 0, 4 ] * a[0, 2] = -1 -> Dvector[ -1, 2, 0, 4 ] * a[0..2] = 1 -> Dvector[ 1, 4 ] * a[-1] = 5 -> Dvector[ 1, 5 ] * a[1..-1] = nil -> Dvector[ 1 ] */ VALUE dvector_aset(int argc, VALUE *argv, VALUE ary) {