Thanks a lot Prof. Allin .
with regards
Dr.K.Dhanasekaran

On Sun, Mar 19, 2023 at 11:27 AM Cottrell, Allin <cottrell@wfu.edu> wrote:
On Sun, Mar 19, 2023 at 11:17 AM Dhanasekaran Kuppusamy
<drgkdphd@gmail.com> wrote:
>
> Dear gretl  experts ,
>                                   I would like to know how to multiply the  corresponding elements of two matrices of  A and B  to generate matrix  C as shown below  and  the square values of the elements in matrix C using gretl. For example,
>   1)
>  matrix A (3x3):                         matrix B (3x3):                            matrix C (3x3):
>                          4      2      3                           1      1      2                                 4       2       6
>                          2     -3      2                           1      0      1                                 2       0       2
>                        - 3      1      2                           1      2      2                               - 3       2       4

C = A .* B

"dot-multiply" works element by element (Hadamard multiplication).

> 2)     How to generate square values of the elements in matrix C to get matrix D :
>
>          For example, matrix C (3x3):                              matrix D (3x3):
>                                                        4      2       6                                   16      4      36
>                                                        2      0       2                                     4      0        4
>                                                       -3      2       4                                     9      4      16

D = C .^ 2

"dot-raise to power" also works element-wise.

Allin Cottrell
_______________________________________________
Gretl-users mailing list -- gretl-users@gretlml.univpm.it
To unsubscribe send an email to gretl-users-leave@gretlml.univpm.it
Website: https://gretlml.univpm.it/postorius/lists/gretl-users.gretlml.univpm.it/