# Questions tagged [matrix]

In mathematics, a matrix (plural matrices) is a rectangular array of numbers, symbols, or expressions, arranged in rows and columns. The individual items in a matrix are called its elements or entries.

33,610 questions
Filter by
Sorted by
Tagged with
6 views

### Generating Correlated Random Samples

I read this tutorial http://scipy-cookbook.readthedocs.io/items/CorrelatedRandomSamples.html on how to get a matrix C so that C*C^T = R, with R being a given covariance matrix. The code example ...
15 views

### Why is 'scipy.sparse.linalg.spilu' less efficient than 'scipy.linalg.lu' for sparse matrix?

I posted this question on http://scicomp.stackexchange.com, but received no attention. As long as I get answer in one of them, I will inform in the other. I have a matrix B which is sparse and try ...
16 views

### fast computation of matrix trace norm in R

I have a square symmetric real matrix S of dimension 31. I want to compute its trace (nuclear) norm, Frobenius (Hilbert--Schmidt) norm and operator (spectral) norm. I am using eigen: x <- eigen(...
7 views

### Find the reflection transformation matrix between two cloud points

I have two 3D cloud points (that i am sure they are mirrored) and I need to find the reflection transformation matrix. Using SVD algorithm, i am able to find a transformation matrix T, but it is not a ...
13 views

### What cause the “Poly object has no attribute 'expand' ” error?

I have a 4x4 sympy matrix of polynomials: S = Matrix([[Poly(alpha**4 + alpha**3, alpha, modulus=2), Poly(alpha**4 + alpha**3 + alpha + 1, alpha, modulus=2),Poly(alpha**3 + alpha**2 + alpha, alpha, ...
24 views

### How would I find the top 10 values of a row every 100 values?

So I have a 1 x 7000 matrix and I am wanting to to find the top 10 values of for every 100th 'sample' group of values, and replace all other values with a zero. I have a code that works for finding ...
14 views

### How to construct matrix from idx and idy in R? [duplicate]

I have a dataset be like this: idx idy value 1 1 137959 1 2 1 71936 1 3 1 351198 1 4 1 484804 1 5 1 470068 1 6 1 294349 1 7 1 410560 1 8 1 ...
48 views

### Question about the difference between Integer triple pointer and float triple pointer

I'm doing a project for school and they force us to use a type float triple pointer in a function that multiply two matrices, and for the last day i can't figure out why when I'm using int triple ...
5 views

### Fastest implementation to convert a matrix to LAPACK

I have a function that converts a matrix to what LAPACK routines in SciPy requires. The function is def convert_matrix_lapack(Amat,out): for ii in range(Nz): out[(2*Nz-2-ii):(3*Nz-...
54 views

### Minimization problem with linking constraints in R

How should I incorporate the linking constraints into the optimization problem formulation in equations 1 - 4 where Y_i's are binary variables? minimize 22X11 + 20.5X12 + 21X13 + 19X14 + 21X21 + ...
13 views

### Convert multiple columned dataframe to 3D matrix in R

I have a dataframe similar to the one below: trial Card1_colour Card1_number Card1_shape Card2_colour Card2_number Card2_shape ...... 1 1 1 0 0 1 ...
44 views

### Matrix Multiplication doesn't work for inner dimensions greater than outer in C

I am writing a code to multiply matrices of any dimensions. I noticed it works fine for square matrices as well as when the outer dimensions are greater than inner. However, I can't get it to work for ...
22 views

### create matrix with columns populated from vector values and row names from a different vector values

i have this data... df <-structure(list(year = c(2017L, 2014L, 2012L, 2014L, 2014L), NODCCODE = c(110040218L, 121053801L, 170281801L, 170281801L, 170281801L), ...