augment() and stack()

augment() and stack() - Messages

#1 Posted: 4/14/2012 2:09:43 PM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Andrey,

I wonder if the augment() and stack() could be made to receive a scalar argument in the case of merging vectors and scalars. This is not working at the moment *Array dimensions do not match*:

[MATH=eng]c:mat(x,y,z,1,3)[/MATH]
[MATH=eng]augment(a,b,c)=#@#[/MATH]
[MATH=eng]stack(a,b,transpose(c))=#@#[/MATH]

But this will:

[MATH=eng]c:mat(x,y,z,1,3)[/MATH] [MATH=eng]a:mat(a,1,1)[/MATH] [MATH=eng]b:mat(b,1,1)[/MATH]
[MATH=eng]augment(a,b,c)=mat(a,b,x,y,z,1,5)[/MATH]
[MATH=eng]stack(a,b,transpose(c))=mat(a,b,x,y,z,5,1)[/MATH]

We had to make "a" and "b" variables as single element vectors. It seems to me a bit redundant. Andrey, could you make that augment() and stack() could have scalars as their arguments as well, in the cases of merging row or column matrices (vectors)?

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
1 users liked this post
Davide Carpi 6/16/2012 4:37:00 PM
#2 Posted: 6/17/2012 6:21:45 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3734 posts.

Group: Super Administrator

Hello Radovan.

I've checked what could be done with stack/augment to fix issues you are mentioned and I've made corrections to your approach: symbolic engine will not either evaluate augment/stack functions or raise an exception if dimensions of the arguments don't match. It will pass these functions to allow numeric engine make a final decision about what is error and what is not.

Please see Use case section of the screenshot below for understanding the reasons.
stackAugment.png
2 users liked this post
Davide Carpi 6/17/2012 6:25:00 AM, Radovan Omorjan 6/17/2012 7:35:00 AM
#3 Posted: 6/17/2012 7:39:58 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Thank you Andrey for this fix

Loking forward to the next release

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Posted: 6/17/2012 10:10:19 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Hello Andrey,

SMath 0.95 was just released and I must be annoying about this issue. Therefore, I appologize

Just wondering why this could not be possible in v0.95. Why the first element could not be a scalar - it must be a vector.

[MATH=eng]augment(1,mat(2,3,4,1,3))=#@#[/MATH]

[MATH=eng]stack(1,mat(2,3,4,3,1))=#@#[/MATH]

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#5 Posted: 6/17/2012 10:29:19 AM
Andrey Ivashov

Andrey Ivashov

2269 likes in 3734 posts.

Group: Super Administrator

Ahh yes. The separate logic for this case presented in the program... It's my fault. Will be fixed in the next release.
1 users liked this post
Davide Carpi 6/17/2012 12:47:00 PM
#6 Posted: 6/17/2012 10:40:01 AM
Radovan Omorjan

Radovan Omorjan

325 likes in 2052 posts.

Group: Moderator

Thank you Andrey ,

BTW, in v0.95 this is possible: stack() and augment() with all scalars - very good


[MATH=eng]augment(1,2,3)=mat(1,2,3,1,3)[/MATH]

[MATH=eng]stack(1,2,3)=mat(1,2,3,3,1)[/MATH]

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
  • New Posts New Posts
  • No New Posts No New Posts