Matrix inside a matrix

Matrix inside a matrix - Сообщения

#1 Опубликовано: 23.11.2021 14:33:01
PedS

PedS

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

Группа: User

Hi everyone

I am trying to create a matrix inside a matrix using a for loop.
This is what I did:

Matrix inside a matrix.sm (12 КиБ) скачан 31 раз(а).
Matrix inside a matrix.png

This works but my real data is much larger than the one in this example and it takes like 10 minutes to run. Is there a more efficient way to do this?

Thanks.
#2 Опубликовано: 23.11.2021 15:35:19
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

This works but my real data is much larger than the one in this example and it takes like 10 minutes to run. Is there a more efficient way to do this?


Your example runs in 0.5 s [Steam Engine Win 7]

Matrix inside a matrix.sm (12 КиБ) скачан 32 раз(а).

#3 Опубликовано: 23.11.2021 17:51:39
Arie

Arie

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

Группа: User

Two things. One move the assignment of p[k to under the k for loop. You're reassigning to p too often. Also, for large datasets, it helps to initialize the size of the matrix rather than just increasing the size over each iteration. See attaached. Matrix inside a matrix_lyles.sm (15 КиБ) скачан 32 раз(а).
Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
1 пользователям понравился этот пост
sergio 24.11.2021 06:03:00
#4 Опубликовано: 23.11.2021 18:06:24
Alvaro Diaz Falconi

Alvaro Diaz Falconi

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

Группа: User

Hola Pedro. Please check this version and tell us how long it takes with your data.

Matrix inside a matrix.sm (31 КиБ) скачан 36 раз(а).

Best regards.
Alvaro.
1 пользователям понравился этот пост
sergio 24.11.2021 06:03:00
#5 Опубликовано: 23.11.2021 18:54:21
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Two things.


On my Win 7 ... takes 4 times my original SS 6179 doctored version.
Has it dependence with Smath version ?
Cheers ... Jean.

#6 Опубликовано: 23.11.2021 19:00:08
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Hola Pedro. Please check this version and tell us how long it takes with your data.


Timing is about twice my doctored version.
#7 Опубликовано: 23.11.2021 19:20:04
PedS

PedS

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

Группа: User

Wrote

Two things. One move the assignment of p[k to under the k for loop. You're reassigning to p too often. Also, for large datasets, it helps to initialize the size of the matrix rather than just increasing the size over each iteration. See attaached. Matrix inside a matrix_lyles.sm (15 КиБ) скачан 32 раз(а).



Thanks a lot, this works perfectly
#8 Опубликовано: 23.11.2021 19:21:22
PedS

PedS

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

Группа: User

Wrote

Hola Pedro. Please check this version and tell us how long it takes with your data.

Matrix inside a matrix.sm (31 КиБ) скачан 36 раз(а).

Best regards.
Alvaro.



Gracias, aprecio tu ayuda
#9 Опубликовано: 23.11.2021 21:51:43
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

Your example runs in 0.5 s [Steam Engine Win 7]


... annotated attachment ...Cheers ... Jean

Matrix inside a matrix (Proposal).sm (31 КиБ) скачан 40 раз(а).
#10 Опубликовано: 25.11.2021 09:15:52
Jean Giraud

Jean Giraud

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

Группа: User

Wrote

This works but my real data is much larger than the one in this example and it takes like 10 minutes to run. Is there a more efficient way to do this?


1. Wait and see your next Monster Big.
2. 10 min on your machine might take 1 hr on mine, but willing.
3. Maybe not not so big and interpolate ?
See you sometimes, Cheers ... Jean

  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений