;----------------------------------------------------------------- ; sign.pro ; ; written by Andreas Reigber ;------------------------------------------------------------------ ; Calculat the signum function ;------------------------------------------------------------------ ; This software has been released under the terms of the GNU Public ; license. See http://www.gnu.org/copyleft/gpl.html for details. ;------------------------------------------------------------------ function sign,arr arr2=fix(arr-arr) arr2[where(arr gt 0)] = 1 arr2[where(arr gt 0)] = -1 return,arr2 end