# Tag Info

### How to check if a vector is an eigenvector of a matrix using mathematica?

You could use MatrixRank. Here is a function that does this: ...
Accepted

### How to show matrix multiplication step by step?

If you have Mathematica 10 you can use the new Inactive functionality ...

### How to subtract the column means from each row of a matrix?

It is there: Standardize[mat, Mean, 1 &]
Accepted

### Add a vector to a list of vectors

I recommend using Transpose twice since it is more efficient than other approaches. Moreover Plus has the ...
Accepted

### How get eigenvectors without phase jump?

The phase (and length) of the eigenvectors is completely undetermined unless you specify extra conditions in addition to the eigenvalue equation. Given that you don't have any additional conditions, ...

### How do you concatenate matrices? And how do you make block matrices?

As Daniel Lichtblau suggested in the comment, ArrayFlatten is the way. ArrayFlatten[{{A1, A2}}] // MatrixForm gives your ...
Accepted

### Speeding up generation of block diagonal matrix

You are right, it can be done in a fraction of second. One can explicitly construct an array of indexes ...
Accepted

### Longest path in 0/1 matrix

As I expressed in my comment above, it is possible (and easy) to use the image processing functions for this. Taking m to be the matrix above the following steps ...
Accepted

### Speed up Do loops in MMA 13.0

Here's the fastest I've found: ...
Accepted

### How to speed up RotationMatrix?

Having this problem so often, I also generated some tools to handle it which I'd like to share. This is the code (along with a usage message which is basically a small modification of ...

### How to subtract the column means from each row of a matrix?

Well, transposing, subtracting, transposing... Transpose[Transpose[mat] - Mean[mat]]
Accepted

### How to interpret the results of PCA

I generated a multivariate data set to play with called fakedata (see at the bottom of the post). This contains five groups of samples, each in 25-replicate. Each ...
Accepted

### How do I create a triangulated surface from points?

It turns out ListSurfacePlot3D does a terribly poor job of approximating the surface in the OP, otherwise one will just apply ...
Accepted

### Nearest Kronecker Product

The Pitsianis-Van Loan algorithm turns out to be surprisingly easy to implement in Mathematica: ...
Accepted

### How to subtract the column means from each row of a matrix?

mat - ConstantArray[Mean[mat], 3] or more generally: mat - ConstantArray[Mean[mat], Length[mat]]

### How to roll a graph on the y-axis

We calculate the tangent vector of parametric curve {t^2,t} and the ArcLength from 0 to <...

### The magic square function

@Nasser's answer is nice, but slowly when Mod[n,4]==0. Here is a faster code, efficiency is close to Matlab : ...
Accepted

### How can I reproduce the result of PrincipalComponents

I vastly prefer the formulation in terms of the singular value decomposition (SVD). This question gets asked a lot by users of these functions, so here's a quick reference: ...

### What are the counterparts in Wolfram to left and right division of a matrix in other programming language, e.g. Julia and MATLAB?

I just stumbled upon it! At least when storing the factorization in a LinearSolveFunction object, we can use it for the transposed solve by supplying a further (not ...
Accepted

### Efficiently defining a SparseArray function

The way the code is written, you can neither exploit packed arrays nor any vectorization. There are two major reasons: Using Rule prevents using packed arrays ...
Accepted

### Can someone boost even more my code?

Exploitation of low rank structure The ordering of summation/dot products is crucial here. As aooiiii pointed out, mat2 has a low-rank tensor product structure. So ...
Accepted

...

### Replace interior of matrix with zeros

You can do: x[[2 ;; -2, 2 ;; -2]] = 0; x or ...

### Why is calling Dot with many arguments so inefficient?

Here's an edited version of my answer to a related question (elsewhere). Since your central question was about speed (or time complexity), you might wish to know an important result from elementary ...
Accepted

### Sparse Cholesky Decomposition

LinearSolve[] actually computes a permuted Cholesky decomposition; that is, it performs the decomposition $\mathbf P^\top\mathbf A\mathbf P=\mathbf G^\top\mathbf G$....

### What are the counterparts in Wolfram to left and right division of a matrix in other programming language, e.g. Julia and MATLAB?

The documentation for MATLAB's mrdivide states that The operators / and \ are related to each other by the equation B/A = (A'\B')' In light of this we may ...