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

Add transpose flags to element_prod #4183

Merged

Conversation

vinx13
Copy link
Member

@vinx13 vinx13 commented Feb 20, 2018

Add transpose flags to arguments of linalg::element_prod

void element_prod(const SGMatrix<T>& A, const SGMatrix<T>& B, SGMatrix<T>& result,
                                bool transpose_A = false, bool transpose_B = false)

This makes element_prod have a consistent interface as matrix_prod

result_eig = a_block.array() * b_block.array();
if (transpose_A && transpose_B)
result_eig = a_block.transpose().array() * b_block.transpose().array();
else if (transpose_A)
Copy link
Member

Choose a reason for hiding this comment

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

why the copy paste? why doesnt one method call the other?

@vinx13 vinx13 mentioned this pull request Feb 27, 2018
if (transpose_A && transpose_B)
result_gpu->data_matrix(result.num_rows, result.num_cols) =
viennacl::linalg::element_prod(
viennacl::trans(
Copy link
Member

Choose a reason for hiding this comment

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

cant we store the "trans" in a varialbe and then use that in the if-then-else. Then we don't copy the whole code block 3 times ...

@karlnapf
Copy link
Member

Thanks!

@karlnapf karlnapf merged commit 317d3a2 into shogun-toolbox:develop Feb 28, 2018
ktiefe pushed a commit to ktiefe/shogun that referenced this pull request Jul 30, 2019
* Add transpose flags to element_prod

* Extract common part of element_prod as helper method
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.

None yet

2 participants