How to use the simdkalman.primitives.ddot function in simdkalman

To help you get started, we’ve selected a few simdkalman examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github oseiskar / simdkalman / tests / testsuite.py View on Github external
def test_ddot(self):

        vec = lambda *args: np.array(args)[np.newaxis,:,np.newaxis]
        self.assertMatrixEqual(vec(1,2,3), np.array([[[1],[2],[3]]]))

        self.assertMatrixEqual(\
            primitives.ddot(np.diag([1,-1,0])[np.newaxis,...], vec(1,2,3)), \
            vec(1,-2,0))

        stack_mats = lambda *args: np.vstack([a[np.newaxis,...] for a in args])
        self.assertMatrixEqual(stack_mats(np.eye(2), np.eye(2)*3)[0,...], np.eye(2))

        self.assertMatrixEqual( \
            primitives.ddot( \
                stack_mats(np.eye(2)*1, np.array([[2,0],[1,1]]), np.eye(2)*3), \
                np.vstack([vec(1,2), vec(3,4), vec(5,6)])), \
            np.vstack([vec(1,2), vec(6, 7), vec(15, 18)]))
github oseiskar / simdkalman / tests / testsuite.py View on Github external
def test_ddot(self):

        vec = lambda *args: np.array(args)[np.newaxis,:,np.newaxis]
        self.assertMatrixEqual(vec(1,2,3), np.array([[[1],[2],[3]]]))

        self.assertMatrixEqual(\
            primitives.ddot(np.diag([1,-1,0])[np.newaxis,...], vec(1,2,3)), \
            vec(1,-2,0))

        stack_mats = lambda *args: np.vstack([a[np.newaxis,...] for a in args])
        self.assertMatrixEqual(stack_mats(np.eye(2), np.eye(2)*3)[0,...], np.eye(2))

        self.assertMatrixEqual( \
            primitives.ddot( \
                stack_mats(np.eye(2)*1, np.array([[2,0],[1,1]]), np.eye(2)*3), \
                np.vstack([vec(1,2), vec(3,4), vec(5,6)])), \
            np.vstack([vec(1,2), vec(6, 7), vec(15, 18)]))