Category: News
quadprog output: this problem is non-convex
I am trying to solve a quadratic optimization problem but quadprog keeps telling me that my problem is non-convex.
After several experiments, I found that the problem comes from the equation constraints matrix A, which is a 57250*57441 matrix.
For the following code,
[m, n] = size(A);
assert(m < n);
options = optimoptions(‘quadprog’,’Display’,’off’);
[Pwp,fval,exitflag,output] = quadprog(speye(n), zeros(n,1), [], [], A, zeros(m, 1), [], [], [], options);
obviously the solution should be the all-zero vector. But the output still said that this is a nonconvex problem.I am trying to solve a quadratic optimization problem but quadprog keeps telling me that my problem is non-convex.
After several experiments, I found that the problem comes from the equation constraints matrix A, which is a 57250*57441 matrix.
For the following code,
[m, n] = size(A);
assert(m < n);
options = optimoptions(‘quadprog’,’Display’,’off’);
[Pwp,fval,exitflag,output] = quadprog(speye(n), zeros(n,1), [], [], A, zeros(m, 1), [], [], [], options);
obviously the solution should be the all-zero vector. But the output still said that this is a nonconvex problem. I am trying to solve a quadratic optimization problem but quadprog keeps telling me that my problem is non-convex.
After several experiments, I found that the problem comes from the equation constraints matrix A, which is a 57250*57441 matrix.
For the following code,
[m, n] = size(A);
assert(m < n);
options = optimoptions(‘quadprog’,’Display’,’off’);
[Pwp,fval,exitflag,output] = quadprog(speye(n), zeros(n,1), [], [], A, zeros(m, 1), [], [], [], options);
obviously the solution should be the all-zero vector. But the output still said that this is a nonconvex problem. optimization MATLAB Answers — New Questions
PowerShell scripts are no longer executed. TamperProtection Failure
I have an environment with about 150 Windows 10 notebooks that are AAD joined and fully managed by Intune.
PowerShell Platform Scripts are used on the devices to perform various configurations. The PowerShell scripts are all executed in the user context “Run this script using the logged on credentials” and without signature check (Enforce script signature check=no).
On 08/12/2024 a new PowerShell script was configured which is not executed successfully on all devices. The status of the majority of devices is “Unknown”. However, there are devices on which it is executed successfully, status “Succeeded”.
Another Powershell script was configured for testing, which only logs the device IP address in a local log file. This script behaves in the same way. The majority of the devices deliver status “Unknown” on other devices with status “Succeeded”. These are always the same devices on which the script is executed, or not.
The following error message can be found in the Intunemanagementextension.log on the devices with status “Unknown”:
<![LOG[[TamperProtection] Enforcement mode = Enforcement2. PolicyType = 6. Running checks.]LOG]!><time=”15:35:51.2966252″ date=”8-13-2024″ component=”IntuneManagementExtension” context=”” type=”1″ thread=”69″ file=””>
<![LOG[[TamperProtection] Blob embedded certs:DigiCert Global Root G2:DigiCert Global Root G2|08/01/2013 14:00:00|01/15/2038 13:00:00|DF3C24F9BFD666761B268073FE06D1CC8D4F82A4
Microsoft Azure RSA TLS Issuing CA 07:DigiCert Global Root G2|06/08/2023 02:00:00|08/26/2026 01:59:59|3382517058A0C20228D598EE7501B61256A76442
SideCarSignCert.manage.microsoft.com:Microsoft Azure RSA TLS Issuing CA 07|02/09/2024 09:58:06|02/03/2025 09:58:06|A2553C3CDEE7BF3BF85EE30C4AB9CC819EB84D2C
]LOG]!><time=”15:35:51.2966252″ date=”8-13-2024″ component=”IntuneManagementExtension” context=”” type=”1″ thread=”69″ file=””>
<![LOG[[TamperProtection] (Failure) AccountId:<removed-for-security>,PolicyId:<removed-for-security>,Type:6,Enforce: Enforcement2. OSVersion:10.0.19045,AgentVersion:1.64.106.0. Additional validation failure:[Cert number 0]: [Validator SubjectNameIssuerStringMatchValidator]: [Field: SubjectName] Success
[Field: IssuerName] Did not match pre-trust list. Incoming value: Microsoft Azure RSA TLS Issuing CA 07
[Cert number 1]: [Validator SubjectNameIssuerStringMatchValidator]: [Field: SubjectName] Did not match pre-trust list. Incoming value: Microsoft Azure RSA TLS Issuing CA 07
[Field: IssuerName] Success
The script is not executed. The error is logged accordingly in HKEY_LOCAL_MACHINEsoftwaremicrosoftintunemanagementextensionPolicies
An intensive internet search has not yet yielded anything. Would be great if someone has an idea.
I have an environment with about 150 Windows 10 notebooks that are AAD joined and fully managed by Intune. PowerShell Platform Scripts are used on the devices to perform various configurations. The PowerShell scripts are all executed in the user context “Run this script using the logged on credentials” and without signature check (Enforce script signature check=no). On 08/12/2024 a new PowerShell script was configured which is not executed successfully on all devices. The status of the majority of devices is “Unknown”. However, there are devices on which it is executed successfully, status “Succeeded”. Another Powershell script was configured for testing, which only logs the device IP address in a local log file. This script behaves in the same way. The majority of the devices deliver status “Unknown” on other devices with status “Succeeded”. These are always the same devices on which the script is executed, or not. The following error message can be found in the Intunemanagementextension.log on the devices with status “Unknown”: <![LOG[[TamperProtection] Enforcement mode = Enforcement2. PolicyType = 6. Running checks.]LOG]!><time=”15:35:51.2966252″ date=”8-13-2024″ component=”IntuneManagementExtension” context=”” type=”1″ thread=”69″ file=””>
<![LOG[[TamperProtection] Blob embedded certs:DigiCert Global Root G2:DigiCert Global Root G2|08/01/2013 14:00:00|01/15/2038 13:00:00|DF3C24F9BFD666761B268073FE06D1CC8D4F82A4
Microsoft Azure RSA TLS Issuing CA 07:DigiCert Global Root G2|06/08/2023 02:00:00|08/26/2026 01:59:59|3382517058A0C20228D598EE7501B61256A76442
SideCarSignCert.manage.microsoft.com:Microsoft Azure RSA TLS Issuing CA 07|02/09/2024 09:58:06|02/03/2025 09:58:06|A2553C3CDEE7BF3BF85EE30C4AB9CC819EB84D2C
]LOG]!><time=”15:35:51.2966252″ date=”8-13-2024″ component=”IntuneManagementExtension” context=”” type=”1″ thread=”69″ file=””>
<![LOG[[TamperProtection] (Failure) AccountId:<removed-for-security>,PolicyId:<removed-for-security>,Type:6,Enforce: Enforcement2. OSVersion:10.0.19045,AgentVersion:1.64.106.0. Additional validation failure:[Cert number 0]: [Validator SubjectNameIssuerStringMatchValidator]: [Field: SubjectName] Success
[Field: IssuerName] Did not match pre-trust list. Incoming value: Microsoft Azure RSA TLS Issuing CA 07
[Cert number 1]: [Validator SubjectNameIssuerStringMatchValidator]: [Field: SubjectName] Did not match pre-trust list. Incoming value: Microsoft Azure RSA TLS Issuing CA 07
[Field: IssuerName] Success The script is not executed. The error is logged accordingly in HKEY_LOCAL_MACHINEsoftwaremicrosoftintunemanagementextensionPolicies An intensive internet search has not yet yielded anything. Would be great if someone has an idea. Read More
Shared Contacts in New Outlook – not possible/functional
Hi,
Does anyone have any additional information about the status on the ability to share contacts in the New Outlook?
We have shared corporate contacts in a Public Folder and are unable to access them (I opened a support ticket and this is apparently by design…for now) so my only option is the old Outlook or Outlook for the web.
As an alternative we looked into setting up a generic account, housing the contacts there and sharing them but this also doesn’t function.
The web version is not a viable alternative and the Old Outlook is getting so glitchy and has a fraction of the CoPilot functionality.
Hi, Does anyone have any additional information about the status on the ability to share contacts in the New Outlook? We have shared corporate contacts in a Public Folder and are unable to access them (I opened a support ticket and this is apparently by design…for now) so my only option is the old Outlook or Outlook for the web.As an alternative we looked into setting up a generic account, housing the contacts there and sharing them but this also doesn’t function. The web version is not a viable alternative and the Old Outlook is getting so glitchy and has a fraction of the CoPilot functionality. Read More
How to active Windows IoT Enterprise LTSC2021 via phone
Dear Community,
how can I activate Windows IoT Enterprise LTSC2021 via phone. I MUST activate via phone since the computers are installed in a facility without internet connection. What I have already tried that DID NOT work
The activation dialogue does not show the “phone option” as seen in this video: https://www.youtube.com/watch?v=6RTu0_uWjMMRun “SLUI 4” from the command line with admin privilleges. It just returns without doing anythingRebuild some internal databases as described here before step 2: https://answers.microsoft.com/en-us/windows/forum/all/activate-windows-by-phone-not-there-in-settings/34b72b93-563f-463c-8614-4675cfd0143fContacted the seller of the license (arrow), they referred me to email address removed for privacy reasons, who then told me to go to the forums
What’s left that I can try?
Dear Community, how can I activate Windows IoT Enterprise LTSC2021 via phone. I MUST activate via phone since the computers are installed in a facility without internet connection. What I have already tried that DID NOT workThe activation dialogue does not show the “phone option” as seen in this video: https://www.youtube.com/watch?v=6RTu0_uWjMMRun “SLUI 4” from the command line with admin privilleges. It just returns without doing anythingRebuild some internal databases as described here before step 2: https://answers.microsoft.com/en-us/windows/forum/all/activate-windows-by-phone-not-there-in-settings/34b72b93-563f-463c-8614-4675cfd0143fContacted the seller of the license (arrow), they referred me to email address removed for privacy reasons, who then told me to go to the forumsWhat’s left that I can try? Read More
How to change in marker size in the global legend?
Hi,
I’m making a plot containing a few subplots using the function tiledlayout, and I created a global legend using the code
leg = legend({‘A’,’B’,’C’})
leg.Layout.Tile = ‘North’
However with this I cann’t use the previous method to change the marker size in the legend, because it requirs two outputs from the legend, and it will override the previous code.
[~,icons] = legend({‘A’,’B’,’C’})
icons1=findobj(icons,’type’,’patch’);
set(icons1,’MarkerSize’,15,’Linewidth’,1.5);
Anyone know the workaround of this? many thanks!Hi,
I’m making a plot containing a few subplots using the function tiledlayout, and I created a global legend using the code
leg = legend({‘A’,’B’,’C’})
leg.Layout.Tile = ‘North’
However with this I cann’t use the previous method to change the marker size in the legend, because it requirs two outputs from the legend, and it will override the previous code.
[~,icons] = legend({‘A’,’B’,’C’})
icons1=findobj(icons,’type’,’patch’);
set(icons1,’MarkerSize’,15,’Linewidth’,1.5);
Anyone know the workaround of this? many thanks! Hi,
I’m making a plot containing a few subplots using the function tiledlayout, and I created a global legend using the code
leg = legend({‘A’,’B’,’C’})
leg.Layout.Tile = ‘North’
However with this I cann’t use the previous method to change the marker size in the legend, because it requirs two outputs from the legend, and it will override the previous code.
[~,icons] = legend({‘A’,’B’,’C’})
icons1=findobj(icons,’type’,’patch’);
set(icons1,’MarkerSize’,15,’Linewidth’,1.5);
Anyone know the workaround of this? many thanks! tiledlayout, makersize, global legend MATLAB Answers — New Questions
Computing gradient of mean curvature on a mesh using gp toolbox, unexpected error. What am I missing?
I am trying to compute this quantity here H grad(H) where H is the mean curvture
The code breaks at the last line because there is a dimension mismatch between H and grad(H). size(grad(H))= [960 3] and size(V)=[162 3] and size(mean_curvture)=[162 3]. Why is the grad(H) has that dimension? where is the mistake?
% Load a mesh
[V, F] = load_mesh(‘sphere.off’);
% Compute Mean Curvature and Normal Vector
% 2. Compute Cotangent Laplacian (L) and Mass Matrix (M)
L = cotmatrix(V, F);
M = massmatrix(V, F, ‘barycentric’);
% 3. Compute Mean Curvature Vector (H)
H = -inv(M) * (L * V);
% 4. Compute the Magnitude of Mean Curvature (mean curvature at each vertex)
mean_curvature = sqrt(sum(H.^2, 2));
% Compute the Normal Vector
normals = per_vertex_normals(V, F);
% Compute Gaussian Curvature
gaussian_curvature = discrete_gaussian_curvature(V,F);
% Compute Laplacian of Mean Curvature
laplacian_H = L * mean_curvature;
% Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Compute the new term: newthing
%H_squared = mean_curvature .^ 2;
%newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Compute the new term: newthing
H_squared = mean_curvature .^ 2;
newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Define small arc equation
h = 0.1; % Small parameter h
vertex = V; % V contains the vertices
% Compute the small arc
f_h = vertex + (mean_curvature .* normals) * h + newthing * (h^2 / 2);
% Visualization of small arc
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
hold on;
plot3(f_h(:,1), f_h(:,2), f_h(:,3), ‘r.’, ‘MarkerSize’, 10);
axis equal;
title(‘Small Arc Visualization’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
the grad(H) script
% Step 1: Load a Mesh
[V, F] = load_mesh(‘sphere.off’);
% Step 2: Compute Laplace-Beltrami Operator
L = cotmatrix(V, F); % cotangent Laplace-Beltrami operator
% Step 3: Compute the Mean Curvature Vector (H)
H = -L * V; % Mean curvature normal vector
% Step 4: Compute the Mean Curvature Magnitude
mean_curvature = sqrt(sum(H.^2, 2));
% Step 5: Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Step 6: Visualization or Further Processing
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), mean_curvature, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
colorbar;
title(‘Mean Curvature Gradient’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
grad(V, F) from gp toolbox
function [G] = grad(V,F)
% GRAD Compute the numerical gradient operator for triangle or tet meshes
%
% G = grad(V,F)
%
% Inputs:
% V #vertices by dim list of mesh vertex positions
% F #faces by simplex-size list of mesh face indices
% Outputs:
% G #faces*dim by #V Gradient operator
%
% Example:
% L = cotmatrix(V,F);
% G = grad(V,F);
% dblA = doublearea(V,F);
% GMG = -G’*repdiag(diag(sparse(dblA)/2),size(V,2))*G;
%
% % Columns of W are scalar fields
% G = grad(V,F);
% % Compute gradient magnitude for each column in W
% GM = squeeze(sqrt(sum(reshape(G*W,size(F,1),size(V,2),size(W,2)).^2,2)));
%
dim = size(V,2);
ss = size(F,2);
switch ss
case 2
% Edge lengths
len = normrow(V(F(:,2),:)-V(F(:,1),:));
% Gradient is just staggered grid finite difference
G = sparse(repmat(1:size(F,1),2,1)’,F,[1 -1]./len, size(F,1),size(V,1));
case 3
% append with 0s for convenience
if size(V,2) == 2
V = [V zeros(size(V,1),1)];
end
% Gradient of a scalar function defined on piecewise linear elements (mesh)
% is constant on each triangle i,j,k:
% grad(Xijk) = (Xj-Xi) * (Vi – Vk)^R90 / 2A + (Xk-Xi) * (Vj – Vi)^R90 / 2A
% grad(Xijk) = Xj * (Vi – Vk)^R90 / 2A + Xk * (Vj – Vi)^R90 / 2A +
% -Xi * (Vi – Vk)^R90 / 2A – Xi * (Vj – Vi)^R90 / 2A
% where Xi is the scalar value at vertex i, Vi is the 3D position of vertex
% i, and A is the area of triangle (i,j,k). ^R90 represent a rotation of
% 90 degrees
%
% renaming indices of vertices of triangles for convenience
i1 = F(:,1); i2 = F(:,2); i3 = F(:,3);
% #F x 3 matrices of triangle edge vectors, named after opposite vertices
v32 = V(i3,:) – V(i2,:); v13 = V(i1,:) – V(i3,:); v21 = V(i2,:) – V(i1,:);
% area of parallelogram is twice area of triangle
% area of parallelogram is || v1 x v2 ||
n = cross(v32,v13,2);
% This does correct l2 norm of rows, so that it contains #F list of twice
% triangle areas
dblA = normrow(n);
% now normalize normals to get unit normals
u = normalizerow(n);
% rotate each vector 90 degrees around normal
%eperp21 = bsxfun(@times,normalizerow(cross(u,v21)),normrow(v21)./dblA);
%eperp13 = bsxfun(@times,normalizerow(cross(u,v13)),normrow(v13)./dblA);
eperp21 = bsxfun(@times,cross(u,v21),1./dblA);
eperp13 = bsxfun(@times,cross(u,v13),1./dblA);
%g = …
% ( …
% repmat(X(F(:,2)) – X(F(:,1)),1,3).*eperp13 + …
% repmat(X(F(:,3)) – X(F(:,1)),1,3).*eperp21 …
% );
GI = …
[0*size(F,1)+repmat(1:size(F,1),1,4) …
1*size(F,1)+repmat(1:size(F,1),1,4) …
2*size(F,1)+repmat(1:size(F,1),1,4)]’;
GJ = repmat([F(:,2);F(:,1);F(:,3);F(:,1)],3,1);
GV = [eperp13(:,1);-eperp13(:,1);eperp21(:,1);-eperp21(:,1); …
eperp13(:,2);-eperp13(:,2);eperp21(:,2);-eperp21(:,2); …
eperp13(:,3);-eperp13(:,3);eperp21(:,3);-eperp21(:,3)];
G = sparse(GI,GJ,GV, 3*size(F,1), size(V,1));
%% Alternatively
%%
%% f(x) is piecewise-linear function:
%%
%% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk
%% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk
%% = ∇φi fi + ∇φj fj + ∇φk) fk
%%
%% ∇φi = 1/hjk ((Vj-Vk)/||Vj-Vk||)^perp =
%% = ||Vj-Vk|| /(2 Aijk) * ((Vj-Vk)/||Vj-Vk||)^perp
%% = 1/(2 Aijk) * (Vj-Vk)^perp
%%
%m = size(F,1);
%eperp32 = bsxfun(@times,cross(u,v32),1./dblA);
%G = sparse( …
% [0*m + repmat(1:m,1,3) …
% 1*m + repmat(1:m,1,3) …
% 2*m + repmat(1:m,1,3)]’, …
% repmat([F(:,1);F(:,2);F(:,3)],3,1), …
% [eperp32(:,1);eperp13(:,1);eperp21(:,1); …
% eperp32(:,2);eperp13(:,2);eperp21(:,2); …
% eperp32(:,3);eperp13(:,3);eperp21(:,3)], …
% 3*m,size(V,1));
if dim == 2
G = G(1:(size(F,1)*dim),:);
end
% Should be the same as:
% g = …
% bsxfun(@times,X(F(:,1)),cross(u,v32)) + …
% bsxfun(@times,X(F(:,2)),cross(u,v13)) + …
% bsxfun(@times,X(F(:,3)),cross(u,v21));
% g = bsxfun(@rdivide,g,dblA);
case 4
% really dealing with tets
T = F;
% number of dimensions
assert(dim == 3);
% number of vertices
n = size(V,1);
% number of elements
m = size(T,1);
% simplex size
assert(size(T,2) == 4);
if m == 1 && ~isnumeric(V)
simple_volume = @(ad,r) -sum(ad.*r,2)./6;
simple_volume = @(ad,bd,cd) simple_volume(ad, …
[bd(:,2).*cd(:,3)-bd(:,3).*cd(:,2), …
bd(:,3).*cd(:,1)-bd(:,1).*cd(:,3), …
bd(:,1).*cd(:,2)-bd(:,2).*cd(:,1)]);
P = sym(‘P’,[1 3]);
V1 = V(T(:,1),:);
V2 = V(T(:,2),:);
V3 = V(T(:,3),:);
V4 = V(T(:,4),:);
V1P = V1-P;
V2P = V2-P;
V3P = V3-P;
V4P = V4-P;
A1 = simple_volume(V2P,V4P,V3P);
A2 = simple_volume(V1P,V3P,V4P);
A3 = simple_volume(V1P,V4P,V2P);
A4 = simple_volume(V1P,V2P,V3P);
B = [A1 A2 A3 A4]./(A1+A2+A3+A4);
G = simplify(jacobian(B,P).’);
return
end
% f(x) is piecewise-linear function:
%
% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk + φl(x) fl
% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk + ∇φl(x) fl
% = ∇φi fi + ∇φj fj + ∇φk fk + ∇φl fl
%
% ∇φi = 1/hjk = Ajkl / 3V * (Facejkl)^perp
% = Ajkl / 3V * (Vj-Vk)x(Vl-Vk)
% = Ajkl / 3V * Njkl / ||Njkl||
%
% get all faces
F = [ …
T(:,1) T(:,2) T(:,3); …
T(:,1) T(:,3) T(:,4); …
T(:,1) T(:,4) T(:,2); …
T(:,2) T(:,4) T(:,3)];
% compute areas of each face
A = doublearea(V,F)/2;
N = normalizerow(normals(V,F));
% compute volume of each tet
vol = volume(V,T);
GI = …
[0*m + repmat(1:m,1,4) …
1*m + repmat(1:m,1,4) …
2*m + repmat(1:m,1,4)];
GJ = repmat([T(:,4);T(:,2);T(:,3);T(:,1)],3,1);
GV = repmat(A./(3*repmat(vol,4,1)),3,1).*N(:);
G = sparse(GI,GJ,GV, 3*m,n);
end
end
the sphere.off file (mesh data)I am trying to compute this quantity here H grad(H) where H is the mean curvture
The code breaks at the last line because there is a dimension mismatch between H and grad(H). size(grad(H))= [960 3] and size(V)=[162 3] and size(mean_curvture)=[162 3]. Why is the grad(H) has that dimension? where is the mistake?
% Load a mesh
[V, F] = load_mesh(‘sphere.off’);
% Compute Mean Curvature and Normal Vector
% 2. Compute Cotangent Laplacian (L) and Mass Matrix (M)
L = cotmatrix(V, F);
M = massmatrix(V, F, ‘barycentric’);
% 3. Compute Mean Curvature Vector (H)
H = -inv(M) * (L * V);
% 4. Compute the Magnitude of Mean Curvature (mean curvature at each vertex)
mean_curvature = sqrt(sum(H.^2, 2));
% Compute the Normal Vector
normals = per_vertex_normals(V, F);
% Compute Gaussian Curvature
gaussian_curvature = discrete_gaussian_curvature(V,F);
% Compute Laplacian of Mean Curvature
laplacian_H = L * mean_curvature;
% Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Compute the new term: newthing
%H_squared = mean_curvature .^ 2;
%newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Compute the new term: newthing
H_squared = mean_curvature .^ 2;
newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Define small arc equation
h = 0.1; % Small parameter h
vertex = V; % V contains the vertices
% Compute the small arc
f_h = vertex + (mean_curvature .* normals) * h + newthing * (h^2 / 2);
% Visualization of small arc
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
hold on;
plot3(f_h(:,1), f_h(:,2), f_h(:,3), ‘r.’, ‘MarkerSize’, 10);
axis equal;
title(‘Small Arc Visualization’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
the grad(H) script
% Step 1: Load a Mesh
[V, F] = load_mesh(‘sphere.off’);
% Step 2: Compute Laplace-Beltrami Operator
L = cotmatrix(V, F); % cotangent Laplace-Beltrami operator
% Step 3: Compute the Mean Curvature Vector (H)
H = -L * V; % Mean curvature normal vector
% Step 4: Compute the Mean Curvature Magnitude
mean_curvature = sqrt(sum(H.^2, 2));
% Step 5: Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Step 6: Visualization or Further Processing
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), mean_curvature, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
colorbar;
title(‘Mean Curvature Gradient’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
grad(V, F) from gp toolbox
function [G] = grad(V,F)
% GRAD Compute the numerical gradient operator for triangle or tet meshes
%
% G = grad(V,F)
%
% Inputs:
% V #vertices by dim list of mesh vertex positions
% F #faces by simplex-size list of mesh face indices
% Outputs:
% G #faces*dim by #V Gradient operator
%
% Example:
% L = cotmatrix(V,F);
% G = grad(V,F);
% dblA = doublearea(V,F);
% GMG = -G’*repdiag(diag(sparse(dblA)/2),size(V,2))*G;
%
% % Columns of W are scalar fields
% G = grad(V,F);
% % Compute gradient magnitude for each column in W
% GM = squeeze(sqrt(sum(reshape(G*W,size(F,1),size(V,2),size(W,2)).^2,2)));
%
dim = size(V,2);
ss = size(F,2);
switch ss
case 2
% Edge lengths
len = normrow(V(F(:,2),:)-V(F(:,1),:));
% Gradient is just staggered grid finite difference
G = sparse(repmat(1:size(F,1),2,1)’,F,[1 -1]./len, size(F,1),size(V,1));
case 3
% append with 0s for convenience
if size(V,2) == 2
V = [V zeros(size(V,1),1)];
end
% Gradient of a scalar function defined on piecewise linear elements (mesh)
% is constant on each triangle i,j,k:
% grad(Xijk) = (Xj-Xi) * (Vi – Vk)^R90 / 2A + (Xk-Xi) * (Vj – Vi)^R90 / 2A
% grad(Xijk) = Xj * (Vi – Vk)^R90 / 2A + Xk * (Vj – Vi)^R90 / 2A +
% -Xi * (Vi – Vk)^R90 / 2A – Xi * (Vj – Vi)^R90 / 2A
% where Xi is the scalar value at vertex i, Vi is the 3D position of vertex
% i, and A is the area of triangle (i,j,k). ^R90 represent a rotation of
% 90 degrees
%
% renaming indices of vertices of triangles for convenience
i1 = F(:,1); i2 = F(:,2); i3 = F(:,3);
% #F x 3 matrices of triangle edge vectors, named after opposite vertices
v32 = V(i3,:) – V(i2,:); v13 = V(i1,:) – V(i3,:); v21 = V(i2,:) – V(i1,:);
% area of parallelogram is twice area of triangle
% area of parallelogram is || v1 x v2 ||
n = cross(v32,v13,2);
% This does correct l2 norm of rows, so that it contains #F list of twice
% triangle areas
dblA = normrow(n);
% now normalize normals to get unit normals
u = normalizerow(n);
% rotate each vector 90 degrees around normal
%eperp21 = bsxfun(@times,normalizerow(cross(u,v21)),normrow(v21)./dblA);
%eperp13 = bsxfun(@times,normalizerow(cross(u,v13)),normrow(v13)./dblA);
eperp21 = bsxfun(@times,cross(u,v21),1./dblA);
eperp13 = bsxfun(@times,cross(u,v13),1./dblA);
%g = …
% ( …
% repmat(X(F(:,2)) – X(F(:,1)),1,3).*eperp13 + …
% repmat(X(F(:,3)) – X(F(:,1)),1,3).*eperp21 …
% );
GI = …
[0*size(F,1)+repmat(1:size(F,1),1,4) …
1*size(F,1)+repmat(1:size(F,1),1,4) …
2*size(F,1)+repmat(1:size(F,1),1,4)]’;
GJ = repmat([F(:,2);F(:,1);F(:,3);F(:,1)],3,1);
GV = [eperp13(:,1);-eperp13(:,1);eperp21(:,1);-eperp21(:,1); …
eperp13(:,2);-eperp13(:,2);eperp21(:,2);-eperp21(:,2); …
eperp13(:,3);-eperp13(:,3);eperp21(:,3);-eperp21(:,3)];
G = sparse(GI,GJ,GV, 3*size(F,1), size(V,1));
%% Alternatively
%%
%% f(x) is piecewise-linear function:
%%
%% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk
%% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk
%% = ∇φi fi + ∇φj fj + ∇φk) fk
%%
%% ∇φi = 1/hjk ((Vj-Vk)/||Vj-Vk||)^perp =
%% = ||Vj-Vk|| /(2 Aijk) * ((Vj-Vk)/||Vj-Vk||)^perp
%% = 1/(2 Aijk) * (Vj-Vk)^perp
%%
%m = size(F,1);
%eperp32 = bsxfun(@times,cross(u,v32),1./dblA);
%G = sparse( …
% [0*m + repmat(1:m,1,3) …
% 1*m + repmat(1:m,1,3) …
% 2*m + repmat(1:m,1,3)]’, …
% repmat([F(:,1);F(:,2);F(:,3)],3,1), …
% [eperp32(:,1);eperp13(:,1);eperp21(:,1); …
% eperp32(:,2);eperp13(:,2);eperp21(:,2); …
% eperp32(:,3);eperp13(:,3);eperp21(:,3)], …
% 3*m,size(V,1));
if dim == 2
G = G(1:(size(F,1)*dim),:);
end
% Should be the same as:
% g = …
% bsxfun(@times,X(F(:,1)),cross(u,v32)) + …
% bsxfun(@times,X(F(:,2)),cross(u,v13)) + …
% bsxfun(@times,X(F(:,3)),cross(u,v21));
% g = bsxfun(@rdivide,g,dblA);
case 4
% really dealing with tets
T = F;
% number of dimensions
assert(dim == 3);
% number of vertices
n = size(V,1);
% number of elements
m = size(T,1);
% simplex size
assert(size(T,2) == 4);
if m == 1 && ~isnumeric(V)
simple_volume = @(ad,r) -sum(ad.*r,2)./6;
simple_volume = @(ad,bd,cd) simple_volume(ad, …
[bd(:,2).*cd(:,3)-bd(:,3).*cd(:,2), …
bd(:,3).*cd(:,1)-bd(:,1).*cd(:,3), …
bd(:,1).*cd(:,2)-bd(:,2).*cd(:,1)]);
P = sym(‘P’,[1 3]);
V1 = V(T(:,1),:);
V2 = V(T(:,2),:);
V3 = V(T(:,3),:);
V4 = V(T(:,4),:);
V1P = V1-P;
V2P = V2-P;
V3P = V3-P;
V4P = V4-P;
A1 = simple_volume(V2P,V4P,V3P);
A2 = simple_volume(V1P,V3P,V4P);
A3 = simple_volume(V1P,V4P,V2P);
A4 = simple_volume(V1P,V2P,V3P);
B = [A1 A2 A3 A4]./(A1+A2+A3+A4);
G = simplify(jacobian(B,P).’);
return
end
% f(x) is piecewise-linear function:
%
% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk + φl(x) fl
% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk + ∇φl(x) fl
% = ∇φi fi + ∇φj fj + ∇φk fk + ∇φl fl
%
% ∇φi = 1/hjk = Ajkl / 3V * (Facejkl)^perp
% = Ajkl / 3V * (Vj-Vk)x(Vl-Vk)
% = Ajkl / 3V * Njkl / ||Njkl||
%
% get all faces
F = [ …
T(:,1) T(:,2) T(:,3); …
T(:,1) T(:,3) T(:,4); …
T(:,1) T(:,4) T(:,2); …
T(:,2) T(:,4) T(:,3)];
% compute areas of each face
A = doublearea(V,F)/2;
N = normalizerow(normals(V,F));
% compute volume of each tet
vol = volume(V,T);
GI = …
[0*m + repmat(1:m,1,4) …
1*m + repmat(1:m,1,4) …
2*m + repmat(1:m,1,4)];
GJ = repmat([T(:,4);T(:,2);T(:,3);T(:,1)],3,1);
GV = repmat(A./(3*repmat(vol,4,1)),3,1).*N(:);
G = sparse(GI,GJ,GV, 3*m,n);
end
end
the sphere.off file (mesh data) I am trying to compute this quantity here H grad(H) where H is the mean curvture
The code breaks at the last line because there is a dimension mismatch between H and grad(H). size(grad(H))= [960 3] and size(V)=[162 3] and size(mean_curvture)=[162 3]. Why is the grad(H) has that dimension? where is the mistake?
% Load a mesh
[V, F] = load_mesh(‘sphere.off’);
% Compute Mean Curvature and Normal Vector
% 2. Compute Cotangent Laplacian (L) and Mass Matrix (M)
L = cotmatrix(V, F);
M = massmatrix(V, F, ‘barycentric’);
% 3. Compute Mean Curvature Vector (H)
H = -inv(M) * (L * V);
% 4. Compute the Magnitude of Mean Curvature (mean curvature at each vertex)
mean_curvature = sqrt(sum(H.^2, 2));
% Compute the Normal Vector
normals = per_vertex_normals(V, F);
% Compute Gaussian Curvature
gaussian_curvature = discrete_gaussian_curvature(V,F);
% Compute Laplacian of Mean Curvature
laplacian_H = L * mean_curvature;
% Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Compute the new term: newthing
%H_squared = mean_curvature .^ 2;
%newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Compute the new term: newthing
H_squared = mean_curvature .^ 2;
newthing = laplacian_H + ((H_squared – 2 * gaussian_curvature) .* mean_curvature) .* normals + mean_curvature .* grad_H;
% Define small arc equation
h = 0.1; % Small parameter h
vertex = V; % V contains the vertices
% Compute the small arc
f_h = vertex + (mean_curvature .* normals) * h + newthing * (h^2 / 2);
% Visualization of small arc
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), ‘FaceColor’, ‘cyan’, ‘EdgeColor’, ‘none’);
hold on;
plot3(f_h(:,1), f_h(:,2), f_h(:,3), ‘r.’, ‘MarkerSize’, 10);
axis equal;
title(‘Small Arc Visualization’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
the grad(H) script
% Step 1: Load a Mesh
[V, F] = load_mesh(‘sphere.off’);
% Step 2: Compute Laplace-Beltrami Operator
L = cotmatrix(V, F); % cotangent Laplace-Beltrami operator
% Step 3: Compute the Mean Curvature Vector (H)
H = -L * V; % Mean curvature normal vector
% Step 4: Compute the Mean Curvature Magnitude
mean_curvature = sqrt(sum(H.^2, 2));
% Step 5: Compute the Gradient of Mean Curvature
% Use gptoolbox’s gradient operator for scalar fields
grad_H = grad(V, F) * mean_curvature;
% Step 6: Visualization or Further Processing
figure;
trisurf(F, V(:,1), V(:,2), V(:,3), mean_curvature, ‘EdgeColor’, ‘none’);
axis equal;
lighting gouraud;
camlight;
colorbar;
title(‘Mean Curvature Gradient’);
xlabel(‘X’);
ylabel(‘Y’);
zlabel(‘Z’);
grad(V, F) from gp toolbox
function [G] = grad(V,F)
% GRAD Compute the numerical gradient operator for triangle or tet meshes
%
% G = grad(V,F)
%
% Inputs:
% V #vertices by dim list of mesh vertex positions
% F #faces by simplex-size list of mesh face indices
% Outputs:
% G #faces*dim by #V Gradient operator
%
% Example:
% L = cotmatrix(V,F);
% G = grad(V,F);
% dblA = doublearea(V,F);
% GMG = -G’*repdiag(diag(sparse(dblA)/2),size(V,2))*G;
%
% % Columns of W are scalar fields
% G = grad(V,F);
% % Compute gradient magnitude for each column in W
% GM = squeeze(sqrt(sum(reshape(G*W,size(F,1),size(V,2),size(W,2)).^2,2)));
%
dim = size(V,2);
ss = size(F,2);
switch ss
case 2
% Edge lengths
len = normrow(V(F(:,2),:)-V(F(:,1),:));
% Gradient is just staggered grid finite difference
G = sparse(repmat(1:size(F,1),2,1)’,F,[1 -1]./len, size(F,1),size(V,1));
case 3
% append with 0s for convenience
if size(V,2) == 2
V = [V zeros(size(V,1),1)];
end
% Gradient of a scalar function defined on piecewise linear elements (mesh)
% is constant on each triangle i,j,k:
% grad(Xijk) = (Xj-Xi) * (Vi – Vk)^R90 / 2A + (Xk-Xi) * (Vj – Vi)^R90 / 2A
% grad(Xijk) = Xj * (Vi – Vk)^R90 / 2A + Xk * (Vj – Vi)^R90 / 2A +
% -Xi * (Vi – Vk)^R90 / 2A – Xi * (Vj – Vi)^R90 / 2A
% where Xi is the scalar value at vertex i, Vi is the 3D position of vertex
% i, and A is the area of triangle (i,j,k). ^R90 represent a rotation of
% 90 degrees
%
% renaming indices of vertices of triangles for convenience
i1 = F(:,1); i2 = F(:,2); i3 = F(:,3);
% #F x 3 matrices of triangle edge vectors, named after opposite vertices
v32 = V(i3,:) – V(i2,:); v13 = V(i1,:) – V(i3,:); v21 = V(i2,:) – V(i1,:);
% area of parallelogram is twice area of triangle
% area of parallelogram is || v1 x v2 ||
n = cross(v32,v13,2);
% This does correct l2 norm of rows, so that it contains #F list of twice
% triangle areas
dblA = normrow(n);
% now normalize normals to get unit normals
u = normalizerow(n);
% rotate each vector 90 degrees around normal
%eperp21 = bsxfun(@times,normalizerow(cross(u,v21)),normrow(v21)./dblA);
%eperp13 = bsxfun(@times,normalizerow(cross(u,v13)),normrow(v13)./dblA);
eperp21 = bsxfun(@times,cross(u,v21),1./dblA);
eperp13 = bsxfun(@times,cross(u,v13),1./dblA);
%g = …
% ( …
% repmat(X(F(:,2)) – X(F(:,1)),1,3).*eperp13 + …
% repmat(X(F(:,3)) – X(F(:,1)),1,3).*eperp21 …
% );
GI = …
[0*size(F,1)+repmat(1:size(F,1),1,4) …
1*size(F,1)+repmat(1:size(F,1),1,4) …
2*size(F,1)+repmat(1:size(F,1),1,4)]’;
GJ = repmat([F(:,2);F(:,1);F(:,3);F(:,1)],3,1);
GV = [eperp13(:,1);-eperp13(:,1);eperp21(:,1);-eperp21(:,1); …
eperp13(:,2);-eperp13(:,2);eperp21(:,2);-eperp21(:,2); …
eperp13(:,3);-eperp13(:,3);eperp21(:,3);-eperp21(:,3)];
G = sparse(GI,GJ,GV, 3*size(F,1), size(V,1));
%% Alternatively
%%
%% f(x) is piecewise-linear function:
%%
%% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk
%% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk
%% = ∇φi fi + ∇φj fj + ∇φk) fk
%%
%% ∇φi = 1/hjk ((Vj-Vk)/||Vj-Vk||)^perp =
%% = ||Vj-Vk|| /(2 Aijk) * ((Vj-Vk)/||Vj-Vk||)^perp
%% = 1/(2 Aijk) * (Vj-Vk)^perp
%%
%m = size(F,1);
%eperp32 = bsxfun(@times,cross(u,v32),1./dblA);
%G = sparse( …
% [0*m + repmat(1:m,1,3) …
% 1*m + repmat(1:m,1,3) …
% 2*m + repmat(1:m,1,3)]’, …
% repmat([F(:,1);F(:,2);F(:,3)],3,1), …
% [eperp32(:,1);eperp13(:,1);eperp21(:,1); …
% eperp32(:,2);eperp13(:,2);eperp21(:,2); …
% eperp32(:,3);eperp13(:,3);eperp21(:,3)], …
% 3*m,size(V,1));
if dim == 2
G = G(1:(size(F,1)*dim),:);
end
% Should be the same as:
% g = …
% bsxfun(@times,X(F(:,1)),cross(u,v32)) + …
% bsxfun(@times,X(F(:,2)),cross(u,v13)) + …
% bsxfun(@times,X(F(:,3)),cross(u,v21));
% g = bsxfun(@rdivide,g,dblA);
case 4
% really dealing with tets
T = F;
% number of dimensions
assert(dim == 3);
% number of vertices
n = size(V,1);
% number of elements
m = size(T,1);
% simplex size
assert(size(T,2) == 4);
if m == 1 && ~isnumeric(V)
simple_volume = @(ad,r) -sum(ad.*r,2)./6;
simple_volume = @(ad,bd,cd) simple_volume(ad, …
[bd(:,2).*cd(:,3)-bd(:,3).*cd(:,2), …
bd(:,3).*cd(:,1)-bd(:,1).*cd(:,3), …
bd(:,1).*cd(:,2)-bd(:,2).*cd(:,1)]);
P = sym(‘P’,[1 3]);
V1 = V(T(:,1),:);
V2 = V(T(:,2),:);
V3 = V(T(:,3),:);
V4 = V(T(:,4),:);
V1P = V1-P;
V2P = V2-P;
V3P = V3-P;
V4P = V4-P;
A1 = simple_volume(V2P,V4P,V3P);
A2 = simple_volume(V1P,V3P,V4P);
A3 = simple_volume(V1P,V4P,V2P);
A4 = simple_volume(V1P,V2P,V3P);
B = [A1 A2 A3 A4]./(A1+A2+A3+A4);
G = simplify(jacobian(B,P).’);
return
end
% f(x) is piecewise-linear function:
%
% f(x) = ∑ φi(x) fi, f(x ∈ T) = φi(x) fi + φj(x) fj + φk(x) fk + φl(x) fl
% ∇f(x) = … = ∇φi(x) fi + ∇φj(x) fj + ∇φk(x) fk + ∇φl(x) fl
% = ∇φi fi + ∇φj fj + ∇φk fk + ∇φl fl
%
% ∇φi = 1/hjk = Ajkl / 3V * (Facejkl)^perp
% = Ajkl / 3V * (Vj-Vk)x(Vl-Vk)
% = Ajkl / 3V * Njkl / ||Njkl||
%
% get all faces
F = [ …
T(:,1) T(:,2) T(:,3); …
T(:,1) T(:,3) T(:,4); …
T(:,1) T(:,4) T(:,2); …
T(:,2) T(:,4) T(:,3)];
% compute areas of each face
A = doublearea(V,F)/2;
N = normalizerow(normals(V,F));
% compute volume of each tet
vol = volume(V,T);
GI = …
[0*m + repmat(1:m,1,4) …
1*m + repmat(1:m,1,4) …
2*m + repmat(1:m,1,4)];
GJ = repmat([T(:,4);T(:,2);T(:,3);T(:,1)],3,1);
GV = repmat(A./(3*repmat(vol,4,1)),3,1).*N(:);
G = sparse(GI,GJ,GV, 3*m,n);
end
end
the sphere.off file (mesh data) image processing, image segmentation, digital image processing, geometry processing, toolbox, matrix MATLAB Answers — New Questions
How to compute the Shapley value of BP neural network
Hello, I trained a BP nerual network using newff function, and wanted to obtain its Shapley value. But error occurs like this:
How can I deal with it?Hello, I trained a BP nerual network using newff function, and wanted to obtain its Shapley value. But error occurs like this:
How can I deal with it? Hello, I trained a BP nerual network using newff function, and wanted to obtain its Shapley value. But error occurs like this:
How can I deal with it? interpret machine learning models MATLAB Answers — New Questions
Why is the Properties Panel blacked out now when opening a document?
My company is creating a document library. We are using the document properties panel to fill in document information.
When we began building the library, all the properties information was available when you opened a document. Now, this is no longer the case. Does anyone have any insight into how this happened and how to fix it?
My company is creating a document library. We are using the document properties panel to fill in document information. When we began building the library, all the properties information was available when you opened a document. Now, this is no longer the case. Does anyone have any insight into how this happened and how to fix it? Read More
Unveiling Azure OpenAI Service Provisioned Reservations and hourly pricing
Introduction
Microsoft recently launched Azure Essentials to provide guidance for managing your cloud investments efficiently by choosing the pricing offers that best meet your needs, paying only for what you use, and managing your cloud spend as your business evolves, whether you’re migrating your first workload or optimizing complex deployments. In alignment with the launch of Azure Essentials, the Microsoft team is thrilled to announce meaningful changes to provisioned deployments for Azure OpenAI Service. My name is Roman, I am part of the AI global black belt and it’s an absolute pleasure to share some of these changes with you today.
Starting today, we are rolling out several updates that are going to change the way you procure and deploy Provisioned Throughput Units. These changes are designed to help you be more agile, faster to market and more cost effective. The changes unveiled today only pertain to the provisioned deployments purchasing process. The technical value proposition is still the same and provisioned deployments remain the best option for real-time and high throughput applications.
Today we are announcing:
Self-service provisioning and model independent quota requests
Visibility to service capacity and availability
Provisioned hourly pricing and provisioned reservations
This blog post will focus on the last point and will delve into Azure Reservations for Provisioned Deployments. To learn more about all these changes, visit this link.
Late summer 2023, Microsoft launched Provisioned Throughput Units for Azure Open AI Service. This was, and still is, a way for customers to request a specified amount of computational power in the Azure OpenAI Service and solve the challenges related to the “noisy neighbor” problem presented with AI computing in a public cloud. In contrast with the regional standard and global-standard deployments, provisioned deployments allow customers to create a deployment with a guaranteed measure of capacity; as a result, customers can build GenAI applications with predictable latency and throughput.
Until today, if you wanted to create a provisioned deployment, you had to plan carefully and work with your account team; quota meant actual capacity carved out from the pool and pre-allocated to your subscription temporarily until the purchase was completed. The capacity and model family that you committed to using for 30 days was strongly coupled with what you could deploy. In addition, you had to tie your commitment to a specific resource and that could cause an administrative burden for multi region or even multi subscription architectures.
Introducing hourly no-commitment purchasing
At Microsoft, we want to empower our customers to build world class, real-time, high throughput applications using generative AI. To do that, we want to make our provisioned deployments more easily accessible; we want to provide as much flexibility as possible alongside high quality of service. We no longer require a 30-day minimum commitment to purchase provisioned throughput. You can now create a provisioned deployment in a self-service manner just to run a benchmarking script this afternoon if you so desire. And you can also tear down the deployment when done. No strings attached. To do this, we came up with an easy-to-understand, flat, hourly price of $2 (subject to change, check this link for up-to-date pricing) per unit per hour. It does not matter if you deploy GPT-3.5-Turbo or GPT-4o, the price per unit is the same and the construct of a provisioned throughput unit now becomes entirely model independent. That said, different models still have different minimum increment sizes. Taking GPT-4o as an example, you can deploy any multiple of 50 PTUs.
We did not stop there. If even one hour is more than you need, you can stop use early and we will prorate the cost for partial hours. If you create a provisioned deployment of 100 units and only use it for 15 minutes, you will be billed the equivalent of 25 hourly units. We want to make provisioned deployments accessible to all.
This option is great for all testing scenarios as well as transition periods where customers might be moving a deployment from one region to another and want to do so without PTU downtime.
Introducing Azure OpenAI Service provisioned reservations
Hourly no-commitment purchasing gives our customers more flexibility. But in the spirit of making provisioned deployments even more accessible, we also wanted to provide a mechanism for cost optimization.
Say you built an application and hopefully you enjoyed the hourly pricing; during development, it gave you all the flexibility to run your tests against several models with various parameters. But you have now deployed that application in production, and it will be sending completion requests steadily. Not just for the next few hours, but also weeks and months to come. In that case, Azure OpenAI Service provisioned reservations will be immensely beneficial. Azure reservations do not change your provisioned deployment at all from a technical standpoint. Rather, it overlays a predictable and cost-effective billing mechanism on top of it.
The way it works is simple. In Azure OpenAI Studio, we provide a simple capacity calculator, you input the characteristics of your applications, and the calculator estimates the number of units you would need to provision to cover the entirety of the requests you expect to process with your deployment.
The capacity calculator in Azure Open AI Studio
As a customer, using the calculator you determine that across your applications, you will need a certain number of Provisioned Throughput Units. From there, you can purchase this number of PTU reservations for one month or one year in your Azure portal. By making a monthly reservation, you can save up to 82%* over the hourly rate and for a one-year reservation you can save up to 85%**. Keep in mind that although you must select a region, you do not need to commit to a specific model or model family any longer. Say you reserve 500 units for the year, you get a sizeable discount, and you can switch the models to which the units are allocated, mix and match models across multiple deployments, create and tear down deployments at will. Also keep in mind that reservations and deployments are now decoupled and can be changed entirely independently. Purchasing a PTU reservation does not create a deployment or guarantee availability of capacity. So, it is our recommendation to first create the deployment and only then proceed with the reservation. This methodology ensures that you do not purchase a reservation that cannot be fulfilled due to a temporary capacity shortage.
Reservations can be flexibly scoped to cover deployments in a single resource group, a subscription, a list of subscriptions in a management group, or all subscriptions in the same billing context. Now, if you are a large enterprise with say one subscription per business unit and within those subscriptions perhaps you have one resource on a per application basis, you can now purchase one single centralized reservation to cover all.
If the number of units you have reserved matches the units you have deployed, you are in good shape and you are optimizing cost as much as possible. If the number of units you have reserved is greater than the units you have deployed, then you are leaving value on the table. And if you deployed more units than reserved, then the difference is billed hourly as described in the previous paragraph. In any case, it is good practice to reassess your coverage periodically.
Conclusion
This new iteration does not change the technical characteristics of provisioned deployments. Those still provide the best-in-class service with respect to low and predictable latency. In terms of procurement, however, it is a brand-new world. Self service provisioning, model independent units along with hourly on-demand deployment for maximum flexibility and Reservations for maximum cost savings, provisioned deployments for Azure OpenAI are more attractive now than ever and barriers to entry have been lowered.
Learn more about how to elevate reliability, security, and ongoing performance of your cloud and AI investments with Azure Essentials.
Additional Resources:
What are Azure Reservations? – Microsoft Cost Management | Microsoft Learn
Reservations | Microsoft Azure
Azure OpenAI Service provisioned throughput – Azure AI services | Microsoft Learn
Azure OpenAI Service Provisioned Throughput Units (PTU) onboarding – Azure AI services | Microsoft Learn
*The 82% savings are based on the Provisioned Throughput Hourly rate of approximately $2/hour, compared to the reduced rate of a 1-month reservation at approximately $0.3562/hour. Azure pricing as of July 29, 2024 (prices subject to change). Actual savings may vary depending on the specific Azure OpenAI model and region availability.
**The 85% savings are based on the Provisioned Throughput Hourly rate of approximately $2/hour, compared to the reduced rate of a 1-year reservation at approximately $0.3028/hour. Azure pricing as of July 29, 2024 (prices subject to change). Actual savings may vary depending on the specific Azure OpenAI model and region availability.
My sincere appreciation to contributors and reviewers: Tierney Morgan, Mary Newcomer Williams, Kailyn Sylvester, Kyle Ikeda, Andy Beatman, David Huntley and Noah Aldonas.
Microsoft Tech Community – Latest Blogs –Read More
Find what toolboxes a script uses
Hello to all,
We need to buy a Matlab license for a project and we already have a working collection of scripts. However, there are so many functions used that it is very difficult to find out what toolboxes we need to buy (it will take a lot of time to check each function’s origin). Is there a tool created by Mathworks which will allow us to find out what toolboxes or Matlab packages are used for a given script?
Best regards,
JeanHello to all,
We need to buy a Matlab license for a project and we already have a working collection of scripts. However, there are so many functions used that it is very difficult to find out what toolboxes we need to buy (it will take a lot of time to check each function’s origin). Is there a tool created by Mathworks which will allow us to find out what toolboxes or Matlab packages are used for a given script?
Best regards,
Jean Hello to all,
We need to buy a Matlab license for a project and we already have a working collection of scripts. However, there are so many functions used that it is very difficult to find out what toolboxes we need to buy (it will take a lot of time to check each function’s origin). Is there a tool created by Mathworks which will allow us to find out what toolboxes or Matlab packages are used for a given script?
Best regards,
Jean toolbox, package, matlab, script, functions MATLAB Answers — New Questions
Find which toolboxes are required
I need to figure out what toolboxes are required for a particular script on Matlab 2013b. I found the matlab.codetools.requiredFilesAndProducts function, but that’s apparently newer than 2013b. I searched further and found ‘depfun’, but when I ran trace = depfun(‘myScript.m’), I got this error:
Error using newdepfun
The specified superclass ‘mlreportgen.dom.DocumentPart’ contains a parse error or cannot be found on MATLAB’s
search path, possibly shadowed by another file with the same name.
Error in depfun/analyze_trace_all (line 485)
[arglist{:}] = newdepfun(trace_list,ndf_options{:} );
Error in depfun (line 312)
analyze_trace_all; % calls newdepfun
What else can I try?I need to figure out what toolboxes are required for a particular script on Matlab 2013b. I found the matlab.codetools.requiredFilesAndProducts function, but that’s apparently newer than 2013b. I searched further and found ‘depfun’, but when I ran trace = depfun(‘myScript.m’), I got this error:
Error using newdepfun
The specified superclass ‘mlreportgen.dom.DocumentPart’ contains a parse error or cannot be found on MATLAB’s
search path, possibly shadowed by another file with the same name.
Error in depfun/analyze_trace_all (line 485)
[arglist{:}] = newdepfun(trace_list,ndf_options{:} );
Error in depfun (line 312)
analyze_trace_all; % calls newdepfun
What else can I try? I need to figure out what toolboxes are required for a particular script on Matlab 2013b. I found the matlab.codetools.requiredFilesAndProducts function, but that’s apparently newer than 2013b. I searched further and found ‘depfun’, but when I ran trace = depfun(‘myScript.m’), I got this error:
Error using newdepfun
The specified superclass ‘mlreportgen.dom.DocumentPart’ contains a parse error or cannot be found on MATLAB’s
search path, possibly shadowed by another file with the same name.
Error in depfun/analyze_trace_all (line 485)
[arglist{:}] = newdepfun(trace_list,ndf_options{:} );
Error in depfun (line 312)
analyze_trace_all; % calls newdepfun
What else can I try? depfun, r2013b, toolbox dependencies, dependency report MATLAB Answers — New Questions
creating a satellite scenario manually vs from a TLE file
Hello,
I’m currently experimenting with the Satellite communication toolbox. I noticed that there seems to be a difference in the output between creating a satellite scenario and populating it using TLE data from a file (so using satellite(sc, tlefile)), versus defining the satellite scenario and adding the satellites’ parameters (which are extracted from the same TLE file using tleread() function) manually, despite having the same initial conditions (startTime, stopTime, and samplingTime)
For instance, with MATLAB’s TLE file ‘leoSatelliteConstellation.tle’, the following output is shown on the SatelliteViewer.
using the manual method based on tleread() and satellite(scenario,semimajoraxis,eccentricity,inclination,RAAN,argofperiapsis,trueanomaly):
and using satellite(scenario,file):
shouldn’t they have the same output?
When using actual TLE data of Iridium satellites, for instance, loading the constellation using the manual method produced an erroneous output!Hello,
I’m currently experimenting with the Satellite communication toolbox. I noticed that there seems to be a difference in the output between creating a satellite scenario and populating it using TLE data from a file (so using satellite(sc, tlefile)), versus defining the satellite scenario and adding the satellites’ parameters (which are extracted from the same TLE file using tleread() function) manually, despite having the same initial conditions (startTime, stopTime, and samplingTime)
For instance, with MATLAB’s TLE file ‘leoSatelliteConstellation.tle’, the following output is shown on the SatelliteViewer.
using the manual method based on tleread() and satellite(scenario,semimajoraxis,eccentricity,inclination,RAAN,argofperiapsis,trueanomaly):
and using satellite(scenario,file):
shouldn’t they have the same output?
When using actual TLE data of Iridium satellites, for instance, loading the constellation using the manual method produced an erroneous output! Hello,
I’m currently experimenting with the Satellite communication toolbox. I noticed that there seems to be a difference in the output between creating a satellite scenario and populating it using TLE data from a file (so using satellite(sc, tlefile)), versus defining the satellite scenario and adding the satellites’ parameters (which are extracted from the same TLE file using tleread() function) manually, despite having the same initial conditions (startTime, stopTime, and samplingTime)
For instance, with MATLAB’s TLE file ‘leoSatelliteConstellation.tle’, the following output is shown on the SatelliteViewer.
using the manual method based on tleread() and satellite(scenario,semimajoraxis,eccentricity,inclination,RAAN,argofperiapsis,trueanomaly):
and using satellite(scenario,file):
shouldn’t they have the same output?
When using actual TLE data of Iridium satellites, for instance, loading the constellation using the manual method produced an erroneous output! satellite, tle data, satellitescenario MATLAB Answers — New Questions
beautifier Pipeline CLI
I run Newman in my pipeline, but it does not show any beautifiers. Are there any way to apply beautifies into Azure Pipeline.
As below
I run Newman in my pipeline, but it does not show any beautifiers. Are there any way to apply beautifies into Azure Pipeline. As below Read More
Add 1 to a cell based on font color of another cell
I already have a rule set up changing the font color of a cell to red or green based on other inputs. But is there a way to have a rule that “adds 1” to a cell based on if other cells font is red or green?
For example, once I enter some inputs, cell B5’s font color on sheet 1 will either turn red or green. Can I have another cell “add 1” if B5 turns green and not add anything if it turns red? So if I have 12 sheets that all have a B5 that either turns red or green, can I have another “Summary” sheet that adds 1 to a cell for each B5 that is green in the other sheets?
Thanks in advance for any help if this is even possible.
I already have a rule set up changing the font color of a cell to red or green based on other inputs. But is there a way to have a rule that “adds 1” to a cell based on if other cells font is red or green? For example, once I enter some inputs, cell B5’s font color on sheet 1 will either turn red or green. Can I have another cell “add 1” if B5 turns green and not add anything if it turns red? So if I have 12 sheets that all have a B5 that either turns red or green, can I have another “Summary” sheet that adds 1 to a cell for each B5 that is green in the other sheets? Thanks in advance for any help if this is even possible. Read More
Record Online Training in Teams
Is there a way to record an online training in Teams where it screen captures and records the audio without me needing to listen or have my mic on?
I attended a training that I’d like to repurpose for my team, so I’d like to just throw it on in the background while I work so it can record.
Is there a way to record an online training in Teams where it screen captures and records the audio without me needing to listen or have my mic on? I attended a training that I’d like to repurpose for my team, so I’d like to just throw it on in the background while I work so it can record. Read More
Help on formula
I have two sheets. The Coordinator sheet is like a master file and cell B7 to CM26 has a conditional formatting that I want to populate on the Consultant sheet.
Coordinator sheet – master file
If say on the Consultant sheet – coordinator C1 is selected, I want the ‘V with green fill’ be populated on the matching dates:
FYI – column A in Consultant sheet is a dropdown of the list of coordinators in the Coordinator Sheet
I use this formula but its giving me the #N/A error:
=INDEX(Coordinators!$B$7:$CM$26,MATCH(Consultant!B11,Coordinators!$B$6:$CM$6,0),MATCH(Consultant!$A$12,Coordinators!$A$7:$A$26,0))
You’re assistance is greatly appreciated!
I have two sheets. The Coordinator sheet is like a master file and cell B7 to CM26 has a conditional formatting that I want to populate on the Consultant sheet. Coordinator sheet – master file If say on the Consultant sheet – coordinator C1 is selected, I want the ‘V with green fill’ be populated on the matching dates: FYI – column A in Consultant sheet is a dropdown of the list of coordinators in the Coordinator Sheet I use this formula but its giving me the #N/A error: =INDEX(Coordinators!$B$7:$CM$26,MATCH(Consultant!B11,Coordinators!$B$6:$CM$6,0),MATCH(Consultant!$A$12,Coordinators!$A$7:$A$26,0)) You’re assistance is greatly appreciated! Read More
REMINDER: Join the August 15th Azure Office hours
Join our Microsoft SMEs as they walk you through the new Azure Data Strategy eBook for ITDMs. Hear the highlights of this new, in-depth eBook and gather tips on how to help nonprofits harness their data to drive nonprofit mission success.
If you haven’t already registered, REGISTER NOW
WHEN
Date: August 15, 2024
Time: 8:00 am – 9:00 am PT | 11:00 am – 12:00 pm ET
If you can’t attend this session, please register so you can receive the recording: Register here
SPEAKERS
Join our Microsoft SMEs as they walk you through the new Azure Data Strategy eBook for ITDMs. Hear the highlights of this new, in-depth eBook and gather tips on how to help nonprofits harness their data to drive nonprofit mission success.
If you haven’t already registered, REGISTER NOW
WHEN
Date: August 15, 2024
Time: 8:00 am – 9:00 am PT | 11:00 am – 12:00 pm ET
If you can’t attend this session, please register so you can receive the recording: Register here
SPEAKERS
Time Zone Issue
Hello All,
I’m new to Power Automate, but I’m trying to do something for the company I work for and thought I’d ask here. So, I created an automation process where when a new item on a list is created, it grabs the item, composes it, and creates it as a txt file. On the parallel branch I made, I also grab the attachment, get the content, compose it and make a file as well and store both of these files on a Sharepoint directory.
What I’m noticing though is that the content from the attachment, when it’s created into a file the time zone is wrong. It’s 5 hours ahead. I read that this program uses Coordinated Universal time. I tried using Convert Time Zone, but I can’t seem to select the time from the attachment, so it’s always fails to show the right time. I’m guessing because it’s a string inside of the attachment.
I can’t seem to find a way to make sure the emails show in Central US Time. Does anyone have any guidance on this? Greatly appreciate any help.
This is my first time making a flow so please be kind with my, assumably, messy flow haha.
Hello All, I’m new to Power Automate, but I’m trying to do something for the company I work for and thought I’d ask here. So, I created an automation process where when a new item on a list is created, it grabs the item, composes it, and creates it as a txt file. On the parallel branch I made, I also grab the attachment, get the content, compose it and make a file as well and store both of these files on a Sharepoint directory. What I’m noticing though is that the content from the attachment, when it’s created into a file the time zone is wrong. It’s 5 hours ahead. I read that this program uses Coordinated Universal time. I tried using Convert Time Zone, but I can’t seem to select the time from the attachment, so it’s always fails to show the right time. I’m guessing because it’s a string inside of the attachment. I can’t seem to find a way to make sure the emails show in Central US Time. Does anyone have any guidance on this? Greatly appreciate any help. This is my first time making a flow so please be kind with my, assumably, messy flow haha. Read More
Customize sharepoint list item
My organization gives four training each year to employees. So, we are creating four columns for each year: Ex, four columns for 2024 and five for 2025. Over time will end up having so many columns in one list. I just trying to avoid this. Maybe show only the current year and hide the rest. Or if I cancel the 2024 date, and add 2025, how can I generate a report that includes both dates?
My organization gives four training each year to employees. So, we are creating four columns for each year: Ex, four columns for 2024 and five for 2025. Over time will end up having so many columns in one list. I just trying to avoid this. Maybe show only the current year and hide the rest. Or if I cancel the 2024 date, and add 2025, how can I generate a report that includes both dates? Read More
Adopting Public IPv6 for Three-Tier Web Applications
With public IPv4 addresses nearing full allocation, the costs and effort of maintaining IPv4 public IPs for your workloads will only increase. Using IPv6 public addresses can resolve this; there are more of them, and they are more affordable to acquire. Doing so also improves compatibility any IPv6-primary clients, such as IoT devices.
With Application Gateways now supporting dual-stack configuration, you can use an IPv6 address as your front-end for web applications in Azure. Making this change only impacts the front-end; you do not need to assign any internal IPv6 address space to use this, and you can continue to use an IPv4 front-end where needed..
This document streamlines the process of exposing your current web applications to the internet via IPv6 while continuing to run IPv4 on your Azure Virtual Machines. This scenario is ideal for those who need IPv6 exposure but do not require full adoption of IPv6 within Azure.
Existing Solution
The entire environment operates on IPv4 and consists of a single Virtual Network with four subnets:
AppGwSubnet
Contains an Application Gateway that acts as the frontend, load balancing traffic to the web servers in the WebSubnet.
WebSubnet
Contains two IIS web servers that direct traffic to the AppServer Internal Load Balancer VIP in the AppSubnet, which distributes the load among the AppServers.
AppSubnet
Contains two AppServer that direct traffic to the Database Internal Load Balancer VIP in the DataSubnet, which distributes the load among the database servers.
DataSubnet
Contains two database servers using Master/Slave replication that respond to queries from the AppServers.
Step-by-Step Adoption Process
1. Develop an IPv6 address plan and update your virtual network with an IPv6 address space.
1a. Refer to the Conceptual planning for IPv6 networking for guidance on planning your IPv6 networking strategy. For IPv6, it is best practice to deploy a /56 prefix for your Virtual Network and /64 prefixes for your subnets.
Conceptual planning for IPv6 networking – Azure Architecture Center | Microsoft Learn
1b. Add an IPv6 address to your virtual network and to the subnet associated with your Application Gateway to support a dual-stack (IPv4 and IPv6) configuration
Add IPv6 to Virtual Network and Subnet
Note: If your subnet currently hosts an Application Gateway SKU V1, you will need to create a new subnet to deploy a Dual-Stack Application Gateway. However, if you are using Application Gateway SKU V2, you can deploy the Dual-Stack Application Gateway within the same subnet.
2. Deploy a New Dual-Stack Application Gateway and Configure new IPv4 and IPv6 Frontend IPs
2a. Set up a new Application Gateway with dual-stack support to handle both IPv4 and IPv6 traffic. During its creation, assign new public frontend IP addresses for both IPv4 and IPv6.
Create a Dual-Stack Application Gateway
Create IPv4 and IPv6 Frontend IP’s
2b. Ensure the new Dual-Stack Application Gateway is configured with the same settings as the original. This includes Listeners with TLS Certificates (for HTTPS/TLS offload), Routing Rules with Backend HTTP Settings (including certificates for End-to-End TLS), Backend Pools, and Health Probes.
2c. Both your IPv4 and IPv6 frontend IPs will use the same Web Application backend pool. Ensure the backend pool is healthy before proceeding to the next step.
3. Update Public DNS Records
3a. Update the DNS ‘A’ record to point to the new dual-stack public IPv4 frontend IP address. Similarly, update the DNS ‘AAAA’ record to point to the new dual-stack public IPv6 frontend IP address.
Create an Azure Public DNS Record
Note: If you are using Public DNS in Azure, please follow the link above. If you are using a different Public DNS service, ensure that the records are updated accordingly
4. Decommission the Original Application Gateway
4a. Once you’ve updated the DNS records and confirmed that your new IPv4 and IPv6 frontend IP addresses are operational on your dual-stack Application Gateway, you can safely delete the original IPv4-only Application Gateway.
Learn More:
Stay Updated on Azure Products Supporting IPv6
What is IPv6 for Azure Virtual Network?
https://learn.microsoft.com/azure/virtual-network/ip-services/ipv6-overview
Microsoft Tech Community – Latest Blogs –Read More