Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1995
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1995

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

Search the Archive

Re: Re: Summary:Ways to get Odd Columns&Rows of Matrix

  • To: mathgroup at christensen.cybernetics.net
  • Subject: [mg1047] Re: [mg715] Re: Summary:Ways to get Odd Columns&Rows of Matrix
  • From: Allan Hayes <hay at haystack.demon.co.uk>
  • Date: Wed, 10 May 1995 08:35:36 -0400

Count Dracula, <lk3a at kelvin.seas.virginia.edu>,
[mg715] Re: Summary:Ways to get Odd Columns&Rows of Matrix

Gives the definition

	odd[tensor_List] :=
  		Part[ tensor,
	     		 Sequence @@ (Range[1, #, 2] &) /@  
Dimensions[tensor]
		]
		
Since Range has the attribute Listable this can be tidied up to

	odd2[tensor_List] :=
  		Part[ tensor,  Sequence @@ Range[1,  
Dimensions[tensor], 2]  ]
	
There is  little, if any, effect on the speed.
	
Allan Hayes
hay at haystack.demon.co.uk


  • Prev by Date: Switch Axis?
  • Next by Date: Integrate bug and workaround
  • Previous by thread: Re: Switch Axis?
  • Next by thread: Integrate bug and workaround