Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: sparsearray and its nonempty cells

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72626] Re: sparsearray and its nonempty cells
  • From: dh <dh at metrohm.ch>
  • Date: Fri, 12 Jan 2007 06:29:56 -0500 (EST)
  • References: <eo4oa3$mhi$1@smc.vnet.net>

Hi Arek,
if you say: Mysparse // FullForm you will see that the array is not 
stored in ascending order as you imply. To get your output sorted, 
simply wrap Sort around it.
Daniel

Arkadiusz.Majka at gmail.com wrote:
> Hi,
> 
> I bulit the following sparse array
> 
> Mysparse=SparseArray[i_ /; 2 â?¤ i â?¤ 11 :> 0.8, 20]
> 
> in order to find out all nonempty cells in this array I call (I want to
> avoid Normal)
> 
> 
> Mysparse/. SparseArray[_, _, _, x_] :> x[[2, 2]]
> 
> and I get
> 
> {{8}, {11}, {3}, {7}, {2}, {6}, {10}, {9}, {5}, {4}}
> 
> This is of course correct, but why it is not sorted????
> 
> How can I build Mysparse to get sorted list of nonempty cells?
> 
> Arek
> 


  • Prev by Date: 16bit image writing
  • Next by Date: Re: Re: question on Plot and Show plus Axis Labels
  • Previous by thread: Re: sparsearray and its nonempty cells
  • Next by thread: Re: sparsearray and its nonempty cells