[
https://issues.apache.org/jira/browse/MAHOUT-1500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097929#comment-14097929
]
ASF GitHub Bot commented on MAHOUT-1500:
----------------------------------------
Github user andrewpalumbo commented on a diff in the pull request:
https://github.com/apache/mahout/pull/21#discussion_r16274291
--- Diff: h2o/src/main/java/org/apache/mahout/h2obindings/ops/Cbind.java ---
@@ -0,0 +1,94 @@
+/*
+ * 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 org.apache.mahout.h2obindings.ops;
+
+import water.MRTask;
+import water.fvec.Frame;
+import water.fvec.Vec;
+import water.fvec.Chunk;
+import water.fvec.NewChunk;
+
+import org.apache.mahout.h2obindings.H2OHelper;
+import org.apache.mahout.h2obindings.drm.H2ODrm;
+
+public class Cbind {
+ /* R's cbind like operator, on drmA and drmB */
+ public static H2ODrm Cbind(H2ODrm drmA, H2ODrm drmB) {
+ Frame fra = drmA.frame;
+ Vec keysa = drmA.keys;
+ Frame frb = drmB.frame;
+ Vec keysb = drmB.keys;
+
+ /* If A and B are similarly partitioned, .. */
+ if (fra.anyVec().group() == frb.anyVec().group())
+ /* .. then, do a light weight zip() */
+ return zip(fra, keysa, frb, keysb);
+ else
+ /* .. else, do a heavy weight join() which involves moving data over
the wire */
+ return join(fra, keysa, frb, keysb);
+ }
+
+ /* Light weight zip(), no data movement */
+ private static H2ODrm zip(final Frame fra, final Vec keysa, final Frame
frb, final Vec keysb) {
+ /* Create a new Vec[] to hold the concatenated list of A and B's
column vectors */
+ Vec vecs[] = new Vec[fra.vecs().length + frb.vecs().length];
+ int d = 0;
+ /* fill A's column vectors */
+ for (Vec vfra : fra.vecs())
+ vecs[d++] = vfra;
--- End diff --
for loop needs braces ... here and in a few other places
> H2O integration
> ---------------
>
> Key: MAHOUT-1500
> URL: https://issues.apache.org/jira/browse/MAHOUT-1500
> Project: Mahout
> Issue Type: Improvement
> Reporter: Anand Avati
> Fix For: 1.0
>
>
> Provide H2O backend for the Mahout DSL
--
This message was sent by Atlassian JIRA
(v6.2#6252)