How to multiply all elements of a field
Dear all
To get the total probability of survival (one scalar) I need to multiply the probality of survival of each element. This data I have in a dpf field.
What would be the easiest way to this? Do I need to loop over the entries or is there some kind of vector operation?
Regards
Lorenz
Comments

Hi @Lorenz . I'm not sure how you want to multiply the data exactly. If you want to multiply all data in a field by a scalar value you can look into the scale operator (
dpf.operators.math.scale() or dpf.operators.math.scale_fc()
). Otherwise you can look into the different operators available within dpf.operators.math: https://dpf.docs.pyansys.com/version/stable/operator_reference.html0 
For each element I have a value between 0 and 1 in an operator and can extract it to a field.
Now I need to do the product over all elements.
(so something like accumulate or total sum, but by multiplying and not by summing)
Regards
Lorenz
0 
Hi @Lorenz , thanks for clarifying. I don't think we have such an operator available at the moment. Please consider opening a feature request on Github if this is something you would like to see implemented: https://github.com/pyansys/pydpfcore/issues
In the meantime, I think the only way will be to loop on the values in Field.data (that's a numpy.ndarray) and multiply the values from there.
0