bug-apl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-apl] inner product behaviour?


From: Juergen Sauermann
Subject: Re: [Bug-apl] inner product behaviour?
Date: Sun, 16 Aug 2015 17:46:13 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

Hi,

the standard says:

If the last-item in the shape-list of A1 is not the same as the first-item in the shape-list
of B1, signal length-error.

Scalar A or B are turned into vectors, but vectors are not turned into matrices.
In your example the last dimension of A was 2 and the first dimension of B was 3.

/// Jürgen


On 08/15/2015 08:22 PM, address@hidden wrote:
Hi Bug APL,
Does the inner product coerce a vector to a matrix only when (⍴right arg vector)≤ left arg number of columns (when it is a matrix)?


      rotatemat←{2 2 ⍴ (2○⍵)(-1○⍵)(1○⍵)(2○⍵)}
      rm←rotatmat 3
VALUE ERROR
      rm←rotatmat 3
         ^
      rm←rotatemat 3
      rm
¯0.9899924966 ¯0.1411200081
 0.1411200081 ¯0.9899924966

      rm+.×(1 1) 
¯1.131112505 ¯0.8488724885
      rm+.×(1 1)(2 2)
 ¯1.272232513 ¯1.272232513  ¯1.838864985 ¯1.838864985 
      rm+.×(1 1)(2 2)(3 3)
LENGTH ERROR
      rm+.×(1 1) (2 2) (3 3)
      ^   ^
      rm+.×1 3⍴(1 1)(2 2)(3 3)
 ¯1.131112505 ¯1.131112505    ¯2.262225009 ¯2.262225009  ¯3.393337514 
      ¯3.393337514 
 ¯0.8488724885 ¯0.8488724885  ¯1.697744977 ¯1.697744977  ¯2.546617466 
      ¯2.546617466 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]