Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8742511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:30:59+00:00 2026-06-13T11:30:59+00:00

I have an array of function instances, and several arrays of arguments to apply

  • 0

I have an array of function instances, and several arrays of arguments to apply to those instances. The array of function instances can be of arbitrary size. The definitions are as follows (yes, each function takes the same arguments):

fcn1(a, b, c)
fcn2(a, b, c)

Each function argument is an array of floats, for example:

a = numpy.array([1., 2., 3.])
b = numpy.array([1., 2., 3.])
c = numpy.array([1., 2., 3.])

The array of function instances looks like the following:

[<function fcn1 at 0x030A44F0> <function fcn2 at 0x030A4530>]

What I’m trying to is map the function arguments to each of the array instances.

So far I tried something simple like:

for f in fcn:
    print f(a, b, c)

But the way the functions are constructed, they return X number of arrays where X is the number of elements in each of a, b, and c. For example, if I simply call:

fcn1(a, b, c)

It will return (note three elements in each of the input args, three arrays returned):

[array([0.2343, 0.4943, ..., 0.8943, 0.7115]), array([0.2343, 0.4853, ..., 0.8555, 0.1915]), array([0.7773, 0.1343, ..., 0.8045, 0.9994])]

So what happens when I run my simple loop is two arrays of arrays:

[array([0.2343, 0.4943, ..., 0.8943, 0.7115]), array([0.2343, 0.4853, ..., 0.8555, 0.1915]), array([0.7773, 0.1343, ..., 0.8045, 0.9994])]
[array([0.2343, 0.4943, ..., 0.8943, 0.7115]), array([0.2343, 0.4853, ..., 0.8555, 0.1915]), array([0.7773, 0.1343, ..., 0.8045, 0.9994])]

Any thoughts on how to elegantly apply the arguments to the function instances?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:31:00+00:00Added an answer on June 13, 2026 at 11:31 am

    Not sure if I’m understanding you correctly, but did you just want:

    for f in fcn:
        for ix in range(len(a)):
          print f(a[ix], b[ix], c[ix])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm subclassing Array using prototype, in this way: MyArray = function() { Array.apply(this, arguments);
I would like to have a unique sort function for several associative arrays. The
I have an array of function callbacks, like this: class Blah { private var
All, I have the following array and function, which will create a multidimensional array
I have a cell array of anonymous function handles, and would like to create
I have my array populated like so: updateLabels: function () { var diagrams =
I have an array returned by the function Search.all : => [#<Search id: 7,
After some recursive function I have an array: first iteration: Array ( [category_id] =>
Suppose I have an array of values [a,b,c,d,...] and a function f(x,...) which returns
I have one array. I want that array to retain its value between function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.