X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 04 Dec 2007 03:03 PM by  anon
multiplying 3D-arrays
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
04 Dec 2007 03:03 PM
    What happens when we mutliply 3D-arrays using #?

    Deleted User



    New Member


    Posts:
    New Member


    --
    04 Dec 2007 03:03 PM
    It is the same thing that happens to when you multiply 3D-arrays by 2D-arrays using '*' - if the dimensions match IDL rules for the first "slice" of the 3D array, then it performs the multiplication on the first slice and returns just the result of the operation on that one slice. Observe: IDL> a = findgen(4,3,2) IDL> print, a[*,*,0] ; 0.000000 1.00000 2.00000 3.00000 ; 4.00000 5.00000 6.00000 7.00000 ; 8.00000 9.00000 10.0000 11.0000 IDL> b = a * (fltarr(4,3) + 10) IDL> help, b B FLOAT = Array[4, 3] IDL> print, b ; 0.000000 10.0000 20.0000 30.0000 ; 40.0000 50.0000 60.0000 70.0000 ; 80.0000 90.0000 100.000 110.000 IDL> myMatrixMultiplier = fltarr(3) + 10 IDL> c = a # myMatrixMultiplier IDL> print, c ; 120.000 150.000 180.000 210.000 IDL> print, a[*,*,0] # myMatrixMultiplier ; 120.000 150.000 180.000 210.000 There is no real matrix math operator for 3D arrays; matrices are, by definition, 1D or 2D only. James Jones
    You are not authorized to post a reply.