MathGroup Archive 2011

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

Search the Archive

Re: Find position of nonzero elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120357] Re: Find position of nonzero elements
  • From: Oliver Ruebenkoenig <ruebenko at wolfram.com>
  • Date: Wed, 20 Jul 2011 06:30:57 -0400 (EDT)
  • References: <201107191053.GAA10147@smc.vnet.net>

On Tue, 19 Jul 2011, Dominic Wörner wrote:

> Hi,
>
> How can I find the indices i and j of all nonzero elements of a matrix.
> I want that because there are only some nonzero elements in a huge
> matrix.
>
> Best regards,
> Dominic

Dominic,

how about

sa = SparseArray[IdentityMatrix[4]]
sa["Properties"]
sa["NonzeroPositions"]

Oliver

>
>


  • Prev by Date: remarks on significance arithmetic implementation [Was: Re: Numerical accuracy/precision - this is a bug or a feature?]
  • Next by Date: Re: Find position of nonzero elements
  • Previous by thread: Find position of nonzero elements
  • Next by thread: Re: Find position of nonzero elements