How to create new numpy array by using a function on every row with no loops









up vote
0
down vote

favorite












so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].



I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?










share|improve this question





















  • Sounds like you're looking for numpy.apply_along_axis
    – jwil
    Nov 9 at 21:28






  • 1




    Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
    – edan patt
    Nov 9 at 21:30














up vote
0
down vote

favorite












so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].



I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?










share|improve this question





















  • Sounds like you're looking for numpy.apply_along_axis
    – jwil
    Nov 9 at 21:28






  • 1




    Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
    – edan patt
    Nov 9 at 21:30












up vote
0
down vote

favorite









up vote
0
down vote

favorite











so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].



I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?










share|improve this question













so I've got a project which asks of me to use a DFT function that I've built (on an array of size [N,1]) and use that function on an entire image of size [N,M].



I've been asked to do so using no loops and I can't figure it out.
Is there a way to use a function on each one of my rows which returns a new row and that way build a new numpy array without loops?







python-3.x image-processing computer-science






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 9 at 21:26









edan patt

1




1











  • Sounds like you're looking for numpy.apply_along_axis
    – jwil
    Nov 9 at 21:28






  • 1




    Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
    – edan patt
    Nov 9 at 21:30
















  • Sounds like you're looking for numpy.apply_along_axis
    – jwil
    Nov 9 at 21:28






  • 1




    Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
    – edan patt
    Nov 9 at 21:30















Sounds like you're looking for numpy.apply_along_axis
– jwil
Nov 9 at 21:28




Sounds like you're looking for numpy.apply_along_axis
– jwil
Nov 9 at 21:28




1




1




Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30




Hey, so numpy.apply_along_axis uses a for loop internally and is slow, I've already tested it and I wasn't very happy with the results.
– edan patt
Nov 9 at 21:30

















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',
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%2f53233469%2fhow-to-create-new-numpy-array-by-using-a-function-on-every-row-with-no-loops%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233469%2fhow-to-create-new-numpy-array-by-using-a-function-on-every-row-with-no-loops%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

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo