augment() and stack()

augment() and stack() - 消息

#1 已发布: 2012/4/14 14:09:43
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: 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位用户喜欢此帖子
Davide Carpi 2012/6/16 16:37:00
#2 已发布: 2012/6/17 06:21:45
Andrey Ivashov

Andrey Ivashov

2,344个赞,共4,057个帖子。

组: 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位用户喜欢此帖子
Davide Carpi 2012/6/17 06:25:00, Radovan Omorjan 2012/6/17 07:35:00
#3 已发布: 2012/6/17 07:39:58
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: 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 已发布: 2012/6/17 10:10:19
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: 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 已发布: 2012/6/17 10:29:19
Andrey Ivashov

Andrey Ivashov

2,344个赞,共4,057个帖子。

组: 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位用户喜欢此帖子
Davide Carpi 2012/6/17 12:47:00
#6 已发布: 2012/6/17 10:40:01
Radovan Omorjan

Radovan Omorjan

325个赞和1个踩,共2,052个帖子。

组: 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!"
  • 有新帖
  • 无新帖