# routines for multiplying matrices

from __future__ import print_function

import numpy

def mult_Ax(A, x):
    """ return the product of matrix A and vector x: Ax = b """

    # x is a vector
    if not x.ndim == 1:
        print("ERROR: x should be a vector")
        return None

    N = len(x)

    # A is square, with each dimension of length N
    if not A.shape == (N, N):
        print("ERROR: A should be square with each dim of same length as x")
        return None

    # allocation the product array
    b = numpy.zeros((N), dtype=A.dtype)

    # each row of b is the product of the like row of A dotted with
    # the vector x
    for i in range(N):
        b[i] = numpy.dot(A[i,:], x)

    return b


2430d824f20c0fe2ad1789b9aeb51fe8a124c3e7
<mask token>

<mask token>


def mult_Ax(A, x):
    """ return the product of matrix A and vector x: Ax = b """
    if not x.ndim == 1:
        print('ERROR: x should be a vector')
        return None
    N = len(x)
    if not A.shape == (N, N):
        print('ERROR: A should be square with each dim of same length as x')
        return None
    b = numpy.zeros(N, dtype=A.dtype)
    for i in range(N):
        b[i] = numpy.dot(A[i, :], x)
    return b

from __future__ import print_function
import numpy


def mult_Ax(A, x):
    """ return the product of matrix A and vector x: Ax = b """
    if not x.ndim == 1:
        print('ERROR: x should be a vector')
        return None
    N = len(x)
    if not A.shape == (N, N):
        print('ERROR: A should be square with each dim of same length as x')
        return None
    b = numpy.zeros(N, dtype=A.dtype)
    for i in range(N):
        b[i] = numpy.dot(A[i, :], x)
    return b

# routines for multiplying matrices

from __future__ import print_function

import numpy

def mult_Ax(A, x):
    """ return the product of matrix A and vector x: Ax = b """

    # x is a vector
    if not x.ndim == 1:
        print("ERROR: x should be a vector")
        return None

    N = len(x)

    # A is square, with each dimension of length N
    if not A.shape == (N, N):
        print("ERROR: A should be square with each dim of same length as x")
        return None

    # allocation the product array
    b = numpy.zeros((N), dtype=A.dtype)

    # each row of b is the product of the like row of A dotted with
    # the vector x
    for i in range(N):
        b[i] = numpy.dot(A[i,:], x)

    return b

