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

Allow non-constant value for vector I[#value,index] instead of just i[#value,index] #441

Closed
Reptorian1125 opened this issue Feb 1, 2025 · 2 comments

Comments

@Reptorian1125
Copy link

Reptorian1125 commented Feb 1, 2025

Right now, I have this code:

		modifiable_array_ind=$start_img_ind+(t<<1);
		unmodifiable_array_ind=modifiable_array_ind+1;
		current_coordinates=I[#modifiable_array_ind,0];

This leads to:

[gmic] *** Error in ./+rep_random_subdivision_of_dimension_boundaries/ (file 'C:\Users\Miguel\user.gmic', line #67) *** Command 'eval': [instance(1,1,1,1,000002AF10CD46D0,non-shared)] gmic<float32>::[gmic_math_parser] gmic<float32>::eval(): Value accessor '[]': Specified image index is not a constant, in expression 'current_coordinates=I[#modifiable_array_ind,0]'.

A non-constant value will work for i[#value,index] though.

Or even just different consts per threads defined by begin_t().

@Reptorian1125
Copy link
Author

Reptorian1125 commented Feb 1, 2025

My solution is this:

modifiable_array_ind=$start_img_ind+(t<<1);	
unmodifiable_array_ind=modifiable_array_ind+1;
copy(current_selection[0],i[#modifiable_array_ind,v(0,da_size(#modifiable_array_ind)-1)],coordinates_and_iterations_array_size,1,h(#modifiable_array_ind));
da_remove(#modifiable_array_ind,0);

This allows me to use non-constant value without using I[#value,index]. Kinda unweldly, but it is what it is.

@dtschump
Copy link
Collaborator

dtschump commented Feb 2, 2025

Yes, using copy is the right way.
The fact is that when you specify a non constant image index (so potentially variable), the math compiler cannot determine the spectrum of the associated image at compile time, and thus the size of the output vector.
As vector objects are static, their sizes must be known at compile time.

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