
Re: How to do Matrix Multiplication in QlikSense ?
Sushant Jain Jul 30, 2018 8:32 AM (in response to Sushant Jain )Currently i have tried to convert matrix into a table and tried achieving the same result. But the calculation is complicated!

Re: How to do Matrix Multiplication in QlikSense ?
Stefan Wühl Jul 30, 2018 8:50 AM (in response to Sushant Jain )Maybe you can use something like
Matrix Multiplication Using SQL  The Right Join
Here you create your matrices in tables with x / y coordinates explicitely expressed in your record values, a record per point of your matrix.
For the inner JOIN of the two tables, remember that Qlik uses same field names to create JOIN keys, so you would need to rename / swap column names of the second table  or transpose the matrix when loading in.


Re: How to do Matrix Multiplication in QlikSense ?
Petter Skjolden Jul 30, 2018 12:43 PM (in response to Sushant Jain )If you need matrix operations you might be better off using the AAI option in Qlik to allow you to call functions in Python or R and get a full set of functions by using the right Python or R libraries.
AAI = Advanced Analytics Integration, which take advantage of the Server Side Extension SSE protocol that Qlik supports.
https://github.com/qlikoss/serversideextension

Re: How to do Matrix Multiplication in QlikSense ?
Petter Skjolden Jul 31, 2018 4:46 AM (in response to Sushant Jain )It is possible to do matrix multiplication as you can see from the application I have attached and show screenshots from taking advantage of the associative datamodel in Qlik. Depending on requirements this might be way to inflexible and static but it is definitely a valid way of doing matrix multiplication.
Some transformation is needed to make the first matrix easy to calculate with by rotating the table.
This is more a type of demo of the possibiltiy of doing it than something you might want to use in production...

Matrix Mulitply.qvf 208.0 K

Re: How to do Matrix Multiplication in QlikSense ?
Sushant Jain Aug 1, 2018 2:11 AM (in response to Petter Skjolden )Hi Peter,
Thanks a lot for putting so much effort on my problem and the solution looks promising.
But my matrix is going to be minimum 5000*5000 and will increase, so the solution should be scalable and dynamic, hence doing more research to pin down the best possible solution. It would have been so much easier using Advanced Analytics Integration with Python numpy library but currently i don't have that luxury.
I also found another thread that deals with the similar issue Matrix Algebra
Regards
Sushant

Re: How to do Matrix Multiplication in QlikSense ?
Petter Skjolden Aug 1, 2018 7:57 AM (in response to Sushant Jain )Actually it can be made flexible and generic by keeping all of the matrices in an unpivoted form or sparse matrix form. Then it works very well with larger matrices too and very quick I must say. The measure is simply Sum( A * B ) and you can visualize it in a Pivot Table with two dimensions and the measure:
The source has to provide every matrix in the table structure like this:
x, y, value
Only the first column x should be a connecting field (column) in Qlik  a key field.
So the load script is much simpler too:
c=1000; r=500; // Generate a random matrix A with size c x r MAT_A: LOAD Floor((RecNo()1)/$(c))+1 AS Ay, Mod( (RecNo()1) , $(c))+1 AS x, If( Floor((RecNo()1)/$(c))+1 < $(r)+1 , Floor(Rand()*9)) AS A AUTOGENERATE $(c)*$(r); ; // Generate a random matrix B with size c x c MAT_B: LOAD Floor((RecNo()1)/$(c))+1 AS x, Mod( (RecNo()1) , $(c))+1 AS By, Floor(Rand()*9) AS B AUTOGENERATE $(c)*$(c); ;

Matrix Mulitply  Pivot.qvf 1.1 MB

Re: How to do Matrix Multiplication in QlikSense ?
Sushant Jain Oct 18, 2018 7:30 AM (in response to Petter Skjolden )
Re: How to do Matrix Multiplication in QlikSense ?
Petter Skjolden Oct 18, 2018 9:17 AM (in response to Sushant Jain )I agree  Qlik is not the right tool for this  although it is possible it is not practical and advisable. Use integration technologies like Advance Analytics Integration to do what you want to do instead....



