3-D numpy matrix multiplication in numpy to get 1 D arrayHow to get the current time in PythonGetting the last element of a list in PythonHow do I get the number of elements in a list in Python?Peak detection in a 2D arrayDump a NumPy array into a csv fileCatch multiple exceptions in one line (except block)Numpy matrix multiplication with array of matricesUnexpected output in for loopMultiply array of vectors with array of matrices; return array of vectors?Matrix multiplication for multidimensional matrix (/array) - how to avoid loop?

Is it a Munchausen Number?

Fee negotiations in Lightning

Does Thread.yield() do anything if we have enough processors to service all threads?

Libertine font numbers have a different height than text

Pre-1993 comic in which Wolverine's claws were turned to rubber?

Why is there a cap on 401k contributions?

Was there a contingency plan in place if Little Boy failed to detonate?

Which spells are in some way related to shadows or the Shadowfell?

What's an appropriate age to involve kids in life changing decisions?

Are on’yomi words loanwords?

Is there a need for better software for writers?

My perfect evil overlord plan... or is it?

What is the radius of the circle in this problem?

Can the president of the United States be guilty of insider trading?

Unicode-math and mathrm result in missing symbols

How can I make parentheses stick to formula?

Do Monks gain the 9th level Unarmored Movement benefit when wearing armor or using a shield?

"Estrontium" on poster

Passport stamps art, can it be done?

Employee is self-centered and affects the team negatively

Examples where existence is harder than evaluation

Locked my sa user out

Why did Missandei say this?

Why was Sam Wilson chosen for this, but not Bucky?



3-D numpy matrix multiplication in numpy to get 1 D array


How to get the current time in PythonGetting the last element of a list in PythonHow do I get the number of elements in a list in Python?Peak detection in a 2D arrayDump a NumPy array into a csv fileCatch multiple exceptions in one line (except block)Numpy matrix multiplication with array of matricesUnexpected output in for loopMultiply array of vectors with array of matrices; return array of vectors?Matrix multiplication for multidimensional matrix (/array) - how to avoid loop?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I've 2 3-D matrix of this form:



a = np.random.randint(0, 100, size=(3, 4, 3))



b = np.random.normal(0, 1, size=(3,3, 4))



I want to multiply these 2 matrices, in such a way that I get a matrix of this form:



a_b = np.random.normal(0,1,size = (3,1))



I can change the matrix shape of b in anyway to get a_b shape. E.g. I can make b 2X2 matrix or change the shape of the matrix in any other way.



Can someone please guide me?



Thanks!










share|improve this question



















  • 1





    I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

    – gmds
    Mar 23 at 8:23











  • (a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

    – fountainhead
    Mar 23 at 9:12











  • @fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

    – Beta
    Mar 23 at 9:17











  • As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

    – fountainhead
    Mar 23 at 9:42











  • @fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

    – Beta
    Mar 23 at 10:08

















1















I've 2 3-D matrix of this form:



a = np.random.randint(0, 100, size=(3, 4, 3))



b = np.random.normal(0, 1, size=(3,3, 4))



I want to multiply these 2 matrices, in such a way that I get a matrix of this form:



a_b = np.random.normal(0,1,size = (3,1))



I can change the matrix shape of b in anyway to get a_b shape. E.g. I can make b 2X2 matrix or change the shape of the matrix in any other way.



Can someone please guide me?



Thanks!










share|improve this question



















  • 1





    I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

    – gmds
    Mar 23 at 8:23











  • (a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

    – fountainhead
    Mar 23 at 9:12











  • @fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

    – Beta
    Mar 23 at 9:17











  • As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

    – fountainhead
    Mar 23 at 9:42











  • @fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

    – Beta
    Mar 23 at 10:08













1












1








1








I've 2 3-D matrix of this form:



a = np.random.randint(0, 100, size=(3, 4, 3))



b = np.random.normal(0, 1, size=(3,3, 4))



I want to multiply these 2 matrices, in such a way that I get a matrix of this form:



a_b = np.random.normal(0,1,size = (3,1))



I can change the matrix shape of b in anyway to get a_b shape. E.g. I can make b 2X2 matrix or change the shape of the matrix in any other way.



Can someone please guide me?



Thanks!










share|improve this question
















I've 2 3-D matrix of this form:



a = np.random.randint(0, 100, size=(3, 4, 3))



b = np.random.normal(0, 1, size=(3,3, 4))



I want to multiply these 2 matrices, in such a way that I get a matrix of this form:



a_b = np.random.normal(0,1,size = (3,1))



I can change the matrix shape of b in anyway to get a_b shape. E.g. I can make b 2X2 matrix or change the shape of the matrix in any other way.



Can someone please guide me?



Thanks!







python numpy matrix






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 8:20









AkshayNevrekar

6,460102243




6,460102243










asked Mar 23 at 8:18









BetaBeta

59341949




59341949







  • 1





    I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

    – gmds
    Mar 23 at 8:23











  • (a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

    – fountainhead
    Mar 23 at 9:12











  • @fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

    – Beta
    Mar 23 at 9:17











  • As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

    – fountainhead
    Mar 23 at 9:42











  • @fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

    – Beta
    Mar 23 at 10:08












  • 1





    I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

    – gmds
    Mar 23 at 8:23











  • (a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

    – fountainhead
    Mar 23 at 9:12











  • @fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

    – Beta
    Mar 23 at 9:17











  • As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

    – fountainhead
    Mar 23 at 9:42











  • @fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

    – Beta
    Mar 23 at 10:08







1




1





I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

– gmds
Mar 23 at 8:23





I don't think pure multiplication can get you to that shape without some kind of aggregation like summation...

– gmds
Mar 23 at 8:23













(a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

– fountainhead
Mar 23 at 9:12





(a) When you say "I want to multiply" do you really mean "multiply" as in matrix multiplication, or do you mean "somehow combine" ? (b) Normal matrix multiplication can never get you what you have asked for because the first matrix has values ranging from 1 to 100 and the second has values ranging from 0 to 1, and you are asking for the result to have values from 0 to 1. (c) Do you want the numbers in a_b to have normal distribution? (That's what your current phrasing of the question seems to imply)

– fountainhead
Mar 23 at 9:12













@fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

– Beta
Mar 23 at 9:17





@fountainhead: Thanks for your interest to my question! a) I want to multiply the 2 matrices. b) The matrix a_b can have any values. I just used np.random.normal to show the dimension and how the final matrix will look like. It's an example. c) No. I don't want it to be normally distributed. It will be multiplication of 2 matrices. So, it can have any values. Thanks!

– Beta
Mar 23 at 9:17













As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

– fountainhead
Mar 23 at 9:42





As mentioned by @gmds, no matter what shape your b is, given that a is of shape (3,4,3), I don't think you can ever get a shape (3,1) by normal matrix multiplication.

– fountainhead
Mar 23 at 9:42













@fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

– Beta
Mar 23 at 10:08





@fountainhead: Thanks for reply. I'll not spend time on this problem anymore then.

– Beta
Mar 23 at 10:08












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311918%2f3-d-numpy-matrix-multiplication-in-numpy-to-get-1-d-array%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311918%2f3-d-numpy-matrix-multiplication-in-numpy-to-get-1-d-array%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해