simit-lang / simit

A language for computing on sparse systems
http://simit-lang.org
Other
454 stars 52 forks source link

Feature requests (simple operations & functions) #43

Open VikingScientist opened 8 years ago

VikingScientist commented 8 years ago

There are a number of simple functions which I would like to see added support for

stephenchouca commented 8 years ago

Thanks for the suggestions! Multiplication of a scalar by a matrix or vector (and vice versa) is actually already supported; the website should be updated to reflect that. I can look into implementing the other intrinsics you have suggested.eye as you have proposed probably can't be incorporated into Simit since the type of the return value would not be inferable at compile-time, but something like this can probably be implemented instead:

eye<0:N>() -> matrix[N,N](float)
fredrikbk commented 8 years ago

I thought about eye in the past and was playing with the idea of reserving I as a keyword. Is this too extreme?

In many cases it seems that we can infer it. If I use it in an expression A = I*b, why do I have to declare it, since I know it from the context? Specifically, I know it as long as the index variables used to index it are also used to index any known dimension. @stephenchouca will this be too tricky to infer?

VikingScientist commented 8 years ago

The keyword I might be confused with both general running index i and complex numbers i. If you continue with the mission statement of designing a "matlab-like" language, I think it would be in your best interest to use syntax as close to matlab as possible, and matlab is using eye().

By the way, if you manage to get the identity matrix working for arbitrary sizes and map the solver operator successfully mapped to LU solvers (issue #50), then you can make an arbitrary size inverse function by returning A_inv = A \ eye(n)

stephenchouca commented 8 years ago

@fredrikbk Adding support for a reserved I identity matrix should be feasible though it would probably require a non-trivial amount of changes to the type checker, since the compiler currently only supports inferring an expression's type from the types of its subexpressions and not the other way around. One potential practical concern is that, depending on what the precise semantics are, having arbitrary-sized identity matrices can potentially complicate specialization of generic functions if a generic function is called with an identity matrix (of unknown size) as a parameter.

VikingScientist commented 6 years ago

I was playing around with simit again and from what I can tell it seems like these have been fixed since 2016.

Am I right to assume that all of them have been fixed? Is this issue ready to closed?

fredrikbk commented 6 years ago

I don't think we've fixed all of them, but I'm not sure which ones are done and not.