BLI: Add support for non-square matrix multiplication. #115783

Merged
Clément Foucault merged 7 commits from casey-bianco-davis/blender:GPv3-non-square-matrix-multiplication into main 2024-03-03 16:26:12 +01:00

Adds support for multiplying non-square non-equal matrices.

Adds support for multiplying non-square non-equal matrices.
casey-bianco-davis added 1 commit 2023-12-05 05:24:22 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
60520a92f7
BLI: Add support for non-square matrix multiplication.
casey-bianco-davis added a new dependency 2023-12-05 05:25:48 +01:00
Author
Member

@blender-bot build

@blender-bot build
Member

Only blender organization members with write access can start builds. See documentation for details.

Only blender organization members with write access can start builds. See [documentation](https://projects.blender.org/infrastructure/blender-bot/src/branch/main/README.md) for details.
Falk David requested review from Clément Foucault 2023-12-08 10:27:12 +01:00
Member

@blender-bot build

@blender-bot build
casey-bianco-davis added 1 commit 2023-12-10 06:13:12 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
c21fe7496d
Cleanup
casey-bianco-davis changed title from WIP: BLI: Add support for non-square matrix multiplication. to BLI: Add support for non-square matrix multiplication. 2023-12-10 06:23:30 +01:00
Author
Member

I think I fixed the build error, but I am have difficulties get the test to build on my local computer. so someone activating blender-bot would be helpful.

I think I fixed the build error, but I am have difficulties get the test to build on my local computer. so someone activating blender-bot would be helpful.
Iliya Katushenock added this to the Core Libraries project 2023-12-10 08:01:00 +01:00
Member

@blender-bot build

@blender-bot build
Falk David requested changes 2023-12-11 11:29:29 +01:00
Falk David left a comment
Member

Added some feedback

Added some feedback
@ -384,1 +382,4 @@
/** Multiply two compatible matrices using matrix multiplication. */
template<int OtherNumRow>
MatBase<T, OtherNumRow, NumRow> operator*(const MatBase<T, OtherNumRow, NumCol> &b) const
Member

This won't work, because the template specialization is the same as MatBase<T, NumRow, NumRow> operator*(const MatBase<T, NumRow, NumCol> &b) const.

This won't work, because the template specialization is the same as `MatBase<T, NumRow, NumRow> operator*(const MatBase<T, NumRow, NumCol> &b) const`.
Author
Member

Sorry I am new to c++ and don't know what is the correct way to write this. Help would be appreciated :)

Sorry I am new to c++ and don't know what is the correct way to write this. Help would be appreciated :)
Member

Not sure as well, maybe @JacquesLucke or @fclem can help?

Not sure as well, maybe @JacquesLucke or @fclem can help?

I think you just have to replace the equal size matrices case by the non-equal size. Non-equal size should give the same result as equal size if called with same size matrices.

I think you just have to replace the equal size matrices case by the non-equal size. Non-equal size should give the same result as equal size if called with same size matrices.
fclem marked this conversation as resolved
@ -458,6 +473,13 @@ struct alignas(Alignment) MatBase : public vec_struct_base<VecBase<T, NumRow>, N
return result;
}
static MatBase diagonal(const VecBase<T, min_dim> value)
Member

Seems like this is unrelated?

Seems like this is unrelated?
Author
Member

see 116077

see 116077
casey-bianco-davis marked this conversation as resolved
casey-bianco-davis added 2 commits 2023-12-12 04:52:37 +01:00
casey-bianco-davis added 1 commit 2023-12-13 03:01:20 +01:00
Clément Foucault requested changes 2024-01-22 08:22:52 +01:00
Dismissed
@ -371,6 +371,30 @@ TEST(math_matrix, MatrixMultiply)
}
}
TEST(math_matrix, RectangularMatrixMultiply)

Merge that to the MatrixMultiply.

Merge that to the `MatrixMultiply`.
casey-bianco-davis marked this conversation as resolved
@ -374,0 +375,4 @@
{
{
const float3x4 matrix_a = transpose(float4x3(float3(1.0, 0.0, 1.0),

I would avoid relying on transpose in the multiply test.

I would avoid relying on `transpose` in the multiply test.
fclem marked this conversation as resolved
@ -374,0 +376,4 @@
{
const float3x4 matrix_a = transpose(float4x3(float3(1.0, 0.0, 1.0),
float3(2.0, 1.0, 1.0),

Do not use a matrix so simple. Use a different number for each cell like the 4x4 test.
Use https://matrix.reshish.com/multCalculation.php to set the expected value.

Do not use a matrix so simple. Use a different number for each cell like the 4x4 test. Use https://matrix.reshish.com/multCalculation.php to set the expected value.
fclem marked this conversation as resolved
@ -374,0 +387,4 @@
float3(6.0f, 5.0f, 3.0f),
float3(11.0f, 9.0f, 6.0f)));
const float3x4 result = matrix_a * matrix_b;

I would add float2x3 * float3x4 and float2x3 * float3x2 to make sure the resulting matrix type is effectively float2x4 and float2x2.

I would add `float2x3 * float3x4` and `float2x3 * float3x2` to make sure the resulting matrix type is effectively `float2x4` and `float2x2`.
fclem marked this conversation as resolved
casey-bianco-davis changed title from BLI: Add support for non-square matrix multiplication. to WIP: BLI: Add support for non-square matrix multiplication. 2024-01-23 05:13:21 +01:00
Clément Foucault added 2 commits 2024-03-03 13:55:50 +01:00
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
effeea487a
Move operator* out of class, add operator for MatView, ...
remove the square matrix operator and correct a few naming
mistake.
Clément Foucault changed title from WIP: BLI: Add support for non-square matrix multiplication. to BLI: Add support for non-square matrix multiplication. 2024-03-03 13:56:46 +01:00

@blender-bot build

@blender-bot build
Clément Foucault approved these changes 2024-03-03 14:15:47 +01:00
Clément Foucault merged commit 3d136d0d00 into main 2024-03-03 16:26:12 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: blender/blender#115783
No description provided.