[
https://issues.apache.org/jira/browse/MAHOUT-799?focusedWorklogId=1001500&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-1001500
]
ASF GitHub Bot logged work on MAHOUT-799:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Jan/26 07:46
Start Date: 23/Jan/26 07:46
Worklog Time Spent: 10m
Work Description: ryankert01 commented on code in PR #868:
URL: https://github.com/apache/mahout/pull/868#discussion_r2719993706
##########
qdp/qdp-kernels/src/iqp.cu:
##########
@@ -0,0 +1,232 @@
+//
+// 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.
+
+// IQP (Instantaneous Quantum Polynomial) Encoding CUDA Kernels
+//
+// Creates entangled quantum states via diagonal phase gates:
+// |psi> = H^n * U_phase(data) * H^n |0>^n
+//
+// The amplitude for basis state |z> is:
+// amplitude[z] = (1/2^n) * sum_x exp(i*theta(x)) * (-1)^popcount(x AND z)
+//
+// Two variants:
+// - enable_zz=0: theta(x) = sum_i x_i * data_i (n parameters)
+// - enable_zz=1: theta(x) = sum_i x_i * data_i + sum_{i<j} x_i * x_j * data_ij
+// (n + n*(n-1)/2 parameters)
+
+#include <cuda_runtime.h>
+#include <cuComplex.h>
+#include <math.h>
+
+// Compute phase theta(x) for a given basis state x
+__device__ double compute_phase(
+ const double* __restrict__ data,
+ size_t x,
+ unsigned int num_qubits,
+ int enable_zz
+) {
+ double phase = 0.0;
+
+ // Single-qubit Z terms: sum_i x_i * data[i]
+ for (unsigned int i = 0; i < num_qubits; ++i) {
+ if ((x >> i) & 1U) {
+ phase += data[i];
+ }
+ }
+
+ // Two-qubit ZZ terms (if enabled): sum_{i<j} x_i * x_j * data[n +
pair_index]
+ if (enable_zz) {
+ unsigned int pair_idx = num_qubits;
+ for (unsigned int i = 0; i < num_qubits; ++i) {
+ for (unsigned int j = i + 1; j < num_qubits; ++j) {
+ if (((x >> i) & 1U) && ((x >> j) & 1U)) {
+ phase += data[pair_idx];
+ }
+ pair_idx++;
+ }
+ }
+ }
+
+ return phase;
+}
+
+__global__ void iqp_encode_kernel(
Review Comment:
yes, opened #921
Issue Time Tracking
-------------------
Worklog Id: (was: 1001500)
Time Spent: 1.5h (was: 1h 20m)
> Cannot run SequenceFilesFromCsvFilter, ever
> -------------------------------------------
>
> Key: MAHOUT-799
> URL: https://issues.apache.org/jira/browse/MAHOUT-799
> Project: Mahout
> Issue Type: Bug
> Components: classic
> Affects Versions: 0.5
> Reporter: Jack Tanner
> Assignee: Sean R. Owen
> Priority: Major
> Fix For: 0.6
>
> Attachments: MAHOUT-799.patch, MAHOUT-799.patch
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> As described here:
> http://mail-archives.apache.org/mod_mbox/mahout-user/201106.mbox/%[email protected]%3E
> SequenceFilesFromCsvFilter cannot be invoked with default parameter values,
> because it dies like so:
> bin/mahout seqdirectory -i input -o output -filter
> org.apache.mahout.text.SequenceFilesFromCsvFilter
> ...
> Caused by: java.lang.NumberFormatException: null
> at java.lang.Integer.parseInt(Integer.java:417)
> at java.lang.Integer.parseInt(Integer.java:499)
> at
> org.apache.mahout.text.SequenceFilesFromCsvFilter.<init>(SequenceFilesFromCsvFilter.java:56)
> If one adds the parameters -kcol 0 -vcol 0 (or their long-form versions), it
> dies like so:
> Unexpected -kcol while processing Job-Specific Options
> Commenting out SequenceFilesFromCsvFilter:56 and
> SequenceFilesFromCsvFilter:57, like so, allows the run to proceed
> // this.keyColumn = Integer.parseInt(options.get(KEY_COLUMN_OPTION[0]));
> // this.valueColumn =
> Integer.parseInt(options.get(VALUE_COLUMN_OPTION[0]));
--
This message was sent by Atlassian Jira
(v8.20.10#820010)