Looked inside Awesome config, it is funny:
-- Standard awesome library
require("awful")
require("beautiful")
-- Standard awesome library
require("awful")
require("beautiful")
import numpy as np
from scitools.numpyutils import meshgrid
h = 0.1
L = H = 1.
x = np.arange(0, L, h)
y = np.arange(0, H, h)
u_analytical = lambda x, y: 2*x + np.exp(y)
u1 = np.zeros( (len(x), len(y) ) )
for i, x_val in enumerate( x ):
for j, y_val in enumerate( y ):
u1[i][j] = u_analytical(x_val, y_val)
(xx, yy) = meshgrid(x, y, sparse=False, indexing='ij')
u1_ = u_analytical(xx, yy)
Each sparse format has certain advantages and disadvantages. For instance, adding new non-zero entries to a lil_matrix is fast, however changing the sparsity pattern of a csr_matrix requires a significant amount of work. On the other hand, operations such as matrix-vector multiplication and matrix-matrix arithmetic are much faster with csr_matrix than lil_matrix. A good strategy is to construct matrices using one format and then convert them to another that is better suited for efficient computation.It is not very hard to choose correct sparse matrix format, especially in numerical computations, where in most cases you know all valuable information about your matrix before computation.