augment() and stack()

augment() and stack() - Сообщения

#1 Опубликовано: 13 лет назад
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2 052 понравились и 1 не понравились пользователям.

Группа: 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 13 лет назад
#2 Опубликовано: 13 лет назад
Andrey Ivashov

Andrey Ivashov

2 277 сообщений из 3 778 понравились пользователям.

Группа: 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 13 лет назад, Radovan Omorjan 13 лет назад
#3 Опубликовано: 13 лет назад
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2 052 понравились и 1 не понравились пользователям.

Группа: 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 Опубликовано: 13 лет назад
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2 052 понравились и 1 не понравились пользователям.

Группа: 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 Опубликовано: 13 лет назад
Andrey Ivashov

Andrey Ivashov

2 277 сообщений из 3 778 понравились пользователям.

Группа: 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 13 лет назад
#6 Опубликовано: 13 лет назад
Radovan Omorjan

Radovan Omorjan

325 сообщений из 2 052 понравились и 1 не понравились пользователям.

Группа: 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!"
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений