Skip to content

Commit ee53448

Browse files
committed
stuff
1 parent 5d30cc0 commit ee53448

23 files changed

+6414
-0
lines changed

.DS_Store

8 KB
Binary file not shown.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"The jacobian of the symmetric matrix eigendecomposition is the vandermonde expression"
8+
]
9+
},
10+
{
11+
"cell_type": "code",
12+
"execution_count": 190,
13+
"metadata": {},
14+
"outputs": [],
15+
"source": [
16+
"using LinearAlgebra, GenericLinearAlgebra, ForwardDiff"
17+
]
18+
},
19+
{
20+
"cell_type": "markdown",
21+
"metadata": {},
22+
"source": [
23+
"$$ dA = \\prod_{i <j} (\\lambda_i - \\lambda_j)(d\\Lambda)^\\wedge(Q'dQ)^\\wedge $$"
24+
]
25+
},
26+
{
27+
"cell_type": "code",
28+
"execution_count": 191,
29+
"metadata": {},
30+
"outputs": [],
31+
"source": [
32+
"n = 4\n",
33+
"A = randn(n,n);\n",
34+
"#A += A' "
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": 192,
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"upper = [i≤j for i=1:n, j=1:n][:]\n",
44+
"Λ, Q = eigen(Hermitian(A))\n",
45+
"dΛ, dQ = (ForwardDiff.jacobian(t -> _eig(Hermitian(t)), A) for _eig=(eigvals, eigvecs))\n",
46+
"dΛ, dQ = dΛ[:,upper], dQ[:,upper];"
47+
]
48+
},
49+
{
50+
"cell_type": "code",
51+
"execution_count": 193,
52+
"metadata": {},
53+
"outputs": [],
54+
"source": [
55+
"subupper = [i<j for i=1:n, j=1:n][:]\n",
56+
"dQ = (kron(Matrix(I, size(A)),Q')*dQ)[subupper,:]; #compute Q'*dQ for every vec'd dQ"
57+
]
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": 194,
62+
"metadata": {},
63+
"outputs": [
64+
{
65+
"data": {
66+
"text/plain": [
67+
"(0.0007641193180814094, 0.0007641193180814138)"
68+
]
69+
},
70+
"execution_count": 194,
71+
"metadata": {},
72+
"output_type": "execute_result"
73+
}
74+
],
75+
"source": [
76+
"# Experiment vs Theory\n",
77+
"det([dΛ;dQ]),1/abs(prod([Λ[i]-Λ[j] for i=1:n, j=1:n if i<j]))"
78+
]
79+
},
80+
{
81+
"cell_type": "code",
82+
"execution_count": null,
83+
"metadata": {},
84+
"outputs": [],
85+
"source": []
86+
}
87+
],
88+
"metadata": {
89+
"@webio": {
90+
"lastCommId": null,
91+
"lastKernelId": null
92+
},
93+
"kernelspec": {
94+
"display_name": "Julia 1.5.2",
95+
"language": "julia",
96+
"name": "julia-1.5"
97+
},
98+
"language_info": {
99+
"file_extension": ".jl",
100+
"mimetype": "application/julia",
101+
"name": "julia",
102+
"version": "1.5.2"
103+
}
104+
},
105+
"nbformat": 4,
106+
"nbformat_minor": 4
107+
}

notebooks/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)