[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug in sprsin() for IDL 5.3?



I think I may have found a bug in sprsin() for IDL 5.3 (RSI version).  I
am running IDL on Linux with a 2.2 kernel.  Version 5.3 of IDL
introduced a new way to create a sparse matrix; now you can create one
without having to create a regular matrix first.  The syntax is:

  Result = SPRSIN( Columns, Rows, Values, N [, /DOUBLE] [, THRESH=value] )

where N is the dimension of the matrix.  Also, any matrix element whose
absolute value is less that THRESH is supposed to be set to zero.  

It appears that the comparison forgets to take the absolute value of the
matrix element, and so all negative input values are set to zero.
Setting THRESH to a negative number seems to alleviate the problem.  To
wit:

IDL> columns = [1,2,0]
IDL> rows = [0,1,2]
IDL> values = [1.0,-1.0,-0.1]
IDL> sprs_matrix = sprsin(columns, rows, values, 3)
IDL> print, fulstr(sprs_matrix)
      0.00000      1.00000      0.00000
      0.00000      0.00000      0.00000
      0.00000      0.00000      0.00000
IDL> sprs_matrix = sprsin(columns, rows, values, 3, THRESH=-10.0)
IDL> print, fulstr(sprs_matrix)
      0.00000      1.00000      0.00000
      0.00000      0.00000     -1.00000
    -0.100000      0.00000      0.00000

Has anyone else seen this bug on a different platform?  Setting THRESH
to a negative number solves this particular problem, but is it possible
that this kludge might introduce a different problem down the road?

Thanks in advance for any help.  I am new to the newsgroup, so I hope
this message conforms to your standards.

Jordan


-- 
Jordan Koss
j-koss@uchicago.edu