MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: export an array of variable depth

  • To: mathgroup at
  • Subject: [mg83651] Re: export an array of variable depth
  • From: Jens-Peer Kuska <kuska at>
  • Date: Tue, 27 Nov 2007 06:13:57 -0500 (EST)
  • References: <fibf83$5eo$>


and write a pure Mathematica function, that check the arguments
and send it to the C-Function is not a option, i.e.,

Sample[lst_] /; And@@ (NumericQ /@ Flatten[lst]):=
    rawCSample[Length /@ lst,Flatten[lst]]

But I'm not sure what you mean with "depth" .. because
in Mathematica a "lists of lists (array) of Real values"
has always the Depth[] == 2

If you just need the pattern of a List of list with reals
{{__Real}..} should do that


Chris wrote:
> Dear all,
> We're having quite a similiar problem to a post that was made last
> june:
> We want to send a multidimensional array from Mathematica to a
> C-Programm (over Mathlink) that uses this data as input. At the moment
> we're
> struggling with the "Pattern:"-command in the template file.
> Since we're passing lists of lists (array) of Real values to our
> programm but don't know the depth of this list in advance (the actual
> user enters the depth), this forms
> our problem. How is it possible to write such a 'Pattern:...' ?
> Any insights on that one?
> Our .tm-file for only 2 'inner lists' looks as follows:
> ********************
> // tm-file
> :Begin:
> :Function:      Sample
> // how can we make this more dynamic? We want to be able to determine
> the number of inner lists ourselves, maybe with an additional
> parameter?
> :Pattern:       Sample[list:{one:{___Real},two:{___Real}}]
> :Arguments:     {list}
> :ArgumentTypes: {Manual}
> :ReturnType:    Manual
> :End:
> ********************
> This acutally works but doesn't let us leave with much of flexibility.
> Does anyone have a solution to this one?
> Any help is greatly appreciated!
> Regards,
> Chris

  • Prev by Date: Re: Mathematica 6 Automated Compatibility Tools
  • Next by Date: Re: FindInstance puzzler
  • Previous by thread: export an array of variable depth
  • Next by thread: FindInstance puzzler