Array position - another approach

Array position - another approach - Сообщения

#1 Опубликовано: 07.09.2023 12:34:24
NDTM Amarasekera

NDTM Amarasekera

130 сообщений из 352 понравились пользователям.

Группа: User

Hi,
I remember there were some useful posts to find the positions in an array
satisfying defined conditions.

Another approach is attached.

Array_Pos2.sm (15 КиБ) скачан 83 раз(а).

Array_Pos2.png
Look within!... The secret is inside you. Best Regards Eng. NDTM Amarasekera - Sri Lanka
5 пользователям понравился этот пост
Oscar Campo 07.09.2023 16:57:00, oscar mauricio 07.04.2024 10:46:00, francesco rapuano 08.01.2025 23:06:00, sergio 07.09.2023 12:38:00, Alvaro Diaz Falconi 08.09.2023 15:06:00
#2 Опубликовано: 08.09.2023 14:59:13
Arie

Arie

93 сообщений из 285 понравились пользователям.

Группа: User

To expand on this concept further, I generally avoid using augment/stack functions with vectors of indeterminate size. The reason being that there is generally quite a bit of overhead in using those functions when it comes to execution time. I propose an alternative method shown here. Firstly we perform the test on the input matrix to determine the size of the result vector and location of results in input matrix. Then we instantiate the result vector and fill it in. To demonstrate the difference in execution I've also created a 100x100 input vector and timed the execution of both algorithms. The execution time difference becomes more apparent the larger the input matrix becomes.

Показать спойлер




Array_Pos2.pdf (137 КиБ) скачан 67 раз(а).
Array_Pos2.sm (44 КиБ) скачан 87 раз(а).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
4 пользователям понравился этот пост
francesco rapuano 08.01.2025 23:08:00, Alvaro Diaz Falconi 08.09.2023 15:07:00, NDTM Amarasekera 08.09.2023 16:37:00, sergio 09.09.2023 05:57:00
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений