Linked Questions

2
votes
3answers
178 views

How to remove extra levels in list [duplicate]

My question is how to turn a 4-level matrix (notice one extra level) A = {{{{1, 2, 3}, {4, 5, 6}}}, {{{7, 8, 9}, {10, 11, 12}}}}; into the following: ...
0
votes
1answer
143 views

How to understand the extensional usage of Flatten? [duplicate]

Recently, I have been reading Mathematica program that written by many advanced Mathematica user, like Mr.Wizard, J.M., Kuba,etc to improve my programming capacity In the On generalizing Partition[] (...
23
votes
7answers
2k views

Equating matrices (or higher order tensors) element-wise

Say I have two matrices (or, as in my case, higher order tensors) $A,B$, and I want to solve the equation $A=B$. To do so , I need a list of equations that equate entry-wise the elements of $A$ and $B$...
35
votes
2answers
2k views

Transpose uneven lists

Is there a quick method to transpose uneven lists without conditionals? With: Drop[Table[q, {10}], #] & /@ Range[10] Thus the first list would have the ...
25
votes
6answers
7k views

Best way to create symmetric matrices

From time to time I need to generate symmetric matrices with relatively expensive cost of element evaluation. Most frequently these are Gram matrices where elements are $L_2$ dot products. Here are ...
17
votes
5answers
3k views

Ways to compute inner products of tensors

One way to evaluate the following sums is combining Table and Sum: $u_{abcd} = \sum_{e=1}^3 v_{aeb}w_{ced}$ $q_{ab} = \sum_{d,e=1}^3 v_{d e a}w_{deb}$ It will look like ...
8
votes
4answers
846 views

Prepend 0 to sublists

My question is similar to this one, but my goal is to prepend a single 0 the each sublist, not incrementally many 0's. The file I'm working is a CSV containing around 50K sublists of length 35. I've ...
26
votes
1answer
1k views

Using Transpose with a list as the second argument

I'm having difficulty understanding the Transpose function. I know what the transpose of a matrix is, not a problem, and I see that applying the ...
11
votes
2answers
6k views

How to get MATLAB data imported with the same dimensions?

I have some MATLAB image data with the following dimensions (output is from MATLAB): >> size(im) ans = 86 86 3 45 The data imports just fine ...
11
votes
3answers
292 views

Most efficient way to build block / banded SparseArray

I have a matrix that I generate with a procedure that looks like this: ...
10
votes
5answers
295 views

Transpose two uneven lists [duplicate]

I am trying to plot two lists using the ListPlot command. I need to merge two lists. The two lists I have are: ...
6
votes
5answers
362 views

Part of the nested lists

Suppose I have a nested list where sublists have unequal length. How can I extract all values of the list at specific level ignoring errors if the value at that level doesn't exist. For example: <...
12
votes
3answers
288 views

Riffle two matrices COLUMNWISE; where boh matices have the same number of rows

I need to "riffle" two matrices; COLUMNWISE. Say that we have: ...
-5
votes
5answers
829 views

Translating MATLAB's cell2mat into Mathematica

How I can define a function in Mathematica such that it acts same as the cell2mat command in MATLAB? Example (in MATLAB): ...
10
votes
3answers
973 views

How to build a matrix from a set of vectors and other matrices using ArrayFlatten

I want to build a 6 by 3 matrix, from the following: one vector is 3 by 1, then a matrix, which is 3 by 2. These will go to the top 3 rows. Now the bottom 3 rows, I'll have 3 vectors each is 3 by 1. ...

15 30 50 per page