From a789355e25d461c89da67660a9356a5e9c8ca89a Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 19 Nov 2024 23:20:05 +0000 Subject: [PATCH] build based on d69ec01 --- dev/.documenter-siteinfo.json | 2 +- dev/assets/documenter.js | 302 ++++++++++++++++++---------------- dev/index.html | 6 +- 3 files changed, 164 insertions(+), 146 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 75390a7..2ef8438 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.10.5","generation_timestamp":"2024-09-18T08:15:40","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-19T23:20:02","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index 82252a1..7d68cd8 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -612,176 +612,194 @@ function worker_function(documenterSearchIndex, documenterBaseURL, filters) { }; } -// `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! -const filters = [ - ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), -]; -const worker_str = - "(" + - worker_function.toString() + - ")(" + - JSON.stringify(documenterSearchIndex["docs"]) + - "," + - JSON.stringify(documenterBaseURL) + - "," + - JSON.stringify(filters) + - ")"; -const worker_blob = new Blob([worker_str], { type: "text/javascript" }); -const worker = new Worker(URL.createObjectURL(worker_blob)); - /////// SEARCH MAIN /////// -// Whether the worker is currently handling a search. This is a boolean -// as the worker only ever handles 1 or 0 searches at a time. -var worker_is_running = false; - -// The last search text that was sent to the worker. This is used to determine -// if the worker should be launched again when it reports back results. -var last_search_text = ""; - -// The results of the last search. This, in combination with the state of the filters -// in the DOM, is used compute the results to display on calls to update_search. -var unfiltered_results = []; - -// Which filter is currently selected -var selected_filter = ""; - -$(document).on("input", ".documenter-search-input", function (event) { - if (!worker_is_running) { - launch_search(); - } -}); - -function launch_search() { - worker_is_running = true; - last_search_text = $(".documenter-search-input").val(); - worker.postMessage(last_search_text); -} - -worker.onmessage = function (e) { - if (last_search_text !== $(".documenter-search-input").val()) { - launch_search(); - } else { - worker_is_running = false; - } - - unfiltered_results = e.data; - update_search(); -}; +function runSearchMainCode() { + // `worker = Threads.@spawn worker_function(documenterSearchIndex)`, but in JavaScript! + const filters = [ + ...new Set(documenterSearchIndex["docs"].map((x) => x.category)), + ]; + const worker_str = + "(" + + worker_function.toString() + + ")(" + + JSON.stringify(documenterSearchIndex["docs"]) + + "," + + JSON.stringify(documenterBaseURL) + + "," + + JSON.stringify(filters) + + ")"; + const worker_blob = new Blob([worker_str], { type: "text/javascript" }); + const worker = new Worker(URL.createObjectURL(worker_blob)); + + // Whether the worker is currently handling a search. This is a boolean + // as the worker only ever handles 1 or 0 searches at a time. + var worker_is_running = false; + + // The last search text that was sent to the worker. This is used to determine + // if the worker should be launched again when it reports back results. + var last_search_text = ""; + + // The results of the last search. This, in combination with the state of the filters + // in the DOM, is used compute the results to display on calls to update_search. + var unfiltered_results = []; + + // Which filter is currently selected + var selected_filter = ""; + + $(document).on("input", ".documenter-search-input", function (event) { + if (!worker_is_running) { + launch_search(); + } + }); -$(document).on("click", ".search-filter", function () { - if ($(this).hasClass("search-filter-selected")) { - selected_filter = ""; - } else { - selected_filter = $(this).text().toLowerCase(); + function launch_search() { + worker_is_running = true; + last_search_text = $(".documenter-search-input").val(); + worker.postMessage(last_search_text); } - // This updates search results and toggles classes for UI: - update_search(); -}); + worker.onmessage = function (e) { + if (last_search_text !== $(".documenter-search-input").val()) { + launch_search(); + } else { + worker_is_running = false; + } -/** - * Make/Update the search component - */ -function update_search() { - let querystring = $(".documenter-search-input").val(); + unfiltered_results = e.data; + update_search(); + }; - if (querystring.trim()) { - if (selected_filter == "") { - results = unfiltered_results; + $(document).on("click", ".search-filter", function () { + if ($(this).hasClass("search-filter-selected")) { + selected_filter = ""; } else { - results = unfiltered_results.filter((result) => { - return selected_filter == result.category.toLowerCase(); - }); + selected_filter = $(this).text().toLowerCase(); } - let search_result_container = ``; - let modal_filters = make_modal_body_filters(); - let search_divider = `
`; + // This updates search results and toggles classes for UI: + update_search(); + }); - if (results.length) { - let links = []; - let count = 0; - let search_results = ""; - - for (var i = 0, n = results.length; i < n && count < 200; ++i) { - let result = results[i]; - if (result.location && !links.includes(result.location)) { - search_results += result.div; - count++; - links.push(result.location); - } - } + /** + * Make/Update the search component + */ + function update_search() { + let querystring = $(".documenter-search-input").val(); - if (count == 1) { - count_str = "1 result"; - } else if (count == 200) { - count_str = "200+ results"; + if (querystring.trim()) { + if (selected_filter == "") { + results = unfiltered_results; } else { - count_str = count + " results"; + results = unfiltered_results.filter((result) => { + return selected_filter == result.category.toLowerCase(); + }); } - let result_count = `
${count_str}
`; - search_result_container = ` + let search_result_container = ``; + let modal_filters = make_modal_body_filters(); + let search_divider = `
`; + + if (results.length) { + let links = []; + let count = 0; + let search_results = ""; + + for (var i = 0, n = results.length; i < n && count < 200; ++i) { + let result = results[i]; + if (result.location && !links.includes(result.location)) { + search_results += result.div; + count++; + links.push(result.location); + } + } + + if (count == 1) { + count_str = "1 result"; + } else if (count == 200) { + count_str = "200+ results"; + } else { + count_str = count + " results"; + } + let result_count = `
${count_str}
`; + + search_result_container = ` +
+ ${modal_filters} + ${search_divider} + ${result_count} +
+ ${search_results} +
+
+ `; + } else { + search_result_container = `
${modal_filters} ${search_divider} - ${result_count} -
- ${search_results} -
-
+
0 result(s)
+ +
No result found!
`; - } else { - search_result_container = ` -
- ${modal_filters} - ${search_divider} -
0 result(s)
-
-
No result found!
- `; - } + } - if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").removeClass("is-justify-content-center"); - } + if ($(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").removeClass("is-justify-content-center"); + } - $(".search-modal-card-body").html(search_result_container); - } else { - if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { - $(".search-modal-card-body").addClass("is-justify-content-center"); + $(".search-modal-card-body").html(search_result_container); + } else { + if (!$(".search-modal-card-body").hasClass("is-justify-content-center")) { + $(".search-modal-card-body").addClass("is-justify-content-center"); + } + + $(".search-modal-card-body").html(` +
Type something to get started!
+ `); } + } - $(".search-modal-card-body").html(` -
Type something to get started!
- `); + /** + * Make the modal filter html + * + * @returns string + */ + function make_modal_body_filters() { + let str = filters + .map((val) => { + if (selected_filter == val.toLowerCase()) { + return `${val}`; + } else { + return `${val}`; + } + }) + .join(""); + + return ` +
+ Filters: + ${str} +
`; } } -/** - * Make the modal filter html - * - * @returns string - */ -function make_modal_body_filters() { - let str = filters - .map((val) => { - if (selected_filter == val.toLowerCase()) { - return `${val}`; - } else { - return `${val}`; - } - }) - .join(""); - - return ` -
- Filters: - ${str} -
`; +function waitUntilSearchIndexAvailable() { + // It is possible that the documenter.js script runs before the page + // has finished loading and documenterSearchIndex gets defined. + // So we need to wait until the search index actually loads before setting + // up all the search-related stuff. + if (typeof documenterSearchIndex !== "undefined") { + runSearchMainCode(); + } else { + console.warn("Search Index not available, waiting"); + setTimeout(waitUntilSearchIndexAvailable, 1000); + } } +// The actual entry point to the search code +waitUntilSearchIndexAvailable(); + }) //////////////////////////////////////////////////////////////////////////////// require(['jquery'], function($) { diff --git a/dev/index.html b/dev/index.html index 6988841..35ea7f7 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,11 +1,11 @@ -Home · RandomFeatureMaps.jl

RandomFeatureMaps

Documentation for RandomFeatureMaps.

RandomFeatureMaps.RandomFourierFeaturesType
RandomFourierFeatures(n => m, σ)

Maps n-dimensional data and projects it to m-dimensional random fourier features.

This type has no trainable parameters.

Examples

julia> rff = RandomFourierFeatures(2 => 4, 1.0); # maps 2D data to 4D
+Home · RandomFeatureMaps.jl

RandomFeatureMaps

Documentation for RandomFeatureMaps.

RandomFeatureMaps.RandomFourierFeaturesType
RandomFourierFeatures(n => m, σ)

Maps n-dimensional data and projects it to m-dimensional random fourier features.

This type has no trainable parameters.

Examples

julia> rff = RandomFourierFeatures(2 => 4, 1.0); # maps 2D data to 4D
 
 julia> rff(rand(2, 3)) |> size # 3 samples
 (4, 3)
 
 julia> rff(rand(2, 3, 5)) |> size # extra batch dim
-(4, 3, 5)
source
RandomFeatureMaps.RandomOrientationFeaturesType
RandomOrientationFeatures

Holds two random matrices which are used to embed rigid transformations.

This type has no trainable parameters.

Methods

  • (::RandomOrientationFeatures)(rigid1, rigid2): returns the distances between the corresponding

rigid transformations, embedded using the two random matrices of the random orientation features.

  • (::RandomOrientationFeatures)(rigid1, rigid2; dims::Int): unsqueezes batch dimension dim+1

of rigid1 and dim of rigid2 to broadcast the rof call and produce a pairwise map.

  • (::RandomOrientationFeatures)(rigid1, rigid2, graph::GraphNeuralNetworks.GNNGraph): similar to

the first method, but takes two sets rigid transformations of equal size and unrolls a graph to get the pairs of rigid transformations. Equivalent to the second method (with broadcasted dimensions flattened) when the graph is complete.

Each of these have single rigid argument methods for when rigid1 == rigid2, i.e. rof(rigid)

Examples

julia> rof = RandomOrientationFeatures(10, 0.1f0);
+(4, 3, 5)
source
RandomFeatureMaps.RandomOrientationFeaturesType
RandomOrientationFeatures

Holds two random matrices which are used to embed rigid transformations.

This type has no trainable parameters.

Methods

  • (::RandomOrientationFeatures)(rigid1, rigid2): returns the distances between the corresponding

rigid transformations, embedded using the two random matrices of the random orientation features.

  • (::RandomOrientationFeatures)(rigid1, rigid2; dims::Int): unsqueezes batch dimension dim+1

of rigid1 and dim of rigid2 to broadcast the rof call and produce a pairwise map.

  • (::RandomOrientationFeatures)(rigid1, rigid2, graph::GraphNeuralNetworks.GNNGraph): similar to

the first method, but takes two sets rigid transformations of equal size and unrolls a graph to get the pairs of rigid transformations. Equivalent to the second method (with broadcasted dimensions flattened) when the graph is complete.

Each of these have single rigid argument methods for when rigid1 == rigid2, i.e. rof(rigid)

Examples

julia> rof = RandomOrientationFeatures(10, 0.1f0);
 
 julia> rigid = rand_rigid(Float32, (4, 3));
 
@@ -27,4 +27,4 @@
 julia> rigid = rand_rigid(Float32, (2,));
 
 julia> rof(rigid, graph) |> size
-(10, 3)
source
RandomFeatureMaps.get_rigidMethod
get_rigid(R::AbstractArray, t::AbstractArray)

Converts a rotation R and translation t to a BatchedTransformations.Rigid, designed to handle batch dimensions.

The transformation gets applied according to NNlib.batched_mul(R, x) .+ t

source
+(10, 3)
source
RandomFeatureMaps.get_rigidMethod
get_rigid(R::AbstractArray, t::AbstractArray)

Converts a rotation R and translation t to a BatchedTransformations.Rigid, designed to handle batch dimensions.

The transformation gets applied according to NNlib.batched_mul(R, x) .+ t

source