[AMPL 2107] matrix multiplication

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 2107] matrix multiplication

mah-5

how can I mutiply a m*n matrix (A) by a n*1 matrix(B)?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

[AMPL 2108] Re: matrix multiplication

Robert Fourer-2


> From: [hidden email] [mailto:[hidden email]]
> On Behalf Of mah
> Sent: Monday, December 01, 2008 12:53 AM
> To: AMPL Modeling Language
> Subject: [AMPL 2107] matrix multiplication
>
> how can I mutiply a m*n matrix (A) by a n*1 matrix(B)?

Given, say,

   param A {1..m, 1..n};
   param B {1..n};

you can write:

   sum {j in 1..n} A[i,j] * B[j]

to get the ith element of A times B.  There is no "matrix multiplication"
operator in AMPL that would let you write simply "A * B", however.




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---