matrix

converting a dataset into matrix then the same matrix to array

Just take any dataset and convert the dataset into matrix. And convert the matrix into array formate in vb.net ...

How does OS handle a python dict that's larger than memory?

I have a python program that is going to eat a lot of memory, primarily in a dict. This dict will be responsible for assigning a unique integer value to a very large set of keys. As I am working with large matrices, I need a key-to-index correspondence that can also be recovered from (i.e., once matrix computations are complete, I need...

MATLAB: Filling a matrix with each column being the same

I am trying to create a matrix that is 3 x n, with each of the columns being the same. What's the easiest way of achieving it? Concatenation? ...

what is the best matrix determinant algorithm

can anyone tell me which is the best algorithm to find the value of determinant of a matrix of size nXn. ...

5x5 matrix multiplication in C

I am stuck on this problem in my homework. I've made it this far and am sure the problem is in my three for loops. The question directly says to use 3 for loops so I know this is probably just a logic error. #include<stdio.h> void matMult(int A[][5],int B[][5],int C[][5]); int printMat_5x5(int A[5][5]); int main() { int A[5][5] = {{...

SSRS 2005 Matrix Reports - Editing Total

This seems as though it should be simple, but appears not to be. In SSRS 2005 I've written a matrix report and added some fields, one of which has the formula: If (x / y >= n, 1, 0). I've called this field 'Accuracy'. The report aggregates this field across a number of individuals and then for a number of days. Ideally I want a su...

Need help looping through text file in Objective-C and looping through multidimensional array of data within text file.

I have a question regarding an iPhone game I'm developing. At the moment, below is the code I'm using to currently I loop through my multidimensional array and position bricks accordingly on my scene. Instead of having multiple two dimensional arrays within my code as per the following (gameLevel1). Ideally, I'd like to read from a text...

Numpy image - rotate matrix 270 degrees...

I've got a Numpy 2d array that represents a grey-scale image and I need to rotate it 270 degrees. Might be being a bit thick here but the two ways I can find to do this seem quite... circulous: rotated = numpy.rot90(numpy.rot90(numpy.rot90(orignumpyarray))) rotated = numpy.fliplr(numpy.flipud(numpy.rot90(orignumpyarray))) I'm thinki...

Operator + for matrices in C++

I suppose the naive implementation of a + operator for matrices (2D for instance) in C++ would be: class Matrix { Matrix operator+ (const Matrix & other) const { Matrix result; // fill result with *this.data plus other.data return result; } } so we could use it like Matrix a; Matrix b; Matrix c; c = a + b; ...

Loopless function calls on vector/matrix members in Matlab/Octave

I came into matrix world from loop world (C, etc) I would like to call a function on each individual member of a vector/matrix, and return the resulting vector/matrix. This is how I currently do it: function retval = gauss(v, a, b, c) for i = 1:length(v) retval(i) = a*(e^(-(v(i)-b)*(v(i)-b)/(2*c*c))); endfor endfunction Exam...

converting a matrix to a list

Suppose I have a matrix foo as follows: foo <- cbind(c(1,2,3), c(15,16,17)) > foo [,1] [,2] [1,] 1 15 [2,] 2 16 [3,] 3 17 I'd like to turn it into a list that looks like [[1]] [1] 1 15 [[2]] [1] 2 16 [[3]] [1] 3 17 You can do it as follows: lapply(apply(foo, 1, function(x) list(c(x[1], x[2]))), function(y...

Calculate Matrix Rank using scipy

I'd like to calculate the mathematical rank of a matrix using scipy. The most obvious function numpy.rank calculates the dimension of an array (ie. scalars have dimension 0, vectors 1, matrices 2, etc...). I am aware that the numpy.linalg.lstsq module has this capability, but I was wondering if such a fundamental operation is built into ...

How can I concatenate multiple rows in a matrix

In Java I would like to concatenate an array (a[], fixed length) to an array of the same length, to create a matrix M[2][length of a]. This way I would like to subsequently paste more of those arrays onto the matrix. (Comparable to the Matlab vertcat function..C=[A;B]) Is this possible? Thanks ...

In R, when using named rows, can a sparse matrix column be added to another sparse matrix?

I have two sparse matrices, m1 and m2: > m1 <- Matrix(data=0,nrow=2, ncol=1, sparse=TRUE, dimnames=list(c("b","d"),NULL)) > m2 <- Matrix(data=0,nrow=2, ncol=1, sparse=TRUE, dimnames=list(c("a","b"),NULL)) > m1["b",1]<- 4 > m2["a",1]<- 5 > m1 2 x 1 sparse Matrix of class "dgCMatrix" b 4 d . > m2 2 x 1 sparse Matrix of class "dgCMatrix" ...

Converting switch statements to more elegant solution.

I have a 9 x 9 matrix. (think of suduko). 4 2 1 6 8 1 8 5 8 3 1 5 8 1 1 7 5 8 1 1 4 0 5 6 7 0 4 6 2 5 5 4 4 8 1 2 6 8 8 2 8 1 6 3 5 8 4 2 6 4 7 4 1 1 1 3 5 3 8 8 5 2 2 2 6 6 0 8 8 8 0 6 8 7 2 3 3 1 1 7 4 now I wanna be able to get a "quadrant". for example (according to my code) the quadrant 2 , 2 ...

How do I compete the transformation matrix needed to transform a rectangle into a trapezium?

I'm playing around with css transforms and the equivalent filters in IE, and want to simulate perspective by transforming a 2d rectangle into a trapezium. Specifically, I want the right hand side of the rectangle to stay the same height, and the left hand side to be say 80% of the height, so that the mid points of both sides are horizon...

C++ : Math library that solve system of equations using back substitution algorithm

If I have this: A * f = g; A: upper triangular matrix (n x n) f: (n x 1) g: (n x 1) Need to solve for f using back substitution algorithm. I would say that it not really that hard to write one myself, but oh well, if there is a library out there, then why not. ...

Problem sub-total Matrix with rdlc report in vb.NET

Hi everyone, I have a matrix and I need to add the money earned this year and past years. However, I must remove the money spent in past years. I must have the separate amount per year and the total of these amounts. This is what gives my matrix: Year = Fields!Year.value =formatnumber((sum(Fields!Results.Value))-(sum(iif( ...

I have a having a a matrix index bounds in matlab

I keep getting the error( this is in Matlab) Attempted to access r(0,0); index must be a positive integer or logical. Error in ==> Romberg at 15 I ran it with Romberg(1.3, 2.19,8) I think the problem is the statment is not logical because I made it positive and still got the same error. anyone got some ideas of what i could do? func...

How to create a array of boost matrices?

How can I define a array of boost matrices as a member variable? None of the following worked. boost::numeric::ublas::matrix<double> arrayM(1, 3)[arraySize]; boost::numeric::ublas::matrix<double>(1, 3) arrayM[arraySize]; boost::numeric::ublas::matrix<double> arrayM[arraySize](1, 3); Thanks, Ravi. ...