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

math/linalg add matrix_mul_vector_differ & update matrix_mul_vector #4434

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

blob1807
Copy link
Contributor

Currently passing a maritx[I, J]T & [J]T to matrix_mul_vector (as the inputs want) results in a type error.
Error: Cannot assign value 'a * b' of type 'matrix[2, 1]int' to '[3]int' in return statement

Add matrix_mul_vector_differ that returns the expect resulting matrix maritx[I, 1]T
Update matrix_mul_vector to take only take a maritx[I, I]T
This change shouldn't effect any current use of matrix_mul_vector

Suggested fix for #4433

add `matrix_mul_vector_differ` that returns the resulting matrix type.
update `matrix_mul_vector` to take the correct types that result in a vector.
Comment on lines 215 to 221
matrix_mul_vector :: proc "contextless" (a: $A/matrix[$I, $J]$E, b: $B/[J]E) -> (c: B)
matrix_mul_vector :: proc "contextless" (a: $A/matrix[$I, I]$E, b: $B/[I]E) -> (c: B)
where !IS_ARRAY(E), IS_NUMERIC(E) #no_bounds_check {
return a * b
}

@(require_results)
matrix_mul_vector_differ :: proc "contextless" (a: $A/matrix[$I, $J]$E, b: $B/[J]E) -> (c: matrix[I, 1]E)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you even tested this code to see if it even works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but see I missed copying something over. Sorry about that.

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