Skip to content

Commit f0f21ae

Browse files
committed
use pseudo inverse
1 parent 4fc6319 commit f0f21ae

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/dual_contours.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ function dual_contours(f::Function,
5757
A[i,:] = h_data[i][2]
5858
end
5959
b = [ dot(d[1],d[2]) for d in h_data ]
60-
v = A\b
60+
61+
# use SVD for pseudo inverse
62+
# F = svd(A, full=true)
63+
# S = zeros(size(A))
64+
# for i = 1:length(F.S)
65+
# S[i,i] = 1/(F.S[i])
66+
# end
67+
# ainv = F.V*S*F.U'
68+
69+
#compute the vertex from SVD
70+
v = pinv(A)*b
6171

6272
#Throw out failed solutions
6373
if norm(v-o) > 2

0 commit comments

Comments
 (0)