matrix

Efficient reduction of 2D array in CUDA?

In the CUDA SDK, there is example code and presentation slides for an efficient one-dimensional reduction. I have also seen several papers on and implementations of one-dimensional reductions and prefix scans in CUDA. Is there efficient CUDA code available for a reduction of a dense two-dimensional array? Pointers to code or pertinent...

Test the surrounding non-zeros elements

Hi guys, This is the following part of the below: 2) Additional question: After getting the average of the non-zero neighbors, I also want to test if the neighbor elements are equal, lesser, or greater than the average of the nonzeros. If it is greater or equal then '1' or else '0'. Note: if the neighbors are with in the radius of t...

Passing array from JSP to Javascript(how to create a matrix in javascript)

Hello, i get a list from my java code and I would like to create a matrix from this list. In my jsp I have a select and I would like to display in a table the values of my matrix in relation to value in my select choice my list in my java <html:select property="immeuble.zone" size="1" styleId="zone" styleClass="saisie"> <html:opti...

How do you perform OpenGL ES 2.0 shader matrix multiplication?

I'm trying to transform vertices with a shader program, but i can't understand the results. I prepared a projection, a view(trans), and model(trans) matrices: First i have a vertex shader function of: viewproj * position. In a Objective-C program i start with identity multiplicated by a translation and projection matrices and then unifo...

How can I index a 3-D matrix with a 2-D mask in MATLAB?

Suppose I have D, an X-by-Y-by-Z data matrix. I also have M, an X-by-Y "masking" matrix. My goal is to set the elements (Xi,Yi,:) in D to NaN when (Xi,Yi) in M is false. Is there any way to avoid doing this in a loop? I tried using ind2sub, but that fails: M = logical(round(rand(3,3))); % mask D = randn(3,3,2); % data % try getting x,...

matrix help: how does postScale affect the translation part of a matrix?

Ive been trying to implement a limit to prevent the user from scaling the image too much in my multitouch zoom app. Problem is, when i set the max zoom level by dumping the matrix, the image starts to translate downward once the overall scale of the image hits my limit. I believe it is doing this because the matrix is still being affecte...

transforming a matrix into a vector along its diagonals

hi guys, im not not a programmer, i just need to solve something numerically in matlab. i need a function to make the following transformation for any square matrix: from row 1: 1 2 3 row 2: 4 5 6 row 3: 7 8 9 to 1 4 2 7 5 3 8 6 9 ie write the matrix in a vector along its diagonals from left to top right. any ideas please? i r...

Rotating a bitmap using matrix.

While rotating a bitmap using matrix, vertex is not stable.. Matrix matrix = new Matrix(); matrix.postRotate(mDegree,100,100); mCompasstemp = Bitmap.createBitmap(mCompPic, 0, 0, mCompPic.getWidth(), mCompPic.getHeight(), matrix, true); mCompassHud.setImageBitmap(mCompasstemp); Output of my code is like -bitmap will r...

Eigen max matrix size

So, I'm finding the Eigen package crashes when I try to declare a matrix larger than 10000x10000. I need to declare a matrix like this.. about 13000x13000 elements reliably. I ran a test like: for( int tortureEigen = 1 ; tortureEigen < 50000 ; tortureEigen++ ) { printf( "Torturing Eigen with %dx%d..\n", tortureEigen, tortureEigen ) ...

c++ matrix template library need for neural networks computations

hi i'm implementing some neural network algorithms and i'll be needing a matrix library, I've looked and found that there are ones like ( boost::ublas ) , (blitz++), TNT... I need experts opinion which one is suitable for (simple , easy coding, high performance maybe ) ...

passing variables to an outside class.

I split my inner View class from my Main class into its own file. In my main class, I have the view set as an onTouchListener which records user movement into a matrix so it can translate and scale the view. After separating it everything works but im unsure how to pass the matrix to the View for onDraw to update. Any suggestions? Thanks...

create a pricing matrix - sql or array of constants?

I am planning to create a pricing matrix for a project in Rails. It's supposed to be a table of destinations and departure locations, and prices depending on where you came and are planning to go. I am kinda undecided on how to better do this: either making a table in the db for this matrix, or making a mega array of constants. Problem ...

How do I solve this sparse matrix storage problem in C?

Hello, I have a sparse matrix that is not symmetric I.E. the sparsity is somewhat random, and I can't count on all the values being a set distance away from the diagonal. However, it is still sparse, and I want to reduce the storage requirement on the matrix. Therefore, I am trying to figure out how to store each row starting at the f...

Neural Network for multidimensional problem

Hi there, I'm wondering if it's possible for Neural Network to operate on matrices say I want to: A(i)=matrix(10,10) -> B(i)=matrix(10,10) input = vector of matrices, i = sample size output = vector of matrices Say I would like to guess an matrix operation transforming matrix into another matrix ie f(A(i,j))=2*A(i,j)*b Matlab do...

How to override the transform.matrix setter

I have a class which extends the Sprite object in as3. I need to be able to override the transform.matrix setter in this class but haven't been successful in doing so. I've tried many things, along with creating my own separate class which extends the Transform class and then overrides its set matrix function, and set my transform = new...

c++ filling matrix boost

hi i've looked into the vector duplicate of this but couldn't find answer ublas::matrix<int> input; fill(input.begin1(), input.end1(), in_val); fill(input.begin2(), input.end2(), in_val); but it gives me [2,3] {(3,3,3) (3,0,0)} as you can guess i just want to fill all of it with init_val=3 , Thanks. ...

Please help me to test my hypothesis with the neighbor elements in the matrix.

Hey guys, I could not figure out the last part of my research so if anyone could help me I would be really appreciated for the help.. :) Say that my original matrix is, X = 0 0 0 0 0 0 0 12 9 0 0 4 9 15 0 0 11 19 0 0 0 2 4 8 0 0 ...

Cut rows of a matrix without using loops

I have a matrix and i want to create a new matrix which will be the old matrix, but without the first row and first column. is there a way to do this without using loops? ...

Please help me shorten my code..

Hey guys, My question is to shorten repeating the process. Data1=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[31 1 286 255]); Data2=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[299 1 554 255]); Data3=dlmread('BadgCk-20001103-RZhS-1hAccumx10-TextData0-1.txt','\t',[567 1 822...

Computing the inverse of a matrix using lapack in C

I would like to be able to compute the inverse of a general NxN matrix in C/C++ using lapack. My understanding is that the way to do an inversion in lapack is by using the dgetri function, however, I can't figure out what all of its arguments are supposed to be. Here is the code I have: void dgetri_(int* N, double* A, int* lda, int*...