matrix

Why do I get a segmentation fault (core dumped) when I try to allocate a 4D array?

I'm trying to allocate a large 4D matrix but I want to do it dynamically. When I just create the static matrix everything works fine so I know I have enough memory for now. However when I try and implement the same thing dynamically it breaks whenever I enter the third dimension and I need to get to a fourth! Can anyone tell me why th...

Transforming matrix diagonals to ragged array?

I'm trying to come up with a non brute-force solution to the following problem. Given a matrix of arbitrary size: [6 0 3 5] [3 7 1 4] [1 4 8 2] [0 2 5 9] Transform its diagonals to a list of vectors, like so: (0) (1, 2) (3, 4, 5) (6, 7, 8, 9) (0, 1, 2) (3, 4) (5) (Working from bottom left to top right in this example) ...

Matrix Munging (with import and export to CSV file)

Here's a (simplification of a) task I do a lot: 1) Import a CSV file like the following: 1, cat, 10, junk 2, dog, 20, junk 3, mouse, 30, junk 2) Remove the fourth column and replace it with twice the third column. 3) Insert a new column that is half the third column. 4) Export to to CSV, ie: 1, cat, 5, 10, 20 ...

Linear algebra library for the D programming language.

I'm looking for a package to do matrix math with matrices of up to about 100 x 100. I need to, at a minimum, do inverses, multiplication and transposition. I'd prefer a more encapsulated interface over higher performance. ...

Handle large data structure in Java

Hi, I'm working on a Java application that needs working on very large matrices. For example multiplying two 10 million * 10 million matrices! Of course the Java heap does not have enough space even for storing one of these matrices. What should I do? Should I use databases to store my matrices and bring to memory every needed part and ...

How can I cluster a graph in Python?

Let G be a graph. So G is a set of nodes and set of links. I need to find a fast way to partition the graph. The graph I am now working has only 120*160 nodes, but I might soon be working on an equivalent problem, in another context (not medicine, but website development), with millions of nodes. So, what I did was to store all the lin...

Mapping a matrix in a binary file into perl

Hi I have a 14Mb file with a matrix, in raw binary format. I would like to slurp it and have something like an array of arrays, so I can read some values. I was hoping to find some magical perl module that would, given the size of the matrix, do all the work for me :) But I can't find it, and I suspect I'm just missing a more obvious ...

Matrices in LaTeX: Row and Column Labelling

So, I have an example matrix here: \[ \begin{pmatrix} t & 1-t & -1 & 0 & 0 \\ 0 & t & 1-t & -1 & 0 \\ 0 & 0 & t & 1-t & -1 \\ -1 & 0 & 0 & t & 1-t \\ 1-t & -1 & 0 & 0 & t \end{pmatrix} \] I wish to add labels to the columns and rows (such as a, b, c, d and the like) which go above and to the left (bot...

skew matrix algorithm

I'm looking for skew algorithm, just like on photoshop, edit->transform->skew is there any simple matrix which could do that? what I've seen so far was basic skew matrix (shear) but its lack of control point, doesn't like on photoshop which have at least 4 points on each corner of rectangle and we can move each control point freely. I ...

Report Matrix filler

I have a matix in my report (VS2005) i would like the matrix to display a default of 12 rows even if no data is available. i have not figured out how to do this so i create a group of rectangles below the grid and each row of these rectangles has is visibility changed based on the row count in the matrix. the problem with this is that t...

2D matrix and overloading operator() / ugly syntax

I'm using a 2D matrix in one of my projects. It's something like it is suggested at C++ FAQ Lite. The neat thing is that you can use it like this: int main() { Matrix m(10,10); m(5,8) = 106.15; std::cout << m(5,8); ... } Now, I have a graph composed of vertices and each vertex has a public (just for simplicity of the example)...

What's the most efficient/elegant way to delete elements from a matrix in MATLAB?

I want to delete several specific values from a matrix (if they exist). It is highly probable that there are multiple copies of the values in the matrix. For example, consider an N-by-2 matrix intersections. If the pairs of values [a b] and [c d] exist as rows in that matrix, I want to delete them. Let's say I want to delete rows like ...

Why is 24.0000 not equal to 24.0000 in Matlab?

I've written a program in which it is necessary to delete some points from a matrix if they exist. sometimes, there are more than one copy of them in the matrix. But the problem is that when it comes to check whether those points are in the matrix , matlab can't recognize them in the matrix although thery are exist. Let's begin from the...

Direct3D & iPhone Accelerometer Matrix

Hi All, I am using a WinSock connection to get the accelerometer info off and iPhone and into a Direct3D application. I have modified Apples GLGravity's sample code to get my helicopter moving in relation to gravity, however I need to "cap" the movement so the helicopter can't fly upside down! I have tried to limit the output of the acc...

SQL Reporting: Matrix Columns Merge

Hi I have data being returned and I put it in a matrix. I have my rows set and my columns set. I only have one column entitled "GTA" and a few rows. My data is coming out like this for some reason. GTA GTA GTA Answer ======================== 1 1 1 2 1 1 1 ...

Help writing simple java graphics library with scan conversion; phong shading

Hey guys. I've been having some trouble putting together a Java-based graphics pipeline for my Intro to Computer Graphics course. As it stands right now, I just need to get the northern hemisphere of a sphere (with north facing the user) printed, and throw some lights at it. This is the pipeline (might be some errors...) 1) Initializ...

How expensive is it to compute the eigenvalues of a matrix?

How expensive is it to compute the eigenvalues of a matrix? What is the complexity of the best algorithms? How long might it take in practice if I have a 1000x1000 matrix? I assume it helps if the matrix is sparse? Are there any cases where the eigenvalue computation would not terminate? In R, I can compute the eigenvalues as in t...

Matrices in python

Yesterday I had the need for a matrix type in python. Apparently, a trivial answer to this need would be to use numpy.matrix(), but the additional issue I have is that I would like a matrix to store arbitrary values with mixed types, similarly to a list. numpy.matrix does not perform this. An example is >>> numpy.matrix([[1,2,3],[4,"5"...

generate all 3*3 two dimentional arrays

how would i write a function in java that generates all the 3*3 multidimensional arrays such that every number between 1...9 only appears once? thanks! ...

How would you describe DSM in simple terms?

How would you describe DSM in simple terms? ...