Module:Temperament data: Difference between revisions
CompactStar (talk | contribs) No edit summary |
CompactStar (talk | contribs) Copying code from AI (it has references to some library which I will remove and replace with my own functions) |
||
| Line 16: | Line 16: | ||
end | end | ||
-- Moore-Penrose | local function moore_penrose_inverse(A) | ||
local | -- Perform the singular value decomposition of A. | ||
local U, S, V = svd(A) | |||
-- Compute the pseudo-inverse of S. | |||
local S_inv = torch.diag(torch.reciprocal(S + torch.zeros_like(S))) | |||
-- Compute the Moore-Penrose inverse of A. | |||
local A_inv = V * S_inv * U | |||
return A_inv | |||
end | |||
local function get_cte_error() | local function get_cte_error() | ||