mp^:(]`(=@i.@#@[))

On 04-10-13 18:26, km wrote:
Verb mpwr calculates matrix powers .  Is there a tacit way?

  mp =: +/ . *  NB. matrix product
mpwr =: 4 : 'x mp^:y =i.#x' NB. square matrix x to integer power y A =: 1 1 ,: 1 0 A
  1 1
  1 0
     A mpwr 3
  3 2
  2 1
     A mp A mp A
  3 2
  2 1
     A mpwr _1
  0  1
  1 _1
     A mp A mpwr _1
  1 0
  0 1

--Kip Murray

Sent from my iPad

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

--
Met vriendelijke groet,
@@i = Arie Groeneveld

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to