You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by pl...@apache.org on 2024/06/20 18:22:21 UTC

(datasketches-go) 01/01: Start CPC Sketch implementation

This is an automated email from the ASF dual-hosted git repository.

placave pushed a commit to branch cpc-sketch
in repository https://gitbox.apache.org/repos/asf/datasketches-go.git

commit 435b4736f1a6187e0b8909dcb0d9d2d906bcabff
Author: Pierre Lacave <pi...@datadoghq.com>
AuthorDate: Thu Jun 20 20:22:11 2024 +0200

    Start CPC Sketch implementation
---
 cpc/cpc_sketch.go | 36 ++++++++++++++++++++++++++++++++++++
 cpc/pair_table.go |  8 ++++++++
 2 files changed, 44 insertions(+)

diff --git a/cpc/cpc_sketch.go b/cpc/cpc_sketch.go
new file mode 100644
index 0000000..8eebe04
--- /dev/null
+++ b/cpc/cpc_sketch.go
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package cpc
+
+type CpcSketch struct {
+	seed int64
+
+	//common variables
+	lgK        int
+	numCoupons int64 // The number of coupons collected so far.
+	mergeFlag  bool  // Is the sketch the result of merging?
+	fiCol      int   // First Interesting Column. This is part of a speed optimization.
+
+	windowOffset  int
+	slidingWindow []byte    //either null or size K bytes
+	pairTable     pairTable //for sparse and surprising values, either null or variable size
+
+	//The following variables are only valid in HIP varients
+	kxp         float64 //used with HIP
+	hipEstAccum float64 //used with HIP
+}
diff --git a/cpc/pair_table.go b/cpc/pair_table.go
new file mode 100644
index 0000000..7eb35e9
--- /dev/null
+++ b/cpc/pair_table.go
@@ -0,0 +1,8 @@
+package cpc
+
+type pairTable struct {
+	lgSizeInts int
+	validBits  int
+	numPairs   int
+	slotsArr   []int
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org