On 6/6/2009 6:02 PM Keith Goodman apparently wrote:
>> def fill_diag(arr, value):
>     if arr.ndim != 2:
>         raise ValueError, "Input must be 2-d."
>     if arr.shape[0] != arr.shape[1]:
>         raise ValueError, 'Input must be square.'
>     arr.flat[::arr.shape[1]+1] = value


You might want to check for contiguity.
See diagrv in pyGAUSS.py:
http://code.google.com/p/econpy/source/browse/trunk/pytrix/pyGAUSS.py

Alan Isaac

_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to