On Fri, Oct 30, 2020 at 09:31:00AM +0000, Neven Sajko wrote:
> Hello,
>
> I've stumbled on a seeming inconsistency while using Fricas and I'm
> writing to the mailing list in hopes of getting more understanding of
> the issue, or just reporting a bug if the issue is a bug.
>
> Consider the following Fricas session:
>
> (1) -> x : DirectProduct(2, Float) := (2,3)
>
> (1) [2.0, 3.0]
> Type: DirectProduct(2,Float)
> (2) -> [[(x.j)^i for j in 1..2] for i in 0..1]
>
> (2) [[1.0, 1.0], [2.0, 3.0]]
> Type: List(List(Float))
> (3) -> [[(x.j)^i for j in 1..2] for i in 0..1]@SquareMatrix(2, Float)
>
> Cannot convert the value from type List(Float) to Float .
>
> (3) -> [[1.0, 1.0], [2.0, 3.0]]@SquareMatrix(2, Float)
>
> +1.0 1.0+
> (3) | |
> +2.0 3.0+
> Type: SquareMatrix(2,Float)
> (4) -> [[(x.j)^i for j in 1..2] for i in 0..1]::SquareMatrix(2, Float)
>
> +1.0 1.0+
> (4) | |
> +2.0 3.0+
> Type: SquareMatrix(2,Float)
> (5) -> v : SquareMatrix(2, Float) := [[(x.j)^i for j in 1..2] for i in 0..1]
>
> Cannot convert the value from type List(Float) to Float .
>
> (5) -> v : SquareMatrix(2, Float) :=
> matrix [[(x.j)^i for j in 1..2] for i in 0..1]
>
> +1.0 1.0+
> (5) | |
> +2.0 3.0+
> Type: SquareMatrix(2,Float)
>
> Why is it that the list collection can't be automatically converted to
> a matrix, if an equivalent list of lists (written directly) can?
As Ralf wrote, general rules require using 'matrix'. There was
special case code to allow (2) above, but it missed case of
collection. I have now added missing part so that (3) and
(5) above work. (4) is different special case.
Note: special case handling is in "interpreter" and does
not apply to Spad compiler.
--
Waldek Hebisch
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/fricas-devel/20201115115312.GC14515%40math.uni.wroc.pl.