Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed herehere : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see JokeurJokeur), clarifying what is possible and what is not, fully dissolves the doubt.

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, fully dissolves the doubt.

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, fully dissolves the doubt.

deleted 6 characters in body
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, essentiallyfully dissolves the doubt.

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, essentially dissolves the doubt.

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, fully dissolves the doubt.

added 252 characters in body
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, essentially dissolves the doubt.

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

In some case the Compile's syntax is quite straightforward. Es. for rank 1 e rank 2 tensors:

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 1}}
   , Total[x]
   ];

and

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}}
   , Inverse[x] (*Inverse isn't compileable: here is used merely as signpost*)

   ];

Or, even,

Quiet[Remove[cf]];
cf = Compile[
   {{x, _Real, 2}, {y, _Real, 2}}
   , Det[x] + Det[y] (*Det isn't compileable: here is used merely as signpost*)
   ];
cf[matrixA, matrixB]

But what if the arguments are intricated ? What is the syntax needed ?

A workaround to circumvent this question was proposed here : Not the most elegant but could you flatten and join and then "unflatten" and separate afterwards ?

Please, can you give examples for a function having as argument (all atomic expression are understood Real):

  • a matrix of lists
  • a matrix of matrices
  • a matrix whose element are {x_Real , a matrix }
  • a matrix whose element are {x_List , a matrix }
  • etc.

Addendum

This question has been put on hold, but in IMHO the answer given below (see Jokeur), clarifying what is possible and what is not, essentially dissolves the doubt.

added 14 characters in body
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading
added 122 characters in body
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading
Post Closed as "Needs more focus" by m_goldberg, MarcoB, dr.blochwave, RunnyKine, user9660
edited title
Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading
edited to make the subject narrower
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading
deleted 76 characters in body
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading
Source Link
mitochondrial
  • 1.8k
  • 10
  • 16
Loading