{"id":32641838,"url":"https://github.com/hadjiprocopis/histocurse","last_synced_at":"2026-07-03T13:33:39.079Z","repository":{"id":182168976,"uuid":"109284935","full_name":"hadjiprocopis/histocurse","owner":"hadjiprocopis","description":"A Java implementation of a multidimensional histogram backed on dense/conventional OR sparse array. Extremely efficient when  number of dimensions is large and back-store is sparse array. This module depends on other projects which can be found on my repo here. See README below to see what you need to download.","archived":false,"fork":false,"pushed_at":"2017-11-02T20:01:00.000Z","size":1203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-07-19T00:34:12.405Z","etag":null,"topics":["data-analysis","data-structures","histogram","multidimensional"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hadjiprocopis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-11-02T15:42:35.000Z","updated_at":"2023-07-19T00:34:13.856Z","dependencies_parsed_at":null,"dependency_job_id":"b2d04bfe-2221-4b09-a021-ef6aa8848d34","html_url":"https://github.com/hadjiprocopis/histocurse","commit_stats":null,"previous_names":["hadjiprocopis/histocurse"],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/hadjiprocopis/histocurse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadjiprocopis%2Fhistocurse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadjiprocopis%2Fhistocurse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadjiprocopis%2Fhistocurse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadjiprocopis%2Fhistocurse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hadjiprocopis","download_url":"https://codeload.github.com/hadjiprocopis/histocurse/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hadjiprocopis%2Fhistocurse/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35088473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-03T02:00:05.635Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","data-structures","histogram","multidimensional"],"created_at":"2025-10-31T02:59:56.482Z","updated_at":"2026-07-03T13:33:39.070Z","avatar_url":"https://github.com/hadjiprocopis.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# histocurse\n\nauthor: andreas hadjiprocopis (andreashad2@gmail.com)\n\nThis is a module implementing a Histogram in N-dimensions.\nMeaning that bins do not exist in a one-dimensional space\nas they usually do but can be in N-dimensions.\n\nN can be large. In the case of large N, it is better to\nuse the \u003cSparseArray\u003e back-store.\n\nThis module depends on the following modules in this\nrepository:\u003cbr/\u003e\ncontainers (https://github.com/hadjiprocopis/containers)\nstatistics (https://github.com/hadjiprocopis/statistics)\ncartesian (https://github.com/hadjiprocopis/cartesian)\nhadjiprocopis_utils (https://github.com/hadjiprocopis/hadjiprocopis_utils)\n\nHere is an example on how to use this module:\n\n```\nimport  java.util.Random;\nimport  java.util.HashMap;\nimport  java.util.ArrayList;\nimport  java.io.PrintWriter;\n\nimport  ahp.org.Histograms.*;\nimport  ahp.org.Containers.*;\n\npublic class TestHistograms_SparseArray {\npublic static void main(String args[]) throws Exception {\n\t// Here we create labels for each bin in the histogram.\n\t// We are going to create 2-dimensional histogram with\n\t// 2 bins in each dimension.\n\t// Labels to bins are optional.\n\tString  labels[/*dims*/][/*num bins/labels per dim*/] =\n\t\tnew String[][]{\n\t\t\tnew String[]{\"a\", \"b\"},\n\t\t\tnew String[]{\"a\", \"b\"},\n\t\t}\n\t;\n\n\t// Here we create the 2-dimensional histogram\n\tHistogram ahist = new Histogram\u003cSparseArray\u003cHistobin\u003e\u003e(\n\t\t// histogram name\n\t\t\"a histogram1\",\n\t\t// labels (a string array) if any, otherwise will create default\n\t\tlabels,\n\t\t// specify the number of dimensions and the number of bins in each dimension\n\t\tnew int[]{2, 2}, // numbins per dim\n\t\t// bin widths for each dimension\n\t\tnew double[]{1,1}, // bin widths\n\t\t// bins start from 0 in both dimensions\n\t\tnew double[]{0,0}, // boundaries start\n\t\t// Some magic: specify what backing store you want\n\t\t// can also be DenseArray.class\n\t\t// from: http://stackoverflow.com/questions/37231043/how-to-keep-generic-type-of-nested-generics-with-class-tokens\n\t\t(Class\u003cSparseArray\u003cHistobin\u003e\u003e )(Class\u003c?\u003e )SparseArray.class\n\t);\n\n\t// and here we are adding data to the histogram\n\t// this says increment the count of the bin with this LABEL\n\tahist.increment_bin_count(new String[]{\"a\", \"a\"});\n\t// whereas this one finds the bin given coordinates of the data\n\t// e.g. data (0.1,0.3) falls into the bin (0,0) (given that they\n\t// start from 0 and have a width of 1 (see above)\n\tahist.increment_bin_count(new double[]{0.1, 0.3});\n\tahist.increment_bin_count(new double[]{0.1, 0.3});\n\tahist.increment_bin_count(new double[]{0.1, 0.3});\n\tahist.increment_bin_count(new double[]{0.1, 0.3});\n\tahist.increment_bin_count(new double[]{0.1, 0.3});\n\tahist.increment_bin_count(new double[]{0.2, 0.5});\n\tahist.increment_bin_count(new double[]{0.3, 1.2});\n\tahist.increment_bin_count(new double[]{0.4, 1.5});\n\tahist.increment_bin_count(new double[]{1.1, 0.1});\n\tahist.increment_bin_count(new double[]{1.2, 1.4});\n\n\tSystem.out.println(\"*******************\");\n\tSystem.out.println(\"Histogram with preset-labels: \"+ahist);\n\n\t// here we decrement bin counts\n\tSystem.out.println(\"******************* DECREMENTING \");\n\tahist.decrement_bin_count(new double[]{1.2, 1.4});\n\tahist.decrement_bin_count(new double[]{0.2, 0.2});\n\tahist.decrement_bin_count(new double[]{0.2, 0.2});\n\tahist.decrement_bin_count(new double[]{0.2, 0.2});\n\tahist.decrement_bin_count(new double[]{0.2, 0.2});\n\tSystem.out.println(\"after decrement Histogram with preset-labels: \"+ahist);\n\n\t// Here we are sampling from the histogram\n\t// basically we are asking for the content of a bin\n\t// it will return a Histobin object\n\tHistobin abin;\n\t// select by a coordinate inside a bin:\n\tabin = ahist.get_bin(new double[]{0.2, 0.2});\n\tSystem.out.println(\"Selected bin: \"+abin);\n\t// select by bin-label\n\tabin = ahist.get_bin(new String[]{\"a\", \"b\"});\n\tSystem.out.println(\"Selected bin: \"+abin);\n\t// select by bin-coordinate (integer)\n\tabin = ahist.get_bin(new int[]{0, 1});\n\tSystem.out.println(\"Selected bin: \"+abin);\n\t\n\t// This is where the magic happens\n\t// we are asking for bins selected by a wildcard: first dim to be 'a' and second dim any (*)\n\t// (courtesy of the CARTESIAN module)\n\tRandom arng = new Random(1234);\n\tHistogramSampler asampler = ahist.sampler(arng);\n\t// get all bins whose first coordinate is 'a' and second is anything (*)\n\tasampler.select_bins_using_wildcard_labels(new String[]{\"a\", \"*\"});\n\t// and print those bins:\n\tSystem.out.println(\"random bin: with '0-*' : \"+asampler.random_bin_from_selection());\n}\n}\n```\n\nThe above example can be run using\n```\nant clean \u0026\u0026 ant \u0026\u0026 ant TestHistograms_SparseArray\n```\n\nThere is more magic to this module which will be documented\nin due time.\n\nauthor: andreas hadjiprocopis (andreashad2@gmail.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadjiprocopis%2Fhistocurse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhadjiprocopis%2Fhistocurse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhadjiprocopis%2Fhistocurse/lists"}