MathGroup Archive 1995

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

Search the Archive

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


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