Return-Path: Delivered-To: apmail-incubator-hama-commits-archive@minotaur.apache.org Received: (qmail 70092 invoked from network); 19 May 2010 05:25:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 May 2010 05:25:05 -0000 Received: (qmail 37411 invoked by uid 500); 19 May 2010 05:25:05 -0000 Delivered-To: apmail-incubator-hama-commits-archive@incubator.apache.org Received: (qmail 36756 invoked by uid 500); 19 May 2010 05:25:04 -0000 Mailing-List: contact hama-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hama-dev@incubator.apache.org Delivered-To: mailing list hama-commits@incubator.apache.org Received: (qmail 36736 invoked by uid 99); 19 May 2010 05:25:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 May 2010 05:25:03 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 May 2010 05:25:00 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 93A972388903; Wed, 19 May 2010 05:24:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r946031 - in /incubator/hama/trunk: ./ src/test/org/apache/hama/examples/ src/test/org/apache/hama/mapreduce/ src/test/org/apache/hama/matrix/ Date: Wed, 19 May 2010 05:24:38 -0000 To: hama-commits@incubator.apache.org From: edwardyoon@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100519052438.93A972388903@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: edwardyoon Date: Wed May 19 05:24:38 2010 New Revision: 946031 URL: http://svn.apache.org/viewvc?rev=946031&view=rev Log: Remove meaningless unit tests Added: incubator/hama/trunk/src/test/org/apache/hama/examples/TestBlockMatrixMapReduce.java incubator/hama/trunk/src/test/org/apache/hama/examples/TestRandomMatrixMapReduce.java Removed: incubator/hama/trunk/src/test/org/apache/hama/mapreduce/TestBlockMatrixMapReduce.java incubator/hama/trunk/src/test/org/apache/hama/mapreduce/TestRandomMatrixMapReduce.java incubator/hama/trunk/src/test/org/apache/hama/matrix/TestMatrixVectorMult.java incubator/hama/trunk/src/test/org/apache/hama/matrix/TestSingularValueDecomposition.java Modified: incubator/hama/trunk/CHANGES.txt Modified: incubator/hama/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=946031&r1=946030&r2=946031&view=diff ============================================================================== --- incubator/hama/trunk/CHANGES.txt (original) +++ incubator/hama/trunk/CHANGES.txt Wed May 19 05:24:38 2010 @@ -42,6 +42,7 @@ Trunk (unreleased changes) IMPROVEMENTS + HAMA-261: Remove meaningless unit tests (edwardyoon) HAMA-253: Change the blog link url (edwardyoon) HAMA-247: Discuss / Refactor HamaMaster and GroomServer (hyunsik) HAMA-239: Remove unused class (edwardyoon) Added: incubator/hama/trunk/src/test/org/apache/hama/examples/TestBlockMatrixMapReduce.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/examples/TestBlockMatrixMapReduce.java?rev=946031&view=auto ============================================================================== --- incubator/hama/trunk/src/test/org/apache/hama/examples/TestBlockMatrixMapReduce.java (added) +++ incubator/hama/trunk/src/test/org/apache/hama/examples/TestBlockMatrixMapReduce.java Wed May 19 05:24:38 2010 @@ -0,0 +1,61 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * 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.hama.examples; + +import java.io.IOException; + +import org.apache.hama.HamaCluster; +import org.apache.hama.matrix.DenseMatrix; +import org.apache.log4j.Logger; +import org.apache.hama.examples.MatrixMultiplication; + +public class TestBlockMatrixMapReduce extends HamaCluster { + static final Logger LOG = Logger.getLogger(TestBlockMatrixMapReduce.class); + static final int SIZE = 32; + + /** constructor */ + public TestBlockMatrixMapReduce() { + super(); + } + + public void testBlockMatrixMapReduce() throws IOException, + ClassNotFoundException { + DenseMatrix m1 = DenseMatrix.random(conf, SIZE, SIZE); + DenseMatrix m2 = DenseMatrix.random(conf, SIZE, SIZE); + + DenseMatrix c = MatrixMultiplication.mult(m1, m2, 16); + + double[][] mem = new double[SIZE][SIZE]; + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + for (int k = 0; k < SIZE; k++) { + mem[i][k] += m1.get(i, j) * m2.get(j, k); + } + } + } + + for (int i = 0; i < SIZE; i++) { + for (int j = 0; j < SIZE; j++) { + double gap = (mem[i][j] - c.get(i, j)); + assertTrue(gap < 0.000001 || gap < -0.000001); + } + } + } +} Added: incubator/hama/trunk/src/test/org/apache/hama/examples/TestRandomMatrixMapReduce.java URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/test/org/apache/hama/examples/TestRandomMatrixMapReduce.java?rev=946031&view=auto ============================================================================== --- incubator/hama/trunk/src/test/org/apache/hama/examples/TestRandomMatrixMapReduce.java (added) +++ incubator/hama/trunk/src/test/org/apache/hama/examples/TestRandomMatrixMapReduce.java Wed May 19 05:24:38 2010 @@ -0,0 +1,59 @@ +/** + * Copyright 2007 The Apache Software Foundation + * + * 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.hama.examples; + +import java.io.IOException; + +import org.apache.hama.HamaCluster; +import org.apache.hama.examples.RandomMatrix; +import org.apache.hama.matrix.DenseMatrix; +import org.apache.hama.matrix.SparseMatrix; +import org.apache.log4j.Logger; + +public class TestRandomMatrixMapReduce extends HamaCluster { + static final Logger LOG = Logger.getLogger(TestRandomMatrixMapReduce.class); + + public void testRandomMatrixMapReduce() throws IOException { + DenseMatrix rand = RandomMatrix.random_mapred(conf, 20, 20); + assertEquals(20, rand.getRows()); + assertEquals(20, rand.getColumns()); + + for(int i = 0; i < 20; i++) { + for(int j = 0; j < 20; j++) { + assertTrue(rand.get(i, j) > 0); + } + } + + rand.close(); + + SparseMatrix rand2 = RandomMatrix.random_mapred(conf, 20, 20, 30); + assertEquals(20, rand2.getRows()); + assertEquals(20, rand2.getColumns()); + boolean zeroAppear = false; + for(int i = 0; i < 20; i++) { + for(int j = 0; j < 20; j++) { + if(rand2.get(i, j) == 0.0) + zeroAppear = true; + } + } + assertTrue(zeroAppear); + rand2.close(); + } +}