Let's say I want to perform the conventional matrix multiplication, so I define it as "multiply then sum the products" (i.e. "x,+")

For example, for matrices A and B:

if A = |a b|

.........|c d|

and B = |1 2|

.............|3 4|

Then:

A "x,+" B = | [ax1+bx3] [ax2+bx4] |

.................| [cx1+dx3] [cx2+dx4] |

But if I want to make only sums, I could define the operations as "+,+" (i.e. "sum, and then, sum the sums")

So that:

A "+,+" B = | [a+1+b+3] [a+2+b+4] |

.................| [c+1+d+3] [c+2+d+4] |

Or whatever I want: "(/)^2,-" (i.e. "divide and square the quotient, then substract the squared quotients")

So that:

A "(/)^2,-" B = | [(a/1)^2-(b/3)^2] [(a/2)^2+(b/4)^2] |

.....................| [(c/1)^2-(d/3)^2] [(c/2)^2+(d/4)^2] |

The reason I wanted to do this is because I wanted to make an euclidian distance matrix between some geographic locations (with x,y coordinates)...so I thought the following matrix operation would solve it easily:

A = |x1 y1|

......|x2 y2|

.......|x3 y3|

A' = |x1 x2 x3|

.......|y1 y2 y3|

then the distance matrix is:

sqrt(A "(-)^2,+" A')

where

"(-)^2,+" means "get the difference and square it, then sum the squares"...

and at the end get the square root of each cell... which is Pithagoras' theorem to obtain euclidian distances...

Is there any software which allows defining matrix operations in this way?

More R. Carrasco Hernandez's questions See All
Similar questions and discussions