# matrix multiplication question

From: Sam McClatchie (NOAA Federal) <sam.mcclatchie_at_nyahnyahspammersnyahnyah>
Date: Mon Jun 24 2013 - 10:25:47 MDT

Thanks Mary

I ran a test to see if this was doing what I need, and this is the result.

ncl 33> curl=(/ (/ (/1.,2.,3./), (/1.,2.,3./), (/1.,2.,3./) /), (/
(/1.,2.,3./)
ncl 33> print(curl)

Variable: curl
Type: float
Total Size: 72 bytes
18 values
Number of Dimensions: 3
Dimensions and sizes: [2] x [3] x [3]
Coordinates:
(0,0,0) 1
(0,0,1) 2
(0,0,2) 3
(0,1,0) 1
(0,1,1) 2
(0,1,2) 3
(0,2,0) 1
(0,2,1) 2
(0,2,2) 3
(1,0,0) 1
(1,0,1) 2
(1,0,2) 3
ncl 34> f3d = conform(curl,f,1)
ncl 35> curl = curl/(rho * f3d)
ncl 36> print(curl)

Variable: curl
Type: float
Total Size: 72 bytes
18 values
Number of Dimensions: 3
Dimensions and sizes: [2] x [3] x [3]
Coordinates:
(0,0,0) 9.765625e-05
(0,0,1) 0.0001953125
(0,0,2) 0.0002929688
(0,1,0) 9.765625e-05
(0,1,1) 0.0001953125
(0,1,2) 0.0002929688
(0,2,0) 9.765625e-05
(0,2,1) 0.0001953125
(0,2,2) 0.0002929688
(1,0,0) 9.765625e-05
(1,0,1) 0.0001953125
(1,0,2) 0.0002929688
--More--

Thanks for your help. I had been playing with the conform_dims function,
but did not have it quite right yet.

Sam

On 06/23/2013 02:28 PM, Mary Haley wrote:
> Hi Sam,
>
> You can use the "conform" or "conform_dims" function to conform the
> "f" array to be the same size as the "curl" array. You don't need to
> conform scalars.
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/conform_dims.shtml
>
>
> curl = curl/(rho * conform(curl,1,f)) ; "f" conforms to the 1-th
> (second) dimesion of "curl"
>
> If you want to be more explicit about what you're doing:
>
>
> f3d = conform(curl,1,f) ; "f" conforms to the 1-th (second)
Mary - I think parameters 2 and 3 are reversed in the above statement,
so they are reversed in the test I presented above.
> dimesion of "curl"
> curl = curl/(rho * f3d)
> delete(f3d) ; not necessary
>
>
> --Mary
>
>

```--
Sam McClatchie,
Supervisory oceanographer, Fisheries oceanography
Southwest Fisheries Science Center, NOAA,
8901 La Jolla Shores Dr.
La Jolla, CA 92037-1509, U.S.A.
email <Sam.McClatchie@noaa.gov>
Office: 858 546 7083, Cellular:  858 752 8495
/\
...>><xX(¡>
//// \\\\
<¡)Xx><<
/////  \\\\\\
><(((¡>
>><(((¡>   ...>><xX(¡>O<¡)Xx><<

```

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jun 24 10:26:07 2013

This archive was generated by hypermail 2.1.8 : Mon Jul 01 2013 - 12:35:42 MDT