Description
The generator length in function aux_cloud2zonotope (in conSet/@zonotope/enclosePoints.m) is currently computed as
g = ratio * abs(dot(u,r)) * u;
where u is the dominant left singular vector of the residual point cloud and r is the radius vector of its axis-aligned interval enclosure.
The quantity abs(dot(u,r)) is the projection of the specific interval vertex r onto u. Since the entries of u may have different signs, positive and negative terms can cancel even when both u and r are nonzero. This may produce g = 0, followed by a 0/0 operation in function aux_compress:
For an axis-aligned interval with radius vector r, its support radius in direction u is supposed to be
Therefore, the generator construction may be more appropriately written as
g = ratio * dot(abs(u),r) * u;
A numerical safeguard in aux_compress can also prevent division by zero as
function X = aux_compress(X,g)
ng = norm(g);
tol = 1e-12;
if ng <= tol
return;
end
u = g/ng;
for i = 1:size(X,2)
d = dot(X(:,i),u);
d = min(ng,max(-ng,d));
X(:,i) = X(:,i) - d*u;
end
end
Steps to Reproduce the Issue
I have attached the point data file that triggered the issue, along with a minimal reproduction script.
Point data file: https://drive.google.com/file/d/1OLIA6q_IVsjmZsQsqB31v0_vyR-7tgVI/view?usp=drive_link
load('data.mat');
Zono_omega = zonotope.enclosePoints(omega);
In my case, the issue occurred at the last iteration in aux_cloud2zonotope. At that iteration,
norm(u) > 0
norm(r) > 0
dot(u,r) == 0
dot(abs(u),r) > 0
The above modification resolves the issue for this dataset.
Current Behavior
Sign cancellation in dot(u,r) may produce a zero generator even though the residual point cloud has nonzero extent. The subsequent normalization of g introduces NaN values into X and the resulting zonotope.
Expected Behavior
cloud2zonotope should return a valid zonotope without introducing NaN values.
Versions
- Matlab version: R2024a
- OS: Windows
Description
The generator length in function
aux_cloud2zonotope(in conSet/@zonotope/enclosePoints.m) is currently computed aswhere
uis the dominant left singular vector of the residual point cloud andris the radius vector of its axis-aligned interval enclosure.The quantity
abs(dot(u,r))is the projection of the specific interval vertexrontou. Since the entries ofumay have different signs, positive and negative terms can cancel even when bothuandrare nonzero. This may produceg = 0, followed by a0/0operation in functionaux_compress:For an axis-aligned interval with radius vector
r, its support radius in directionuis supposed to beTherefore, the generator construction may be more appropriately written as
A numerical safeguard in
aux_compresscan also prevent division by zero asSteps to Reproduce the Issue
I have attached the point data file that triggered the issue, along with a minimal reproduction script.
Point data file: https://drive.google.com/file/d/1OLIA6q_IVsjmZsQsqB31v0_vyR-7tgVI/view?usp=drive_link
In my case, the issue occurred at the last iteration in
aux_cloud2zonotope. At that iteration,The above modification resolves the issue for this dataset.
Current Behavior
Sign cancellation in
dot(u,r)may produce a zero generator even though the residual point cloud has nonzero extent. The subsequent normalization ofgintroducesNaNvalues intoXand the resulting zonotope.Expected Behavior
cloud2zonotopeshould return a valid zonotope without introducingNaNvalues.Versions