On Mon, Aug 4, 2014 at 5:44 PM, Tim Lahey <tim.la...@gmail.com> wrote:
> I've answered your questions below.
>
> On 4 Aug 2014, at 18:27, James Crist wrote:
>
>>
>> *1. Sympy Matrices are always 2 dimensional, should this be true of the
>> generated code as well?*
>>
>
> I think the generated code should reflect the original object. So, if
it's a
> SymPy 2D Matrix, the generated code should be a 2D Matrix as well.
Changing
> the dimensionality can always be done on the generated matrix as needed,
but
> should only be done with the knowledge of the user.
>
>>
>>
>> *2. Should the default be numpy arrays?*
>>
>
> I can't see any reason why not. It's the most general choice.
>
>>
>> *3. For inputting matrices to functions, `MatrixSymbol`, or
>> `DeferredVector`?*
>>
>>
>
> I think going with MatrixSymbol is fine for now. If we need to add support
> for DeferredVector, that can be added.

I would stick with MatrixSymbol. It's the most supported. Although note
that you may run into some issues because of
https://github.com/sympy/sympy/issues/6249.

>>> x = MatrixSymbol('x', 3, 1) #Acts as a vector
> >>> expr = x[1,1] + sin(x[2,1]) + cos(x[3,1])
> >>> func = autowrap(expr)
> >>> inp = np.array([1, 2, 3])
> >>> func(inp)
> 0.9193049302252362


Do you mean it should be func(*inp)?


>
>>
>> *4. What is an Indexed type for?*
>
>
> They're for representing tensors. Of course, the can be used for a number
of
> things, including calculating finite difference formulas. In my case,
> tensors are useful for stress analysis, especially in changing reference
> frames. Other uses I know about relate to various physics topics.

I'm not sure if I agree with that. The module is called tensor, but that's
very misleading. For example, there are no upper or lower indices.  The new
tensor module being worked on by FB and Mario is more what I would think of
as tensors.

To me, Indexed is just an object used to represent an indexed array, so
that it is possible to write in SymPy something that gets translated
directly into array code in C or Fortran.  With that being said, it has
also been used (with differing success) for other purposes. For example,
sometimes people will want to write a summation with something like a_i,
where i is the summation index, and they will use Indexed.

>
> I think there's some current work on the Indexed code, so refactoring it
at
> the moment isn't a good idea.
>
>> *5. Would a ctypes CodeWrapper be wanted?* (Not relevant immediately, but
>> I'm curious)

That would be pretty neat, especially if it is relatively performant.

Aaron Meurer

>
>
> I think it's a good idea in general, but not really a high priority. As
> something in the future, sure.
>
> Cheers,
>
> Tim.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+unsubscr...@googlegroups.com.
> To post to this group, send email to sympy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sympy/81745787-F497-499A-830D-447CEBBE3776%40gmail.com
.
>
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/CAKgW%3D6LDfBHVY3U6AOc5zsSb1U-hdbxsR1ukk8nqFP%2BrK811yQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to