Skip to content

Use MATLAB dictionary for efficiency#100

Draft
MichaelTiemann wants to merge 1 commit into
vfitoolkit:masterfrom
MichaelTiemann:ParamDict
Draft

Use MATLAB dictionary for efficiency#100
MichaelTiemann wants to merge 1 commit into
vfitoolkit:masterfrom
MichaelTiemann:ParamDict

Conversation

@MichaelTiemann

Copy link
Copy Markdown
Contributor

Replace a naive for-loop (n^2 searches for each parameter, so n^3 worst case) with a dictionary (n log n searches to construct and satisfy). Also, prepare parameter columns for processing on GPU.

Replace a naive for-loop (n^2 searches for each parameter, so n^3 worst case) with a dictionary (n log n searches to construct and satisfy).  Also, prepare parameter columns for processing on GPU.
@MichaelTiemann

Copy link
Copy Markdown
Contributor Author

Claude Code could apply this pattern in many instances.

@robertdkirkby

Copy link
Copy Markdown
Contributor

looks cool, I will have to read up on what dictionary() does :)

@MichaelTiemann

Copy link
Copy Markdown
Contributor Author

On second thought, it occurred to me there is a more elegant way to solve this (and related): to use try/catch to simply index into Parameters as needed to get the size/contents of parameters as needed. I'll rework this to demonstrate. The solution initially presented has two O(nlog(n)) terms (which add to O(nlog(n))). The more elegant solution uses the dictionary of Parameters itself, thus omitting the larger of the two O(n*log(n)) operations.

@MichaelTiemann MichaelTiemann marked this pull request as draft May 23, 2026 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants