Module:Temperament data: Difference between revisions

CompactStar (talk | contribs)
Copying code from AI (it has references to some library which I will remove and replace with my own functions)
CompactStar (talk | contribs)
Scrap this code, I have found how to implement it myself.
Line 16: Line 16:
end
end


local function moore_penrose_inverse(A)
local function matinv(a)
  -- Perform the singular value decomposition of A.
end
  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()