Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Matrix multiplication of symmetric matrices

JohannesR
5 - Atom

Hi everyone,

 

I'm trying to multiply a symmetric matrix of a predefined format (14x14) with another symmetric matrix of the same format.

The easiest case to show here would be to multiply the matrix with itself.

I know, the most convenient solution might be the matrix multiplication in e.g. python, but given that the python tool or other embedded code is not an option, does anyone have a good solution for that?

 

I added a sample matrix below, but you could just take any matrix there is.

 

Thanks in advance!

7 REPLIES 7
IraWatt
17 - Castor
17 - Castor

Hey @JohannesR,

Currently its not a feature but there is an idea/feature request in the community if you want to support it Support Basic Linear Algebra (Vectors and Matrices... - Alteryx Community. To achieve this you'll need to create an iterative or batch macro to loop through each column/row, couldn't find anyone on the gallery who has done this yet. 

DataNath
17 - Castor

Think I've misinterpreted the question (I took it as A1xA1, A2xA2 etc) so apologies if that's incorrect but here's the solution in case it helps:

 

DataNath_0-1651742593940.png

 

JohannesR
5 - Atom

Thanks for your quick reply to both of you!

@DataNath Unfortunately, that's just not the correct result of the multiplication.

I would need the result as follows: Cell 1,1 = (A1,1 * A1,1)+(A1,2 * A2,1)+(A1,3 * A3,1)+... 

The attached matrix is the result I'm actually looking for...

NeilR
Alteryx Alumni (Retired)

I've made a standard macro that seems to do the trick. If you test it out and it works I'll clean it up and post it on the Gallery.

[Brushed up on the mechanics here and tested it here.]

JohannesR
5 - Atom

I'm genuinely impressed by the solution. Works exactly as wished and when compared to python I only get differences from the 16th decimal point onwards which might be due to the floating point exception handled differently in python and in alteryx itself (I guess... Link to FPE ).

 

But I checked it against the Python solution and attached the workflow.

 

Thanks for your solution @NeilR!

NeilR
Alteryx Alumni (Retired)

@JohannesR my pleasure that was fun. Out of curiosity, what are you  up to with matrix multiplication? [Gallery link.]

JohannesR
5 - Atom

I need this solution in the context of an expected credit loss calculation for a client in the banking sector, where you need to multiply the transition matrices in order to estimate the probability of default in a given number of years...

Unfortunately my client uses relatively slow machines which apparently struggle with the python script :D

Labels