# Tagged Questions

Questions about Mathematica functionality related to manipulating vector spaces and linear mappings between such spaces. This includes determination of matrix properties, matrix transformations, decompositions, and factoring.

4k views

### How can I improve the speed of eigenvalue decompositions for large matrices?

I often need to compute the eigenvalues of large matrices, and I invariably resort to MATLAB for these, simply because it is much faster. I'd like to change that, so that I can work entirely inside my ...
1k views

5k views

### How to enter matrices in block matrix format?

Example: I have a matrix $R = \left( \begin{array}{cc} A & \mathbf{t} \\ 0 & 1 \end{array} \right)$ where $A$ is 3-by-3 and $\mathbf{t}$ is 3 by 1. Or in Mathematica ...
981 views

### Can (compiled) matrix permanent evaluation be further sped-up?

Update III  Mathematica 10.2.0 now ships with a predefined SystemPermanent function, which the PermanentCode package ...
3k views

### How to symbolically do matrix “Block Inversion”?

Consider a block (partitioned) matrix matrix = ArrayFlatten[{{a, b}, {c, d}}] where, a, b,...
1k views

### Using the Krylov method for Solve: Speeding up a SparseArray calculation

I'm trying to implement this Total Variation Regularized Numerical Differentiation (TVDiff) code in MMA (which I found through this SO answer): essentially I want to differentiate noisy data. The full ...
920 views

### Computing polynomial eigenvalues in Mathematica

MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance in quadratic eigenvalue problems (see here for some applications) such as: (M\...
754 views

### How to determine BLAS/LAPACK implementation used internally for numerical matrix operations?

Is there a command which reveals which implementation of BLAS and LAPACK are used in Mathematica's matrix operations such as Eigensystem? I asked a related question ...
358 views

### How to know the usage of undocumented function like LinearAlgebraBLAS?

BLAS is not documented in mathematica. Using ?LinearAlgebraBLAS* gives But None of the function has a detailed usage information Click any of the ...
496 views

### Sparse Cholesky Decomposition

I am working with square matrices with a special form, which for large rank ($> 100,000$) would be best stored and manipulated as a SparseArray. I believe that ...
716 views

### How get eigenvectors without phase jump?

I'm using Eigenvectors to get the eigenvectors for some matrixes, but the eigenvectors seems to have some phase jump. Here is an example: Say we have a 2 by 2 ...
360 views

### Speedup matrix number multiplication

Consider this simple matrix number multiplication: ...
313 views

### Simple Matrix multiplication takes very long

Bug introduced in 10.1.0 and fixed in 10.3.0 I came across some strange behaviour during a computation involving matrices with symbolic values. It is reproduced below. Multiplying a random 30x30 ...
1k views

### Mathematica for linear algebra course?

I'm taking a linear algebra / matrix theory course and we are free to use any software we want, and will be "expected to use MATLAB or an equivalent" for homework. The professor and textbook (Applied ...
571 views

### Compiling LinearSolve[] or creating a compilable procedural version of it

Earlier today I had a discussion with a representative at Premier Support about the 2 questions I've asked here over the past couple of days: Seeking strategies to deploy a function securely ...
494 views

### Why is MainEvaluate being used when LinearSolve can be compiled?

According to this question LinearSolve can be compiled. However, CompilePrint[] shows a call to ...
1k views

### Higher order SVD

Does anyone know how to do a higher order SVD in Mathematica ? A good reference seems to be here http://www.sandia.gov/~tgkolda/pubs/pubfiles/SAND2007-6702.pdf but I don't understand their formalism ...
639 views

### Decomposing a matrix with polynomial elements into a polynomial with matrix coefficients

Let's say I have a matrix, $\mathbf{M}$, that is polynomially dependent on a single variable, such as M = {{15 + a^2, a + 5 a^2}, {a - 5 a^2, 2}} and I want to ...
1k views

### Constructing a symbolic Hermitian matrix

I need to construct a symbolic Hermitian matrix like m = { { n, a, b, b}, {Conjugate[a], n, b, b}, ... } but I am not able to set ...
2k views

### Find the eigenvector associated with the smallest eigenvalue, not smallest in magnitude

I am trying to find the eigenvector of a $20000 \times 20000$ sparse matrix associated with the smallest eigenvalue. I realized that the smallest eigenvalue might be negative; for example, if the ...
932 views

### Is there a clean way to extract the subspaces invariant under a list of matrices?

Let's say I have some $n \times n$ square matrices $A_1, A_2, \ldots, A_m$ with exact numbers for entries, and I want to find the subspaces of $V = \mathbb{C}^n$ invariant under these matrices. Is ...
739 views

### Space-efficient null space of sparse array

I have a roughly 100,000 × 3,000 matrix (as a SparseArray) that I'd like to find the kernel (null space) of. It has about 500,000 nonzero entries, all -1 or 1. ...
1k views

### Plot Matlab icon

I started to explore this on a whim and hasn't succeeded yet… Some introduction for the icon is found here but I can't understand it very well. (I admit that, though playing with ...
2k views

### Can Eigenvalues[] and Eigenvectors[] be assumed to return the same ordering?

If I do back to back calls of Eigenvalues[] and Eigenvectors[] can these be assumed to order the values and vectors the same, or ...
609 views

### more numerically accurate inverse matrix

I encountered the following matrix mat = {{2, 2.161209223472559 + 1.682941969615793 I}, {2.161209223472559 - 1.682941969615793 I, 2}} and ...
749 views

### What's the most “functional” way to do Cholesky decomposition?

I can do Cholesky in a procedural style, such as: ...
320 views

### $3\times 3 = 6 + \bar{3}$ in Mathematica?

Can Mathematica handle this type of algebra, which is used very frequently in e.g. particle/nuclear physics? That is, I want to decompose a product of representations (in $SU(N)$ say) into irreducible ...
240 views

### Nearest Kronecker Product

Some people (see The ubiquitous Kronecker product by Van Loan) have worked on finding two matrices $\mathbf A$,$\mathbf B$ of specified size whose tensor product $\mathbf A\otimes\mathbf B$ is closest ...
514 views

### Morphological Filtering in 3D to produce skeletons

Context As a follow up of this question and that answer, I would like to identify the special lines separating 3D watersheds. These are useful in the context of astronomy to identify the ...
937 views

### Block Matrix Algebra with Mathematica

I have come up with some BlockMatrix Algebra for Mathematica to make notations easier. I have the following: ...
4k views

### Badly conditioned matrix (General::luc)

With some matrices, I am receiving the following message: ...
2k views

### Eigenvalues and Determinant of a large matrix

Can anybody kindly explain to me what is going wrong regarding a simple problem I have? I can find the eigenvalues of a large matrix using Eigenvalues[], but when I ...
713 views

### What type of solver does Mathematica use in LinearSolve

I have a question regarding linear equation solvers. For a specific 9-diagonal matrix, every method I tried in C++ (Gaus, GCC, BICGTAB) didn't work (even though they worked for other matrices). But in ...
809 views

### Toggle visibility of elements in a plot

I have three simple graphs in one Plot. Now I am trying to make a button for each graph so you can hide or show it in the plot. Until now I was just able to make a checkbox with the Manipulate ...
1k views

### Correcting a correlation matrix to be positive semidefinite

Does Mathematica have a way to "fix" a correlation matrix that is not positive semi-definite? I looked through the documentation and search the internet but could not find anything.
2k views

### Has Mathematica a function to compute the Smith Normal Form?

The Smith normal form is a matrix that can be calculated for any matrix (not necessarily square) with integer entries. See Wikipedia for a more elaborate description. Has Mathematica a function to ...
3k views

### Axis/Angle from rotation matrix

With r=RotationMatrix[a,{x,y,z}] I can compute a 3D rotation matrix from axis/angle representation. Given a 3D rotation matrix r...
402 views

### Expressing the n-th power of a matrix [duplicate]

My matrix is $\qquad A= \begin{pmatrix} {1} & {2} & {3}\\ {4} & {1} & {0}\\ {0} & {5} & {4} \end{pmatrix}$ I need $\qquad A^n$ I tried ...
1k views

### Find Determinant/or Row Reduce parameter dependent matrix

I'm trying to find the determinant of a band diagonal matrix that has a parameter, $\kappa$, in some of the entries. Some entries are just numerical ones, others ($\kappa$ X number), while others are ...
979 views

### What is the fastest way to find an integer-valued row echelon form for a matrix with integer entries?

Let me begin by saying that this is my first post on StackExchange. I apologize in advance if I unwittingly break any of its unwritten rules of etiquette. Recently, I've been trying to understand an ...
317 views

### How can I compute the representation matrices of a point group under given basis functions?

Take the $C_{3v}$ point group for example: ...
874 views

### Is there a built-in procedure for simultaneous diagonalization of a set of commuting matrices?

Given a set $\{A_1,...,A_m\}$ of $m$ commuting $N\times N$ diagonalizable matrices, it is known that there exists a basis of eigenvectors $\Lambda$ that simultaneously diagonalizes all the $A_i$. Is ...
409 views

### Is it possible to implement symbolic sub matrices?

The accepted answer in the question Symbolic matrices in Mathematica with unknown dimensions provides a functionality to create symbolic matrices which behave pretty much as the name suggests. However,...
267 views

### LinearSolve and Krylov Method options

I need to solve a large, sparse, linear system. At some point Method -> "Multifrontal" fails and a bit later also "Pardiso" ...
254 views

### Analytic determinant of a sparse 25x25 matrix?

I would like to compute the analytic determinant of the following sparse matrix ...
1k views

### How to estimate the matrix condition number in the 2-Norm?

The Mathematica documentation says it is possible to estimate the matrix condition number in norms 1, 2, and ∞. But the 2-norm raises a message. This is an extract from reference documentation "...
I have to fill a 4D array, whose entries are $\mathrm{sinc}\left[j(a-b)^2+j(c-d)^2-\phi\right]$ for a fixed value of $\phi$ (normally -15) and a fixed value of $j$ (normally about 0.00005). The way I'...