Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the projection matrix for a given vector space
ResourceFunction["ProjectionMatrix"][A] returns the projection matrix onto the column space (range) of an m×n matrix A, with m≥n. | |
ResourceFunction["ProjectionMatrix"][A,W] returns the projection matrix onto the column space (range) of A with a specified metric W. |
Compute the projection matrix onto the column space of a matrix:
In[1]:= |
Out[1]= |
Project a vector onto this vector space:
In[2]:= |
Out[2]= |
Visualize:
In[3]:= |
Out[3]= |
Compute the projection matrix for the case when the dot product between a pair of vectors x and y is given by xT.W.y:
In[4]:= |
Out[4]= |
Compute the projection matrix onto the column space of a singular square matrix:
In[5]:= |
Out[5]= |
Compute the projection matrix onto the column space of a symbolic real-valued matrix:
In[6]:= |
Out[6]= |
ProjectionMatrix[Transpose@{v}].u is equivalent to Projection[u,v]:
In[7]:= |
Out[7]= |
ProjectionMatrix[Transpose@{v},W].u is equivalent to :
In[8]:= |
Out[8]= |
ProjectionMatrix can fail with badly conditioned numerical matrices. Consider Läuchli’s example. The output of the function may differ depending on whether the input is given in exact numbers or in MachinePrecision numbers:
In[9]:= |
Out[9]= |
In[10]:= |
Out[10]= |
This work is licensed under a Creative Commons Attribution 4.0 International License