Skip to content

Correct return type of contracted_product#1270

Merged
JordiManyer merged 2 commits intogridap:masterfrom
ovanvincq:master
Apr 6, 2026
Merged

Correct return type of contracted_product#1270
JordiManyer merged 2 commits intogridap:masterfrom
ovanvincq:master

Conversation

@ovanvincq
Copy link
Copy Markdown
Contributor

For some reason, I use MultiValue with Unitful.jl and the behavior of the dot function has been modified with Gridap v0.20. Indeed this version returns an error because the return type of dot(a,b) is assumed to be identical to that of a or b, which is incorrect.

Example:

using Gridap, Unitful
v=VectorValue(1.0u"m",1.0u"m")
dot(v,v)

returns

  • With v0.19: 2.0 m^2
  • With v0.20: ERROR: DimensionError: m and 2.0 m^2 are not dimensionally compatible.

This PR restores the behavior of version 0.19.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.69%. Comparing base (62586b6) to head (7e7a2bd).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1270   +/-   ##
=======================================
  Coverage   88.69%   88.69%           
=======================================
  Files         226      226           
  Lines       29244    29244           
=======================================
  Hits        25939    25939           
  Misses       3305     3305           
Flag Coverage Δ
drivers 39.85% <57.14%> (ø)
extensions 5.24% <21.42%> (ø)
unit-adaptivity 37.41% <28.57%> (ø)
unit-basics 13.82% <100.00%> (ø)
unit-celldata 21.43% <28.57%> (ø)
unit-fespaces-1 32.75% <28.57%> (ø)
unit-fespaces-2 39.28% <28.57%> (ø)
unit-fields 17.74% <28.57%> (ø)
unit-geometry 29.26% <28.57%> (ø)
unit-multifield 31.34% <28.57%> (ø)
unit-odes 29.18% <28.57%> (ø)
unit-referencefes 34.76% <42.85%> (ø)
unit-visualization 12.12% <28.57%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JordiManyer
Copy link
Copy Markdown
Member

Hi @ovanvincq thank you for the fix. Can we use Base.promote_op(*, Ta,Tb) instead?

@JordiManyer
Copy link
Copy Markdown
Member

@Antoinemarteau can you check this does not appear anywhere else in your changes?

@ovanvincq
Copy link
Copy Markdown
Contributor Author

@JordiManyer ok, I now use Base.promote_op(*, Ta,Tb) and I made the same modification in other product functions (in case of a 0-dimensional MultiValue).

@JordiManyer JordiManyer merged commit 08d757a into gridap:master Apr 6, 2026
57 checks passed
@JordiManyer
Copy link
Copy Markdown
Member

@ovanvincq Thank you again. Merged!

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

Successfully merging this pull request may close these issues.

2 participants