예제 #1
0
    def test_apply_scale( self ):
        vec = numpy.array( [ 2.0, 2.0, 2.0 ] )
        scale = numpy.array( [ 10.0, 2.0, 1.0 ] )
        result = matrix.apply_scale( vec, scale )

        self.assertTrue(
            numpy.array_equal( result, vec * scale ),
            "Apply scale incorrect"
            )
예제 #2
0
    def test_batch_apply_scale( self ):
        vecs = numpy.array(
            [
                [ 2.0, 2.0, 2.0 ],
                [ 4.0, 4.0, 4.0 ],
                [ 1.5,10.0,-4.0 ],
                [ 0.0, 0.0, 0.0 ],
                ]
            )
        scale = numpy.array( [ 10.0, 2.0, 1.0 ] )
        result = matrix.apply_scale( vecs, scale )

        self.assertTrue(
            numpy.array_equal( result, vecs * scale ),
            "Batch apply scale incorrect"
            )