I hereby claim:
- I am masyukun on github.
- I am masyukun (https://keybase.io/masyukun) on keybase.
- I have a public key ASDa8I6gfiJNjNvyPi6hX-d-z-WW4c1wnQCKNRwoz6zcpgo
To claim this, I am signing this object:
| Function name: HILBERT_MAP | |
| Function description: Call the Hilbert function and map it to the data | |
| Argument placeholders: [position, level, edge, source_1d, direction] | |
| Formula definition: | |
| =arrayformula(HLOOKUP(HILBERT(position,level,edge,direction),{COLUMN(source_1d)-index(COLUMN(source_1d),1,1)+1;source_1d},2)) | |
| Function name: HILBERT | |
| Function description: Generate Hilbert sequence of specified size | |
| Argument placeholders: [position, level, edge, direction] |
| // DONE: Translated to XQuery | |
| if (!String.prototype.hashCode){ | |
| String.prototype.hashCode = function() { | |
| var hash = 0, i, chr, len; | |
| if (this.length == 0) return hash; | |
| for (i = 0, len = this.length; i < len; i++) { | |
| chr = this.charCodeAt(i); | |
| hash = ((hash << 5) - hash) + chr; | |
| hash |= 0; // Convert to 32bit integer | |
| } |
I hereby claim:
To claim this, I am signing this object:
| /** | |
| * Document Type Inventory in MarkLogic v0.1 | |
| * | |
| * This version exists as a GitHub Gist at https://gist.github.com/masyukun/063f59a7f7d84eeaeeef2f23d05cad59 | |
| * | |
| * @license | |
| * Copyright (c) 2020 Matthew Royal | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal |
| /** | |
| * Recipe Tools v0.1 | |
| * | |
| * This version exists as a GitHub Gist at https://gist.github.com/masyukun/64a3490a464acaa3b9af6819f10dfbf4 | |
| * | |
| * @license | |
| * Copyright (c) 2020 Matthew Royal | |
| * | |
| * Permission is hereby granted, free of charge, to any person obtaining a copy | |
| * of this software and associated documentation files (the "Software"), to deal |
| xquery version "1.0-ml"; | |
| module namespace treemap = "http://matthewroyal.com/marklogic/ferret/filetypetreemap"; | |
| declare variable $sampleSize := 100; | |
| declare variable $sampleThreshold := 1000; | |
| declare function treemap:get( | |
| $context as map:map, | |
| $params as map:map |
| xquery version "1.0-ml"; | |
| declare namespace p = "http://www.mycompany.com"; | |
| declare option xdmp:mapping "false"; | |
| (:~ | |
| Returns z-score for the specified confidence value | |
| For confidence values not in the lookup table, |
| (:~ | |
| This module converts an XML document into a JSON document. | |
| - Element ordering is preserved. | |
| - Attributes and namespaces are ignored. | |
| - Identical element names become JSON arrays. | |
| Example usage: | |
| let $uri := "somedoc.xml" | |
| let $doc := fn:doc($uri) | |
| return jsontools:jsonify($doc) | |
| declare function local:solveCubicEquation($a as xs:double, $b as xs:double, $c as xs:double, $d as xs:double) { | |
| let $big := ((-math:pow($b,3.0)) div (27.0 * math:pow($a,3.0))) + (($b * $c) div (6.0 * math:pow($a,2.0))) - ($d div (2.0 * $a)) | |
| let $small := ($c div (3.0 * $a)) - (math:pow($b,2.0) div (9.0 * math:pow($a,2.0))) | |
| let $tail := ($b div (3.0 * $a)) | |
| let $x := math:pow($big + math:sqrt(math:pow($big,2.0) + math:pow($small,3.0)), (1.0 div 3.0)) + local:sqrt3( $big - math:sqrt(math:pow($big,2.0) + math:pow($small,3.0)) ) - $tail | |
| return $x | |
| }; |
| (: | |
| Estimate the cube root of a number. | |
| WARNINGS: 1) Does not work well with many digits due to xs:double size limitation. | |
| 2) Does not generate complex numbers. | |
| based on http://www4.wittenberg.edu/academics/mathcomp/bjsdir/CubeRootTalk.pdf | |
| :) | |
| declare function local:sqrt3($number as xs:double) { | |
| let $answer := () | |