Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

evaluating matrix quadratic form

tracyx
New Contributor I
334 Views
What is the best way to evaluate the quadratic form X'*A*X where X is an mx1 matrix and A is a m x m symmetric matrix? Is there a routine to do this in MKL as this is a common problem?
Thanks, Tracy
0 Kudos
4 Replies
mecej4
Black Belt
334 Views
For dense A, a call to ?gemv to compute A X, followed by a call to ?dot.
Royi
Novice
334 Views

The result of:

X' * A * X

For symmetric A has such a nice structure (Result is symmetric) that it is a pity MKL doesn't have an optimized function for it.
Quadratic Forms are very common in Machine Learning, Optimization, etc... It would benefit many users.

Spencer_P_Intel
Employee
334 Views

In case of dense, there is no single call solution as mecej4 mentioned.

However, if X and A are sparse matrices, then we added exactly this type of product to our Inspector-Executor Sparse BLAS routines. The structure is indeed quite nice. This type of product shows up a lot in multi-scale finite element methods as well where X could be a projection or elongation matrix. We call it the symmetric product with api -- mkl_sparse_sypr().

See reference documentation mkl_sparse_sypr for more details on how to use it.

 

Sigolaev__Yuriy
Beginner
334 Views

Blas Level 2 is a tricky thing. For example, my dsptrd faster dsptrd Intel MKL twice.

See https://software.intel.com/en-us/forums/intel-math-kernel-library/topic/288316

Reply