Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using * #8

Open
FrankDeussens opened this issue Jul 27, 2023 · 1 comment
Open

Error using * #8

FrankDeussens opened this issue Jul 27, 2023 · 1 comment

Comments

@FrankDeussens
Copy link

Hey!
I am recieving the following error very frequently:

"Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the
number of rows in the second matrix. To perform elementwise multiplication, use '.*'.

Error in TSEMO_V4>hypervolumemonte (line 633)
P=P*diag(1./r);
..."

Any idea how to fix this? Let me know if further elaboration is requiered.

@Protoplanetary-Fish
Copy link

I've not encoutered that error.

But I would recommend everyone to use this vectorized version of that function (if compatible with your MatLab version). It should be around 12-20x faster (at the cost of a bit of memory) than the one in the original codebase as it is a bottleneck on execution speed if you are pushing the algorithm.

function v = hypervolumemonte(P,r,N)

% Check input and output
narginchk(2,3);
nargoutchk(0,1);

P=P*diag(1./r);
[~,d]=size(P);

if nargin<3
    N=1000;
end
if ~isscalar(N)
    C=N;
    N=size(C,1);
else
    C=rand(N,d);
end

C_expanded = permute(C, [1 3 2]);
P_expanded = permute(P, [3 1 2]);
domination_checks = all(C_expanded > P_expanded, 3);
fDominated = any(domination_checks, 2);

v=sum(fDominated)/N;
return

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants