These are chat archives for symengine/symengine

25th
Nov 2016
Siddharth
@bollu
Nov 25 2016 11:59
is there a way to get well-rendered strings representing vectors, matrices, etc?
the way numpy renders arrays
(If symengine supports such a thing, then it would be nice to display in a REPL-like context)
I want to implement the equivalent of str in haskell
__str__
for CVecBasic, CDenseMatrix, CSparseMatrix
ah, I found dense_matrix_str and spare_matrix_str
what about the other types? Set, Vec, etc.?
Isuru Fernando
@isuruf
Nov 25 2016 12:01
dense_matrix_str
Siddharth
@bollu
Nov 25 2016 12:01
right, and the other types? :)
Isuru Fernando
@isuruf
Nov 25 2016 12:02
In other language bindings, sets and vecs were converted to types native to that languages?
Siddharth
@bollu
Nov 25 2016 12:03
ah, hm, you want me to do that?
but, for example, dense_matrix_diag uses a CVecBasic as a parameter
so, I would have to convert a haskell list to a CVecBasic and then pass it along?
Isuru Fernando
@isuruf
Nov 25 2016 12:03
yes
Siddharth
@bollu
Nov 25 2016 12:04
I was considering just exposing the CVecBasic functions. I wasn't aware of the design decision
thanks
so, the things that I am expected to show the end-user is BasicSym, DenseMatrix, SpareMatrix, etc?
Isuru Fernando
@isuruf
Nov 25 2016 12:04
You should do what's best for the language binding
Siddharth
@bollu
Nov 25 2016 12:04
right, makes sense :)
thanks
I'll change my code
Siddharth
@bollu
Nov 25 2016 13:09
quick question: since we used SYMENGINE_ASSERT it disables, say, bounds checking in release build

but I would like to ensure (since this is Haskell's philosophy as well) that it doesn't crash, but instead throws the exception. Is there anyway to ensure this?

I guess the question is, is it possible to force asserts to raise exceptions even when the library is build in Release mode? I don't think this is/should be possible, but it would be nice to know

Abhishek Karn
@blaze-nitd
Nov 25 2016 13:10
Someone please help me by answering my question
Isuru Fernando
@isuruf
Nov 25 2016 13:11
yes, you should do bounds checking in haskell as well. For python we do it in python for things like arr[-1] which is transformed into arr[size-1] before sending it to C
cmake -DWITH_SYMENGINE_ASSERT=yes should do it
Siddharth
@bollu
Nov 25 2016 13:11
@blaze-nitd I'm no expert at SymEngine, but I'd say look for the issues with the "Easy to Fix" tag. Example issues
I see. So you want me to do it in both places? interesting
@blaze-nitd then come back with specific questions about the issue you're solving. That way, you can recieve help
@isuruf so that will mean that every such sanity check will be replicated in both platforms?
Abhishek Karn
@blaze-nitd
Nov 25 2016 13:12
Thank you @bollu ..:)
Isuru Fernando
@isuruf
Nov 25 2016 13:13
In release mode it won't be checked. In debug mode it will be so that when something breaks, you should be able to find it out
Siddharth
@bollu
Nov 25 2016 13:13
@isuruf yes. So this will depend on the user to recompile their library in debug mode, bummer
@isuruf what I can maybe to is to encode this information at the type level
Isuru Fernando
@isuruf
Nov 25 2016 13:14
Not really, since you do checks in the language bindings
Siddharth
@bollu
Nov 25 2016 13:14
@isuruf true, I guess. So, again, just to clarify, I check at both the haskell level, and symengine checks this for its own sanity, correct?
Isuru Fernando
@isuruf
Nov 25 2016 13:14
only the developer has to do it.
correct. if haskell usually throws an exception for arr[-1] throw a haskell exception.
if it returns arr[size-1], use that
Siddharth
@bollu
Nov 25 2016 13:16
right. no, negative indices are wrong
Isuru Fernando
@isuruf
Nov 25 2016 13:17
right, then. throw an exception in that case.
Siddharth
@bollu
Nov 25 2016 13:17
thanks