How to define functions with composite arguments ?

  • Permalink
  • submit to reddit
  • Email
  • Follow


Am trying to call a self-defined function from a program running under the parallel computing toolkit. This function has composite arguments. If I define the function call in the usual way, I get the error message, "??? Undefined function or method '<function name>' for input arguments of type 'Composite'."

How to I pass codistributed (composite) arguments to a function? How does such a function have to be defined? 

Spent quite some time reading documentation but was unable to find a solution.

Thank you for whatever insights you can offer.
0
Reply Peter 3/18/2011 9:15:20 AM

See related articles to this posting

comp.soft-sys.matlab 203816 articles. 537 followers. Post

0 Replies
287 Views

Similar Articles

[PageSpeed] 46


Reply:

Similar Artilces:

Function pointers, variable argument functions calling other variable-argument functions (sort of)
Hi I have been searching the web and comp.lang.c of a method of using variable-argument function pointers and the like. And some of the questions arising in this post are answered partly in these posts, but I ask mainly for a way to found a way to solve this problem. I'm a hobbyist so there might be an alltogether better solution to the problem, so please come with any solution you might think of. I'm open to ideas. --- And i'm not bound by C. Suggestions from C++ are welcome. I need an extensible multithreaded application (i'm thinking windows here since I have no experience...

Getting function not defined error after defining the function
Hi, I include this Javascript at the top of my page just below the <head> and <title> elements ... <script type="text/javascript"> function reloadIfUnavailable() { if (document.title.indexOf('Page Unavailable') > -1) { window.location.reload(); } else { setTimeout('reloadIfUnavilable()', 500); } // if } // reloadIfUnavailable setTimeout('reloadIfUnavailable()', 500); </script> However, get an error on Firefox (using 3.6 on Mac 10.6.3) ... reloadIfUnavilable is not defined setTimeo...

function argument dependent on another function argument?
I would like to do: def foo(self,x,y=self.a) where the default value for y=self.a. Since this is not possible, I wind up doing def foo(self,x,y=None) if not y: y=self.a but that seems kind of clumsy. Is there a better way to do this? Thanks in advance On Jan 18, 8:19=A0am, Reckoner <recko...@gmail.com> wrote: > I =A0would like to do: > > def foo(self,x,y=3Dself.a) > > where the default value for y=3Dself.a. Since this is not possible, I > wind up doing > > def foo(self,x,y=3DNone) > =A0 if not y: > =A0 =A0 y=3Dself.a > > but that seems ...

How to configure a call library function node for a function whose argument is a data type defined in windows API
I want to configure call library function node for a function which has the argument of type HANDLE which is a data type defined in the windows API. The function prototype is&nbsp; void CanGetReceiveEvent(int handle, HANDLE *hevent); &nbsp; &nbsp; &nbsp; HANDLE is&nbsp;declared as &nbsp; typedef PVOID HANDLE; &nbsp; and PVOID is pointer to any type and is declared as &nbsp; typedef void *PVOID; &nbsp; &nbsp; &nbsp; can&nbsp;the call library function node be configured for such data types. hi Vandana, &nbsp; Can U tell us what Dll are U tr...

Variable argument function as a parameter of a variable argument function
Hi everyone, I've done a little searching, but I can't quite find an answer to my question. Everything I've found is more related to how to construct a variable argument function, and that's not my question. Suppose I have a variable argument function. Is it possible to use it to initialize a parameter of another variable argument function? For example, printf("%s", varArgFcnReturningAString(a,b,c)); I ask because I'm not sure if this is supported by the standard and/or could be compiler specific. Thank you for any help, tips, and suggestions! On 11/20/201...

Passing a function as an argument and using the evaluated function as an argument
Since you can pass a function to a ... erm...... function.... how to you use the result of a function as the argument for another function instead of passing the actual function to it. i.e. function foo2(){} function foo(func){} foo(foo2); This passes foo2 to foo, can I do foo(foo2()) ? i.e. is the difference between whether a function is passed or evaluated dependent on whether you use "()" after the function name? User1014 wrote: > Since you can pass a function to a ... erm...... function.... > > how to you use the result of a function as the argument for anothe...

About typedef -- define the function pointer or define function model?
What's the difference between these two declarations ? 1) typedef void (*pf)(void); 2) typedef void f(void); the first declaration is define a function pointer, what is the second ? define a function model? And can use the second declaration to define a function pointer as follow: typedef void f(void); f *pf; Whether the two declarations of pf1 are both pointer to a function? 1) typedef void (*pf)(void); pf pf1; 2) typedef void f(void); f *pf1; if yes, which is better? and I saw many codes used the second declaration, what is its' advantage or disa...

how to pass a function name and its arguments inside the arguments of other function?
I need something like this: 1: superfoo( non-keyword-args, keyword-args, methodname, *kargs, *kwargs): 2: """non-keyword-args and keyword-args are arguments that 3: apply to superfoo, while *kargs and **kwargs are arguments 4: that apply to methodname. See below""" 5: object=someClass() 6: result=getattr(object,methodname)(*kargs,**kwargs) 7: return result The problem is: how can I pass both arguments for superfoo and methodname in line 1: ? Is it possible? -Jose On Sat, 03 Nov 2007 02:21:30 +0000, jmborr wrote: ...

defining a function of functions
I want to define an inner product function such as (here mylist is a specified list and L is a specified constant) innerprod[f_, g_] = Sum[f[k]Conjugate[g[k]]Part[mylist,k],{k,1,L}] This works fine but now I need to apply it in a situation where f is a function of 2 variables while g is a function of only one variable, i.e. I want to compute something like the inner product of f[2,n] and g[n]. Of course, I want the ability to freely vary the first input of f. I have accomplish this before rather easily but I'm presently drawing a blank. Thanks for your help. Best, ...

Function '>=' is not defined for arguments of type 'date' and 'integer'. Explicitly convert its arguments to the desired type(s)
Hi all, I'm getting the following error message while comparing dates in Ingres database Function '>=' is not defined for arguments of type 'date' and 'integer'. Explicitly convert its arguments to the desired type(s) I feel that it has to do something with table definition. Here is my query: Select * from my_table where valid_date >= another_date; Can any one throw light on this. Thanks, Sen "Sen" <senthil.dhanapal@gmail.com> wrote > Hi all, > > I'm getting the following error message while comparing...

Calling a function that expects variable arguments from a function with variable arguments
I am writing a dynamically growing string buffer. The following struct represents a string buffer. struct strbuf { char *buffer; /* null terminated buffer */ size_t length; /* length of the string excluding null terminator */ size_t allocated; /* total memory allocated */ }; I have also got several functions to operate on this. The following function takes a format and formats it using "vsnprintf" and adds to the buffer. int strbuf_addf(struct strbuf *string, const char *format, ...) { size_t space_available; int len...

Defining a new function by composition
Hi. I would like to add a method to the Array class, say Array#pop! which is actually split!(-1). But then, I can think of a more general problem: define a new function by composition of two or more functions. In Haskell, I can do something like f :: a -> b -> c f x y = something g::b -> c g = f some_value What is the Ruby equivalent of this? Regards, Ed "Edgardo Hames" <ehames@gmail.com> schrieb im Newsbeitrag news:478c16ae0408061209424c2032@mail.gmail.com... > Hi. > > I would like to add a method to the Array class, say Array#pop! which > is actu...

How to define a define that defines some defines ?
Hi all, I have the following: /*--- SNIP ---*/ typedef struct Argument_s { char *address; int type; int length; } ARGUMENT; #define Function(F) int F( int ArgCount, ARGUMENT ArgVector[] ) #define First ArgVector[0] #define First_A First.address #define First_T First.type #define First_L First.length #define Second ArgVector[1] #define Second_A Second.address #define Second_T Second.type #define Second_L Second.length #define Third ArgVector[2] #define Third_A Third.address #define Third_T Third.type #define Third_L Third.length ...

Semi-defined Function arguments???
Hi, I have simplified the situation a lot so hopefully this still makes sense... Say I have a number of functions that work on any individual element of an array. I want to create a function "doOnAll" that will call ANY of those functions on EVERY element of the array. e.g. void doOnAll (int x) { for (i=0;i<n;i++) { if (x==0) { returnValue(i); } else if (x==1) { returnIndex(i); } else if (x==2) { returnCost(i); } } } No problem, but say each of the singular functions had different types of arguments instead of all being 'i' as they are ab...

user defined functions with optional arguments?
I have a function that has two arguents, however depending on the value of the first argument, the second one may or may not be needed. If I only input the first argument when calling the function, PHP returns a warning. many built in php functions have optional arguments, is there a way to make arguments in user defined functions optional as well? Thanks. On Wed, 17 Aug 2005 14:27:45 -0700, Exyle <usenet.qwest@reg.exyled.net> wrote: >is there a way to make arguments in user defined functions optional http://uk2.php.net/manual/en/functions.arguments.php -- Andy Hassall / &l...

Define a matrix function with size as argument
Dear all, I am quite new to Mathematica and I have the following problem I could not find track of both in the Forum and in the documentation. I need to define a matrix function with size of the matrix as an argument. The function produces a tridiagonal matrix: Q[w_] := MatrixForm[SparseArray[ {i_, j_} /; Abs[i - j] <= 1 -> Which[i < j, a[i - 1]*(1 - (i - 1)/(2*w)), i > j, (a[-i + 2*w + 1]*(i - 1))/(2*w), i == j, (-(1 - (i - 1)/(2*w)))*a[i - 1] - (a[-i + 2*w + 1]*(i - 1))/(2*w) + 1], {2*w, 2*w}]] dum = Q[2] the problem is that...

defined? for recursive function call v/s defined? for function call stack
I have some confusion about recursive function calls and definition of variables in those functions. Consider these two code snippets for the variable "b". <PRE> # def_stack.rb def call1() print "call1()\n" b = "something" if defined? b print "defined? b is defined " + (defined? b).to_s + " with value " + b.to_s + "\n" else print "defined? b is not defined " + (defined? b).to_s + " with value " + b.to_s + "\n" end call2() end def call2() print "\n\ncall2()\n" if defined? b p...

Defining variable between function argument list and {}
Variables of a C function is usually defined inside the {} of the function. But I also see some variables being defined between the function argument list and {}, such like below. int unzip(in, out) int in, out; /* input and output file descriptors */ { ... } What's the purpose of defining the variables here? Thanks. On Nov 6, 7:36=A0pm, Kuhl <chen_zhi...@yahoo.com> wrote: > Variables of a C function is usually defined inside the {} of the > function. But I also see some variables being defined between the > function argument list and {}, such like below. > >...

Composite Type Argument Construction to a Function
create type my_type (my_test text, my_int integer); create function my_function(my_type) returns timestamp as 'begin return (current_timestamp); end; ' language 'plpgsql'; In 7.3.5, we are trying to get around the 32 argument limit of the functions WITHOUT re-compiling with a greater func_max_args (due to operational reasons). My question is - HOW do I construct the argument to my_function(my_type) so that the function recognises that I am passing into it composite data? NB: The example function is just "junque" to test passing a composite ty...

Defining a Function with an Indeterminate Number of Arguments
Hello - I am trying to define a function with the following two properties : (A) The function should be able to take an indeterminate number of arguments without using the List structure (like the Which or StringJoin functions in Mathematica). (B) The function should have the capability of defining and using options in the usual way (i.e. using the Options function outside the package definition to define the option default values and using OptionValue within the function definition to retrieve the options with locally defined option values overriding the default values). ...

using function arguments in other arguments
Can I use a function argument as an array limit in a another argument ? Such as: int myFunction (int ncp, double myArray [ncp] [2]); and int myFunction (int * ncp, double myArray [*ncp] [2]); Thanks, Lynn On Wed, 10 Sep 2008 15:26:23 -0500, Lynn McGuire wrote: > Can I use a function argument as an array limit in a another argument ? > Such as: > > int myFunction (int ncp, double myArray [ncp] [2]); > > and > > int myFunction (int * ncp, double myArray [*ncp] [2]); > > Thanks, > Lynn This is the way you pass arrays to a function, passing the name of...

undefined input argument of a user defined function
i'm using the following code to create a function:: function [z]=maxtheta(A0,A1,h) m=size(A0); n=size(h); t1=0; for j=1:n(2); t2=t1+h(j); for i=1:m(1); a0=A0(i,j); a1=A1(i,j); z=feval(maxii,a0,a1,t1,t2); end t1=t1+t2; end end where maxii is a function created by me and works fine with numerical values...now maxtheta suppose to take A0,A1,h as matrix inputs...but after defining A0,A1,h in command line when i am trying to run this function this is giving error message :: input argument h is not defined, input argument a0(not A...

Functions as arguments, but with some fixed arguments in them
Hi, Say I have a function: function [v,w]=f(x,y) v=x * y; w=x / y; return; and I want to call it from another function which would take f as an argument: function: function t(f,x) [v,w]=f(x) return and call this from the main program: t(inline('f(10,x)'),3) MATLAB reports an error: ~~~~ ??? Error using ==> inline.subsref Too many output arguments. Error in ==> t at 3 [v,w]=f(x) ~~~~ While there is no error if function t is changed to: function t(f,x) v=f(x) return in which case t(inline('f(10,x)'),3) outputs 30, as it should. How can I change my code in order to ...

Excel.WorksheetFunction Argument in User-Defined Function
I'd like to use the Excel.WorksheetFunction library to compute median and percentiles in a user-defined function. Rather than creating a SQL dataset in the function, I'd like to use the data from the calling report as the function argument. Example: The report's Record Source is a query that fetches salaries from a database, "SELECT JobID, JobTitle, BaseSalary ORDER BY JobTitle". The report groups BaseSalary by JobTitle. I have a textbox with Control Source of "=Avg([BaseSalary])" I have another textbox with Control Source of "=Perc25([BaseSalary])"...