-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
tech.v3.datatype.packing.html
9 lines (9 loc) · 15 KB
/
tech.v3.datatype.packing.html
1
2
3
4
5
6
7
8
9
<!DOCTYPE html PUBLIC ""
"">
<html><head><meta charset="UTF-8" /><title>tech.v3.datatype.packing documentation</title><link rel="stylesheet" type="text/css" href="css/default.css" /><link rel="stylesheet" type="text/css" href="highlight/solarized-light.css" /><script type="text/javascript" src="highlight/highlight.min.js"></script><script type="text/javascript" src="js/jquery.min.js"></script><script type="text/javascript" src="js/page_effects.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div id="header"><h2>Generated by <a href="https://github.com/weavejester/codox">Codox</a> with <a href="https://github.com/xsc/codox-theme-rdash">RDash UI</a> theme</h2><h1><a href="index.html"><span class="project-title"><span class="project-name">dtype-next</span> <span class="project-version">8.042</span></span></a></h1></div><div class="sidebar primary"><h3 class="no-link"><span class="inner">Project</span></h3><ul class="index-link"><li class="depth-1 "><a href="index.html"><div class="inner">Index</div></a></li></ul><h3 class="no-link"><span class="inner">Topics</span></h3><ul><li class="depth-1 "><a href="buffered-image.html"><div class="inner"><span>Buffered Image Support</span></div></a></li><li class="depth-1 "><a href="cheatsheet.html"><div class="inner"><span>Cheatsheet</span></div></a></li><li class="depth-1 "><a href="datatype-to-dtype-next.html"><div class="inner"><span>Why dtype-next?</span></div></a></li><li class="depth-1 "><a href="dimensions-bytecode-gen.html"><div class="inner"><span>Dimensions and Bytecode Generation</span></div></a></li><li class="depth-1 "><a href="overview.html"><div class="inner"><span>Overview</span></div></a></li></ul><h3 class="no-link"><span class="inner">Namespaces</span></h3><ul><li class="depth-1"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>tech</span></div></div></li><li class="depth-2"><div class="no-link"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>v3</span></div></div></li><li class="depth-3"><a href="tech.v3.datatype.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>datatype</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.argops.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>argops</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.bitmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>bitmap</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.convolve.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>convolve</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.datetime.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>datetime</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.errors.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>errors</span></div></a></li><li class="depth-4"><a href="tech.v3.datatype.ffi.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>ffi</span></div></a></li><li class="depth-5 branch"><a href="tech.v3.datatype.ffi.clang.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>clang</span></div></a></li><li class="depth-5"><a href="tech.v3.datatype.ffi.graalvm.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>graalvm</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.functional.html"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>functional</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.gradient.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>gradient</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.jna.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jna</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.jvm-map.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>jvm-map</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.list.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>list</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.locker.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>locker</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.mmap.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mmap</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.mmap-writer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>mmap-writer</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.native-buffer.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>native-buffer</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.nippy.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>nippy</span></div></a></li><li class="depth-4 branch current"><a href="tech.v3.datatype.packing.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>packing</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.reductions.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>reductions</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.rolling.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>rolling</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.sampling.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>sampling</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.datatype.struct.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>struct</span></div></a></li><li class="depth-4"><a href="tech.v3.datatype.wavelet.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>wavelet</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree" style="top: -765px;"><span class="top" style="height: 774px;"></span><span class="bottom"></span></span><span>libs</span></div></div></li><li class="depth-4 branch"><a href="tech.v3.libs.buffered-image.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>buffered-image</span></div></a></li><li class="depth-4"><a href="tech.v3.libs.neanderthal.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>neanderthal</span></div></a></li><li class="depth-3"><div class="no-link"><div class="inner"><span class="tree" style="top: -83px;"><span class="top" style="height: 92px;"></span><span class="bottom"></span></span><span>parallel</span></div></div></li><li class="depth-4"><a href="tech.v3.parallel.for.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>for</span></div></a></li><li class="depth-3"><a href="tech.v3.tensor.html"><div class="inner"><span class="tree" style="top: -52px;"><span class="top" style="height: 61px;"></span><span class="bottom"></span></span><span>tensor</span></div></a></li><li class="depth-4 branch"><a href="tech.v3.tensor.color-gradients.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>color-gradients</span></div></a></li><li class="depth-4"><a href="tech.v3.tensor.dimensions.html"><div class="inner"><span class="tree"><span class="top"></span><span class="bottom"></span></span><span>dimensions</span></div></a></li></ul></div><div class="sidebar secondary"><h3><a href="#top"><span class="inner">Public Vars</span></a></h3><ul><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-add-packed-datatype.21"><div class="inner"><span>add-packed-datatype!</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-buffer-packing-pair"><div class="inner"><span>buffer-packing-pair</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-pack"><div class="inner"><span>pack</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-pack-datatype"><div class="inner"><span>pack-datatype</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-pack-scalar"><div class="inner"><span>pack-scalar</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-packed-datatype.3F"><div class="inner"><span>packed-datatype?</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-unpack"><div class="inner"><span>unpack</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-unpack-datatype"><div class="inner"><span>unpack-datatype</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-unpacked-datatype.3F"><div class="inner"><span>unpacked-datatype?</span></div></a></li><li class="depth-1"><a href="tech.v3.datatype.packing.html#var-wrap-with-packing"><div class="inner"><span>wrap-with-packing</span></div></a></li></ul></div><div class="namespace-docs" id="content"><h1 class="anchor" id="top">tech.v3.datatype.packing</h1><div class="doc"><div class="markdown"><p>Implements the ‘packed/unpacked’ concept in datatype. This allows us to take objects like LocalDate’s and store them in int32 storage which dramatically decreases their size.</p></div></div><div class="public anchor" id="var-add-packed-datatype.21"><h3>add-packed-datatype!</h3><div class="usage"><code>(add-packed-datatype! object-cls object-datatype packed-datatype primitive-datatype pack-fn unpack-fn)</code></div><div class="doc"><div class="markdown"><p>Add a datatype that you wish to be packed into a single scalar numeric value.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L21">view source</a></div></div><div class="public anchor" id="var-buffer-packing-pair"><h3>buffer-packing-pair</h3><div class="usage"><code>(buffer-packing-pair datatype)</code></div><div class="doc"><div class="markdown"><p>If datatype is a packed datatype, return a pair of functions, unpacking-read and packing-write. unpacking-read reads the appropriate datatype and calls the datatype’s unpack fn on it. packing-write packs the input and writes it to the appropriate place. Note that in this case those functions take the buffer and the index. returns {:unpacking-read :packing-write}</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L127">view source</a></div></div><div class="public anchor" id="var-pack"><h3>pack</h3><div class="usage"><code>(pack item)</code></div><div class="doc"><div class="markdown"><p>Pack a scalar, iterable, or a reader into a new scalar, iterable or a reader. If this isn’t a packable datatype this is a no-op.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L92">view source</a></div></div><div class="public anchor" id="var-pack-datatype"><h3>pack-datatype</h3><div class="usage"><code>(pack-datatype datatype)</code></div><div class="doc"><div class="markdown"><p>Returns the packed datatype for this unpacked datatype.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L53">view source</a></div></div><div class="public anchor" id="var-pack-scalar"><h3>pack-scalar</h3><div class="usage"><code>(pack-scalar value dtype)</code></div><div class="doc"><div class="markdown"><p>Pack a scalar value. Dtype is provided so nil can be packed.</p>
<p>Example:</p>
<pre><code class="clojure">tech.v3.datatype.packing> (pack-scalar nil :local-date)
-2147483648
tech.v3.datatype.packing> (pack-scalar (java.time.LocalDate/now) :local-date)
18775
</code></pre></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L146">view source</a></div></div><div class="public anchor" id="var-packed-datatype.3F"><h3>packed-datatype?</h3><div class="usage"><code>(packed-datatype? datatype)</code></div><div class="doc"><div class="markdown"><p>Returns true of this is a datatype that could be unpacked.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L37">view source</a></div></div><div class="public anchor" id="var-unpack"><h3>unpack</h3><div class="usage"><code>(unpack item)</code></div><div class="doc"><div class="markdown"><p>Unpack a scalar, iterable, or a reader. If the item is not a packed datatype this is a no-op.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L60">view source</a></div></div><div class="public anchor" id="var-unpack-datatype"><h3>unpack-datatype</h3><div class="usage"><code>(unpack-datatype datatype)</code></div><div class="doc"><div class="markdown"><p>Returns the unpacked datatype for this packed datatype.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L42">view source</a></div></div><div class="public anchor" id="var-unpacked-datatype.3F"><h3>unpacked-datatype?</h3><div class="usage"><code>(unpacked-datatype? datatype)</code></div><div class="doc"><div class="markdown"><p>Returns true if this is a datatype that could be packed.</p></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L47">view source</a></div></div><div class="public anchor" id="var-wrap-with-packing"><h3>wrap-with-packing</h3><div class="usage"><code>(wrap-with-packing datatype src-fn)</code></div><div class="doc"><div class="markdown"></div></div><div class="src-link"><a href="https://github.com/cnuernber/dtype-next/blob/master/src/tech/v3/datatype/packing.clj#L120">view source</a></div></div></div></body></html>