|
I want to achieve the following:
Have a AxBxC matrix (where A,B,C are integers). Access that matrix not as matrix[a, b, c] but as matrix[(a, b), c], this is, I have two variables, var1 = (x, y) and var2 = z and want access my matrix as matrix[var1, var...
Started by devoured elysium on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If var1 = (x,y) , and var2 = z , you can use
matrix[var1][var2]
I think you can simply subclass the NumPy matrix type, with a new class of your own; and overload the __getitem__() nethod to accept.
|
|
Suppose I have an AxBxC matrix X and a BxD matrix Y .
Is there a non-loop method by which I can multiply each of the C AxB matrices with Y ?
Started by Jacob on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
You....
Big matrix Z = reshape(reshape(permute(X, [2 1 3]), [A B*C]), [B A*C])' * Y; %'# split into third) = ZZ(7:8, :);
So you can see it only requires one matrix multiplication, but you have to reshape the matrix before and after.
|
|
Suppose I have a integer matrix which represents who has emailed whom and how many times. For social network analysis I'd like to make a simple undirected graph. So I need to convert the matrix to binary matrix and later into a list of tuples.
My question...
Started by speciousfool on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
You can do the following:
>>>.
[EDIT] Cudos to speciousfool :
If x is your matrix then scipy.sign(x) gives you the binary matrix.
Apply the scipy.sign function to every cell in the matrix.
|
Ask your Facebook Friends
|
I want to model a purification of the Petri Network. And i was given the suggestion to use a matrix which is allocated dynamically. After thinking about the problem i came up with a different approach like so:
A static matrix of n transitions and p locations...
Started by Cristina on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
A dynamically allocated matrix is better:
can be resized to suit the input dimensions you pay only.
|
|
I need some help in converting a 2X2 matrix to a 4X4 matrix in the following manner:
A = [2 6; 8 4]
should become:
B = [2 2 6 6; 2 2 6 6; 8 8 4 4; 8 8 4 4]
How would I do this?
Started by anubhav on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
Solution:
A = [2 6; 8 4]; B = A([1 1 2 2], [1 1 2 2]);
A = [2 6; 8 4]; % arbitrary 2x2 input matrix B.
|
|
I'm trying to inverse a matrix with version Boost boost_1_37_0 and MTL mtl4-alpha-1-r6418. I can't seem to locate the matrix inversion code. I've googled for examples and they seem to reference lu.h that seems to be missing in the above release(s). Any...
Started by kenny on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Rather, it....
Says you need lu.h, somehow:
How do I invert a matrix?
The first question you should ask yourself is whether you want to really compute the inverse of a matrix or if you really want to solve a linear the matrix inverse.
|
|
Hello,
Unfortunately I haven't much experience in C++ and I'm trying to progress myself in C++.
Firstly,I defined array of arrays so that I formed an 3x3 matrix:
array< array< double >^ >^ input = gcnew array< array< double >^ >...
Started by yalcin on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
There is not built....
Look at Simple 3x3 matrix inverse code (C++) .
There are no functions in C++ to make matrix operations, you'll need to find some library to do a wrapper function around an available Fortran or C or C++ implementation.
|
|
I have a 3d matrix ( n-by-m-by-t ) in MATLAB representing n-by-m measurements in a grid over a period of time. I would like to have a 2d matrix, where the spatial information is gone and only n*m measurements over time t are left (ie: n*m-by-t )
How can...
Started by Peter Smit on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
This is equivalent to the form
B=reshape(A,[],1);.
You need the command reshape :
Say your initial matrix is (just for me to get some data):
a=rand = A(:);
to create a vector directly from a matrix.
|
|
If I do positionVector*worldMatrix the position is transformed into world space. But what happens if I do it the other way around (worldMatrix*positionVector) in terms of 3d space?
I noticed the result is different to the first one. I already googled ...
Started by codymanix on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
In terms of 3D it, but it is beyond my understanding ... .
Incidentally, doing the one is the same as doing the other after transposing the matrix.
In vector*matrix.
In matrix*vector, your vector will be interpreted as a column vector.
|
|
Given a large sparse matrix (say 10k+ by 1M+) I need to find a subset, not necessarily continuous, of the rows and columns that form a dense matrix (all non-zero elements). I want this sub matrix to be as large as possible (not the largest sum, but the...
Started by BCS on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You don....
Is your intent to write your own?
Maybe the 1D approach run of column indexes that I could .
D sub-matrix with the highest sum of brightness values, where "Brightness" was measured matrix libraries might have ways to handle it.
|