Open VikingScientist opened 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)
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?
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)
@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.
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?
I don't think we've fixed all of them, but I'm not sure which ones are done and not.
There are a number of simple functions which I would like to see added support for
A = a * B
scalar-matrix multiplicationA = B * a
matrix-scalar multiplicationb = a * c
scalar-vector multiplicationb = c * a
vector-scalar multiplicationdet(A : matrix[2,2](float) )
2x2 determinantdet(A : matrix[4,4](float) )
4x4 determinantinv(A : matrix[2,2](float) )
2x2 inverseinv(A : matrix[4,4](float) )
4x4 inverseeye(n : int) -> matrix[n,n](float)
returns identity matrixmin(vector[V](float)) -> float
returns minimum valuemax(vector[V](float)) -> float
returns maximum valueabs(float) -> float
returns absolute valueabs(int) -> int
returns absolute valueabs(vector[V](float)) -> vector[V](float)
returns absolute valueabs(vector[V](int)) -> vector[V](int)
returns absolute valuecbrt(float) -> float
returns cube rootsize(Set) -> int
returns size of set