Adding rows of one matrix to columns of another matrix [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I'm thinking of an operation which is almost similar to the inner product of two matrices, except the elementwise product is replaced with a sum.
Suppose $A_m times n$ and $B_ntimes k$ are our two matrices, and the inner product would be:
$C$ such that $$ c_ij = sum_l=1^na_ilb_lj$$
Is there a way to do, in a vectorized manner,
$$ c_ij = sum_l=1^na_il + b_lj$$
?
Can this result be derived from other well-known matrix addition or product operations?
linear-algebra vectorization
closed as off-topic by Alex Francisco, John Ma, amWhy, Xander Henderson, José Carlos Santos Jul 19 at 22:59
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." â Alex Francisco, amWhy, Xander Henderson
add a comment |Â
up vote
0
down vote
favorite
I'm thinking of an operation which is almost similar to the inner product of two matrices, except the elementwise product is replaced with a sum.
Suppose $A_m times n$ and $B_ntimes k$ are our two matrices, and the inner product would be:
$C$ such that $$ c_ij = sum_l=1^na_ilb_lj$$
Is there a way to do, in a vectorized manner,
$$ c_ij = sum_l=1^na_il + b_lj$$
?
Can this result be derived from other well-known matrix addition or product operations?
linear-algebra vectorization
closed as off-topic by Alex Francisco, John Ma, amWhy, Xander Henderson, José Carlos Santos Jul 19 at 22:59
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." â Alex Francisco, amWhy, Xander Henderson
1
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm thinking of an operation which is almost similar to the inner product of two matrices, except the elementwise product is replaced with a sum.
Suppose $A_m times n$ and $B_ntimes k$ are our two matrices, and the inner product would be:
$C$ such that $$ c_ij = sum_l=1^na_ilb_lj$$
Is there a way to do, in a vectorized manner,
$$ c_ij = sum_l=1^na_il + b_lj$$
?
Can this result be derived from other well-known matrix addition or product operations?
linear-algebra vectorization
I'm thinking of an operation which is almost similar to the inner product of two matrices, except the elementwise product is replaced with a sum.
Suppose $A_m times n$ and $B_ntimes k$ are our two matrices, and the inner product would be:
$C$ such that $$ c_ij = sum_l=1^na_ilb_lj$$
Is there a way to do, in a vectorized manner,
$$ c_ij = sum_l=1^na_il + b_lj$$
?
Can this result be derived from other well-known matrix addition or product operations?
linear-algebra vectorization
asked Jul 18 at 14:29
Jaidev Deshpande
1033
1033
closed as off-topic by Alex Francisco, John Ma, amWhy, Xander Henderson, José Carlos Santos Jul 19 at 22:59
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." â Alex Francisco, amWhy, Xander Henderson
closed as off-topic by Alex Francisco, John Ma, amWhy, Xander Henderson, José Carlos Santos Jul 19 at 22:59
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." â Alex Francisco, amWhy, Xander Henderson
1
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14
add a comment |Â
1
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14
1
1
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You could write $C = Ax_nx_k^T + x_mx_n^TB$, where $x_n$ denotes the column vector of length $n$ with $x = (1,1,dots,1)^T$.
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You could write $C = Ax_nx_k^T + x_mx_n^TB$, where $x_n$ denotes the column vector of length $n$ with $x = (1,1,dots,1)^T$.
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
add a comment |Â
up vote
2
down vote
accepted
You could write $C = Ax_nx_k^T + x_mx_n^TB$, where $x_n$ denotes the column vector of length $n$ with $x = (1,1,dots,1)^T$.
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You could write $C = Ax_nx_k^T + x_mx_n^TB$, where $x_n$ denotes the column vector of length $n$ with $x = (1,1,dots,1)^T$.
You could write $C = Ax_nx_k^T + x_mx_n^TB$, where $x_n$ denotes the column vector of length $n$ with $x = (1,1,dots,1)^T$.
edited Jul 18 at 15:18
answered Jul 18 at 14:55
Omnomnomnom
121k784170
121k784170
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
add a comment |Â
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
I'm not sure I'm getting this right. That still maintains the size of A and B, so the RHS is not a valid matrix sum. Am I missing something?
â Jaidev Deshpande
Jul 18 at 15:10
1
1
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
@JaidevDeshpande see my latest edit
â Omnomnomnom
Jul 18 at 15:18
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
Thanks! That works.
â Jaidev Deshpande
Jul 18 at 15:23
add a comment |Â
1
Welcome to MSE. Please read this text about how to ask a good question.
â José Carlos Santos
Jul 18 at 14:34
For what it's worth - I can sum one matrix row-wise and the other column wise, and then take their inner product. But I'm curious if there's a way that doesn't involve the column or row-wise sum.
â Jaidev Deshpande
Jul 18 at 15:14