Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UMAP: Remove mutable #228

Merged
merged 2 commits into from
Feb 26, 2023
Merged

UMAP: Remove mutable #228

merged 2 commits into from
Feb 26, 2023

Conversation

weefuzzy
Copy link
Member

UMAP::mEmbedding had been marked mutable in order to avoid some code duplication. mutable shouldn't be used in the absence of an accompanying lock if the principle of least astonishment is to be honoured in a multi-threaded situation.

The problem for the original author was that a long and complex function optimizeLayout needs to be called both in mutating and non-mutating circumstances, and buried within nested loops is an optional update of this variable. In order for the function to be callable in a const case, it needed to be marked const, but also needed to be able to update mEmbedding during training. It's certainly an amount / complexity of code that one doesn't want to duplicate.

Without more involved refactoring, I think the best we can do here is to:

  • hoist the function out of the class as a function template taking the reference embedding as a template parameter (so it can be const or not).
  • use a compile time check on the const-ness of the reference embedding to enable / disable the option to update.
  • provide more clearly labelled and properly const (or not) member functions that delegate to the full implementation (optimizeLayout and optimizeLayoutAndUpdate).

fixes #224

@weefuzzy weefuzzy added the enhancement New feature or request label Feb 23, 2023
@tremblap tremblap self-requested a review February 26, 2023 16:35
Copy link
Member

@tremblap tremblap left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applied over PR #227 and it works on all 3 OSes on SC

@tremblap tremblap merged commit 78a10b6 into flucoma:main Feb 26, 2023
fearn-e pushed a commit to fearn-e/flucoma-core that referenced this pull request Aug 15, 2023
* prepare help file

* shell out tabs

* mlpregressor translation
fearn-e pushed a commit to fearn-e/flucoma-core that referenced this pull request Aug 15, 2023
* optional args: add to wrapper

* MaxWrapper: Add choices param (list of symbols <-> bitset)

* changing preset and interface for noveltyslice examples

* correct typos and misconnections in helpfiles (onsetslice and bufselectevery)

* Buf2List(2Buf): Correct atom type

Fixes MSVC debug builds

* kdtreehelp: now loads programatically, in order, from the stored labelset (flucoma#184)

* now loads programatically, in order, from the stored labelset

* corrected a view

* also, fluid.umap helpfile now uses the loader

* fix flucoma#185 

`ControlIn` objects
– properly adjust `ac` when adjusting `av` 
– ensure mListSize is always intialized to something 
– fix resize logic

* Enhance/max params (flucoma#182)

* CMake: Centralise C++ version and set to 17

* Wrapper: Handle new LongRuntimeMax parameter type

* POC for better buffer object chaining (flucoma#140)

* start of POC for buffer management stuff, needs fix to ParamDesc NumOf in core

* working POC for managing internal output buffers and process chaining 

relies on some pending updates to core

* Don't override box arguments with default buffers

* NRT: One outlet per output buffer, no progress outlet, draw progress on box

* Messages: Default instances for output container args

* updates to message default instances that don't break all other objects

* Add optional range arguments to buffer message in left inlet

* Stop MSVC being sad

* Wrapper: fix merge casuality

* [Fix] Broken patches due to new dataset/buffer interface interface (flucoma#195)

* update dataset

* fix broken cabling in datasetquery

* update kmeans

* make more max-like in style

* "maxify" the style

* fix connections and maxify style of labelset~

* fix connections in umap and maxify

* fix connections and mafixy fluid.grid~

* update kdtree~ help with fixed cables and max style

* fix connections and maxify style of normalize

* cosmetic upgrades

* update fluid.plotter cables

* fix bufstats due to tb

* [Fix] Missing OnsetSlice Files (flucoma#197)

* restore to previous state

* fix some style errors

* fix style issues

* Wrapper: Update for new `maxFFTSize`

* [Docs] BufCompose Help File (flucoma#155)

* griddify patch tab s

* update first tab

* second tab

* macros

* subsections tab

* small cosmetic changes

* update final tabs of help file

* make tab 2 playable

* clean tab 3

* cosmetic

* PAs addendums

* Wrapper: Fix reset for shared objects. fixes flucoma#43 

Will 'reset' to whatever was in the box that the message was called on, 
so potential for confusion...

* Wrapper: Fix managed object aliasing in message invocations. fixes flucoma#190

* List2Buf: Correct outlet type. fixes flucoma#196

* [Docs] BufSpectralShape Help File (flucoma#156)

* grid it out

* bufspectralshape help file

* add a layout of results tab

* add @select tab and final changes

* translate SC -> Max (flucoma#187)

* Wrapper: call params::set() properly for long array attrs 

To ensure that client objects  like attrui update properly in shared 
instances

* touch up ampslice example with Rod's audio

* prepare help file

* shell out the tabs

* ampslice updates

* Wrapper: Use raw value for maxFFT when refreshing attribute

* [Help] Pitch and BufPitch SC Translations (flucoma#200)

* layout

* cleanup and translate

* update bufpitch to match sc

* fix various errors in help files (flucoma#204)

* [Docs] NoveltySlice Help Files (flucoma#146)

* update noveltyslice

* shell out bufnovelty

* small cosmetic updates

* small layout issues

* update bufnoveltyslice to be similar to RT algo

* cosmetic

* tune parameters for second tab

* add a progression for tweaking parameters

* [Fix] Saner maximum sizes for modulatable examples (flucoma#205)

* add bigger maximums for noveltyslice for modulation fun

* set a bigger maximum kernelsize for realtime playing

* maximum parameter tweaks

* [Fix] Various Bug Fixes From PA (flucoma#210)

* fix bufcompose

* fix bufampslice playback

* change from groove to play

* corrected players of 2nd tabs fixing flucoma#202

* Wrapper: Trying once again to get maxParams logic correct

* neaten and provide an example (flucoma#216)

perfect thanks!

* [Docs] HPSS and BufHPSS translation (flucoma#219)

* prepare help files with grid/fonts

* cleanup help file layout

* cleanup help files

* update remaining tabs for hpss

* [Docs] MFCC and BufMFCC Translation (flucoma#217)

* update rt mfcc

* update bufmfcc to match translation better

* PAs review

* [Docs] MelBands + BufMelBands Translation (flucoma#214)

* translate rt version

* add ioscbank and size $1

* translate bufmelbands

* fix loadbang mistake

* [Docs] BufFlatten Translation (flucoma#218)

* update bufflatten

* normalise fonts and grid size

* cosmetic movements

* change language around buffer management

* [Docs] Update fluid.list2buf (flucoma#188)

* update list2buf help file

* change language in resize tab

* resize destination buffers downwards

* list2buf - list typo

* bufmelbands - corrected loadbang issue

* bufmfcc - typo

* Enhance/generate stubs (flucoma#231)

* CMake: Generate .cpp files

* CMake: Ensure MSVC compiles commonsyms.c

Enable C as a language for project...

* Remove all old handwritten CMake and stubs

* CMake: Tidy up Max SDK setup

* CMake: ensure correct MSVC runtime by default

* CMake: Correct hints for Max SDK libs

* CMake: Asking once again to compile happily on two platforms

* CMake: install prefix is a cache variable

* CMake: Move install prefix override

* CMake reinstate target for triggering docs in ALL

* CMake: Tidy up

* CMake: typo

* Wrapper: FFT max set properly after initialization

* CI: Update nightly workflow

* CI: use correct branches

* CI: remove reference to docs job

* CMake: belatedly add branch selection for flucoma deps upon which CI relies

* Reinstate package-json generation

* [Docs] NMFFilter Translation (flucoma#222)

* translate nmffilter

* make ezdac local

* [Docs] BufStats translation (flucoma#220)

* prepare bufstats help file

* in progress

* full translation

* add a derivative tab

* cosmetics

* remove debug print

* [Docs] NMFMatch Translation (flucoma#221)

* prepare and grid

* work on compressor example

* work in compressor parameters

* finish translation

* alter compressor example to be less idiosyncratic with vector sizes

* [Docs] MLPClassifier Translation (flucoma#226)

* wip

* mlpclassifier translation

* add caveat about predicting whole dataset

* layout

* [Docs] BufNMF Translation (flucoma#229)

* grid and format

* WIP

* translation of nmf sc

* remove nooiseplay vocoder

* cleanup small errors

* make channel offset permanent

* vocoder pfft patch

* add back vocoder example with tweaks

* mds translation (flucoma#235)

* [Docs] RobustScaler SC Translation (flucoma#234)

* translate standardisation

* grid out

* translation

* add scaler visualisation back

* scaler comparison re-usable tab

* update with visualisation and comparison together

* [Docs] Standardise SC Translation (flucoma#233)

* translate standardisation

* grid out

* translation

* add scaler visualisation back

* scaler comparison re-usable tab

* update with visualisation and comparison together

* commit patch

* update title

* add scaler comparison

* [Docs] MLPRegressor Translation (flucoma#228)

* prepare help file

* shell out tabs

* mlpregressor translation

* [Fix] Plotter internal state management (flucoma#242)

* refactor code to be handle state in a more legible manner

* only output position on mousedown (not mouseup)

* instantiate fluid.plotter with no border

* dont reset domain/range state with clear

* fix help file

* CMake: Pick up new Client tag to control tildes in external names better

* updated nmf examples with new interface

* change @SiZe to @history (flucoma#243)

* [Enhance] Manual Documentation for CCE Objects (flucoma#250)

* install the contents of manual_docs to release-packaging docs

* add manual docs

* rename manual_docs to local_docs

* update CMake to respect new path name

* use more robust path for local docs

* add default arguments and buffer messages

* en-quote

* add max list size as argument

* provide use case for spectrogram

* caveat about manual interaction with slices

* update descriptions and digest

* return destination -> source

* [Fix] Various patcher bugs (flucoma#253)

* fix bufselect~

* blank out bufstats values in messages

* fix feature patches with new interface

* cosmetic fix on kmeans

* add feature objects to landing page

* [Docs] Stats SC Translation (flucoma#245)

* grid it out

* update first tab

* mimic Ted's real use case tab

* normalize hehe the normalize help file with other scalers (flucoma#246)

* [Docs] PCA SC Translation (flucoma#247)

* add whitening tab

* add stackexchange link

* [Docs] BufNNDSVD SC Translation  (flucoma#251)

* update nndsvd help file to match sc

* fix numchans error

* translation (flucoma#255)

* [Docs] STFT SC Translation (flucoma#248)

* prepare help file

* rework first tab

* in progress

* cleanup first tab

* musical stft example

* mild cleanup

* finish musical example

* change sound file examples

* translate knnregressor (flucoma#256)

* [Docs] NMFMorph SC Translation  (flucoma#258)

* start editing

* wip

* translate nmfmorph

* [Docs] BufNMFCross SC Translation (flucoma#254)

* prepare help file

* translation

* delete superfluous tab

* typo in bufnmf help

* [Fix] Various load issues  (flucoma#261)

* fix maxsize argument for bufaudiotransport

* fix broken patch cables in bufchroma

* fix loading error

* fix broken dataset cables

* fix maxsize

* maxsize

* cosmetic

* broken cables

* stats maxsize

* typo

* cosmetic

* small cosmeti fixes

* cosmetic touch ups

* always load even if loadbang is disabled

* non local ezdac (flucoma#262)

* change of interface (flucoma#260)

* typo

* skmeans translation from SC (missing one tab also missing in kmeans) (flucoma#264)

* [CI] Update Release Workflow (flucoma#266)

* cleanup nightly release

* normalise naming extensions

* update release

* Revert "normalise naming extensions"

This reverts commit 23985181a41d9521e3a335a2d739a7bcbb9a8c3f.

* update extension

* remove workflow dispatch variables

* [Docs] Transients Family Translation  (flucoma#259)

* translate transientslice

* translate buftransientslice

* fluid.transients~ translation

* cosmetic

* translate buftransients

* make mc example dual mono

* add zoom on content

* [Docs] AmpGate SC Translation (flucoma#241)

* grid help file

* translate ampgate

* cosmetic

* silence removal example

* neaten patch

* finish off lookahead/lookback prettification

* fix onset/offset conceptual break

* defer loading of tab 3

* cosmetic

* MaxWrapper: Ensure box is properly released from `progress` upon cancel

* [Docs] (S)Kmeans Distances Tab (flucoma#267)

* add distance tab

* add argument for choosing default dataaset

* add distances tab

* add distances tab

* cleanup

* beta testing patches updated for beta7 (flucoma#268)

* typo

* typo

* typo

* fix release worflow

* fix bad path

* fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove 'mutable' member from UMAP
2 participants