|
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 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.
|
|
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.
|
Ask your Facebook Friends
|
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.
|
|
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.
|
|
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.
|
|
Take the following code:
foo <- list() foo[[1]] <- list(a=1, b=2) foo[[2]] <- list(a=11, b=22) foo[[3]] <- list(a=111, b=222) result <- do.call(rbind, foo) result[,'a']
In this case, result[,'a'] shows a list. Is there a more elegant way...
Started by andrewj on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
One possible solution is as follows (but am interested in alternatives):
new.result <- matrix.
|
|
On Thu, 25 Dec 2008 22:00:17 +0100, Gottfried Helms <helms@uni-kassel.de
Hi - just found -by accident- examples, meant to support the
definition
matrix^matrix = exp( log(matrix)*matrix) (1)
instead of
= exp( matrix...
Started by Gottfried Helms on
, 12 posts
by 3 people.
Answer Snippets (Read the full thread at omgili):
The last relation can even be extended to the "ZETA"-matrix,
which appears when the *non*-alternating geometric series of P
is considered
for the ZETA-matrix which contains ZETA-values....
Of E related by the "eigenvector-like"-matrix W.
|
|
Hello!
I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main...
Started by IQue on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
Write....
You need to free each row individually:
void free_matrix(int **matrix, int size_x) { for(int i = 0; i < size_x; i++) free(matrix[i]); free(matrix); }
You only freed the first row (or column) of first_matrix.
|