Camiba – Linear Algebra

This module provides some routines, which are mostly related to concepts from linear algebra, since they produce or manipulate matrices.

Basic

This module aims at making work with some more specific and but still generally applicable stuff way easier.

camiba.linalg.basic.H(X)[source]

Return the Hermitian transpose of X

camiba.linalg.basic.aB(a)[source]

Convert a Zero-One-Vector t a Boolean Vector

camiba.linalg.basic.arrayToString(x)[source]

Convert a numpy array to a string

camiba.linalg.basic.coh(X)[source]

Self-Coherence of a matrix X

camiba.linalg.basic.hard_thrshld(arr_x, num_k)[source]
Hard Thresholding
Parameters:

arr_x : ndarray

vector to threshold

num_k : int

thresholding parameter

Returns:

ndarray

thresholded vector

camiba.linalg.basic.has_supp_size(x, s)[source]

checks if a vector has a certain support size

camiba.linalg.basic.khatri_rao(X, Y)[source]

Calculate columnwise Kronecker Product

This is also known as the Khatri-Rao product.

camiba.linalg.basic.mut_coh(X, Y)[source]

Mutual Coherence of Two Matrices

camiba.linalg.basic.normGram(X)[source]

Calculate the Normalized Gram Matrix

camiba.linalg.basic.proj_sphere(X)[source]
Project columns of X onto the unit sphere

This method takes a two-dimensional (real or complex) array X and projects the columns onto the unit sphere.

It is very useful, if multiple vectors of the same size have to be normalized.

camiba.linalg.basic.same_supp(x1, x2)[source]

Check if two vectors have the same support

camiba.linalg.basic.sampleRIP(mat_X)[source]
Lower RIP-Constant bound

For a given matrix, we randomly sample vectors on the unit sphere and try to approximate the RIP-constant based on the distortion X applies to the sampled vector.

camiba.linalg.basic.soft_thrshld(arr_x, num_alpha)[source]
Soft Thresholding
Parameters:

arr_x : ndarray

vector to threshold

num_k : int

thresholding parameter

Returns:

ndarray

thresholded vector

Packings

implements an iterative algorithm for finding unstructured measurement matrices. works for complex and real valued matrices. Here we are minimizing a certain potential function induced by the points on the sphere, thus they repell each other

camiba.linalg.pack.draw(num_n, num_m, num_eps, num_h)[source]

applies the potential minimizing algorithm for given configuration size num_n x num_m. another stopping criterion has to be supplied together with a step length

camiba.linalg.pack.drawBuffer(num_n, num_m, num_eps, num_h, str_p)[source]

generate a matrix by minimizing a potential with dimension num_n x num_m and store it to str_path. it gets regenerated if specified dimensions changed

camiba.linalg.pack.drawBufferComplex(num_n, num_m, num_eps, num_h, str_p)[source]

generate a complex valued matrix by minimizing a potential with dimension num_n x num_m and store it to str_path. it gets regenerated if specified dimensions changed

camiba.linalg.pack.drawComplex(num_n, num_m, num_eps, num_h)[source]

applies the potential minimizing algorithm for given complex configuration size num_n x num_m. another stopping criterion has to be supplied together with a step length

camiba.linalg.pack.drawComplexSeed(mat_X, num_eps, num_h, steps=0)[source]

applies the potential minimizing algorithm for a given initial complex configuration mat_X a given amount of steps. another stopping criterion has to be supplied together with a step length

camiba.linalg.pack.drawSeed(mat_X, eps, h, steps=0)[source]

applies the potential minimizing algorithm for a given initial configuration mat_X a given amount of steps. another stopping criterion has to be supplied together with a step length

camiba.linalg.pack.drawTwo(num_m, num_N, num_eps, num_h, num_max_steps=0)[source]
camiba.linalg.pack.sq_sum(x)[source]

speeds up norm calculation – real case

camiba.linalg.pack.sq_sum_c(x)[source]

speeds up norm calculation – complex case

Vandermonde Matrices

camiba.linalg.vand.build(arr_z, num_n)[source]

build a vandermonde matrix with specified first row arr_z and height num_n

camiba.linalg.vand.opt_c(num_n, num_m, num_tries, num_samples, str_path)[source]

generate an approximately optimal parameter c for the pack routine for a vandermonde matrix of size num_n x num_m and store it into a table at location str_path. num_Tries and num_Samples specify how many samples we take for directional random search.

camiba.linalg.vand.pack(num_n, num_m, num_c1)[source]

apply the special packing pattern for the first row to generate a vandermonde matrix with (pretty) low coherence

Multilevel Matrices

camiba.linalg.multilevel.Toep(tenU, verbose=False)[source]
Construct a Hermitian Multilevel Toeplitz Matrix
Parameters:

tenU : ndarray

The tensor, which describes the multilevel Toeplitz matrix

verbose :

Verbosity Flag

Returns:

ndarray

The constructed matrix as 2D ndarray

camiba.linalg.multilevel.ToepAdj(arrD, mat_A, verbose=False)[source]
Calculate the Adjoint Operator of <T,A>
Parameters:

arrD : ndarray

The sizes of the levels in the current iteration

tenU : ndarray

The tensor, in the current iteration

verbose :

Verbosity Flag

Returns:

ndarray

The constructed (sub)matrix as 2D ndarray