matrix

Creating a 2d matrix from an array (java)

I'm supposed to write a method that creates a 2d matrix from an array, for instance: ({1, 2, 3, 4}, 3) should return the matrix {{1, 2, 3}, {4}} public class Matrix { public static int[][]toM(int[] array, int a) { int[][]matrix = new int [(array.length + a- 1)/ a][a]; for (int i = 0; i < array.length; i++){ int value = a...

Rotate a 2d matrix to the right

I want a 2d matrix to rotate to the right, it compiles fine but when I try to the run it says that the array index is out of bounds exception. For example I want {{10,20,30},{40,50,60}} to rotate into {{40,10},{50,20},{60,30}} import java.util.*; public class Rotate{ public static int[][] rotate(int[][] m) { int [][] rotateM = n...

VFP Unit Matrix Multiply problem on the iPhone

Hi. I'm trying to write a Matrix3x3 multiply using the Vector Floating Point on the iPhone, however i'm encountering some problems. This is my first attempt at writing any ARM assembly, so it could be a faily simple solution that i'm not seeing. I've currently got a small application running using a maths library that i've written. I'm ...

Octave: Multiple submatrices from a matrix

I have a large matrix from which I would like to gather a collection of submatrices. If my matrix is NxN and the submatrix size is MxM, I want to collect I=(N - M + 1)^2 submatrices. In other words I want one MxM submatrix for each element in the original matrix that can be in the top-left corner of such a matrix. Here's the code I have...

Is there any function in Matlab for changing the form of matrix?

Hi, I have to get the unknown matrix by changing the form of known matrix considering the following rules: H = [-P'|I] %' G = [I|P] where H is known matrix G is unknown matrix which has to be calculated I is identity matrix So for example if we had a matrix H = [1 1 1 1 0 0; 0 0 1 1 0 1; 1 0 0 1 1 0] its form has ...

Precision error on matrix multiplication

Hello all, Coding a matrix multiplication in my program, I get precision errors (inaccurate results for large matrices). Here's my code. The current object has data stored in a flattened array, row after row. Other matrix B has data stored in a flattened array, column after column (so I can use pointer arithmetic). protected double[,]...

How do you concatenate the rows of a matrix into a vector in MATLAB?

For an m-by-m (square) array, how do you concatenate all the rows into a column vector with size m^2 ? ...

ssrs: one static row matrix, multiple columns will not filter out nulls

Using a ssrs 2005 matrix client side. I want to list the multiple addresses of one person, hence one row, multiple columns. The Column field is =Fields!StreetName.Value. The data details field is =First(Fields!StreetPrefix.Value) & " " & First(Fields!StreetName.Value). The datasource has a row for each address; however, some rows will ha...

Resize matrix in LaTeX beamer

Hi I was wondering how to resize matrices in a beamer environment. Currently I am writing the following code: \begin{align*} \left( \begin{array}{ccccccc} 0 & 1 & & & & & \\ -1 & 0 & & & & & \\ & & 0 & 1 & & & \\ & & -1 & 0 & & & \\ & & & & \ddots & & \...

the easiest way to convert matrix to one row vector

Possible Duplicate: How do you concatenate the rows of a matrix into a vector in MATLAB? Hi, Does anyone know what is the best way to create one row matrix (vector) from M x N matrix by putting all rows, from 1 to M, of the original matrix into first row of new matrix the following way: A = [row1; row2, ..., rowM] B = [row1,...

What is the best algorithm for solving a band-diagonal matrix?

I'm trying to figure out the best way to solve a pentadiagonal matrix. Is there something faster than gaussian elimination? ...

O'Reilly book clarification on 2d linear system

The Oreilly book "Learning openCV" states at page 356 : Quote Before we get totally lost, let’s consider a particular realistic situation of taking measurements on a car driving in a parking lot. We might imagine that the state of the car could be summarized by two position variables, x and y, and two velocities, vx and vy. These four...

How do I shrink a matrix using an array mask in MATLAB?

This seems to be a very common problem of mine: data = [1 2 3; 4 5 6]; mask = [true false true]; mask = repmat(mask, 2, 1); data(mask) ==> [1; 4; 3; 6] What I wanted was [1 3; 4 6]. Yes I can just reshape it to the right size, but that seems the wrong way to do it. Is there a better way? Why doesn't data(mask) return a matrix whe...

Reporting Services Matrix Order

I've got a reporting services report which display data in a matrix. The matrix rows are ordered by the report on a specific field's value. Trouble is I want a particular value to always appear last in the matrix even though it won't naturally be ordered there. Is there a way I can do this using an expression? Thanks. ...

What's the right way to utilize ARM SIMD on iPhone for Game vector/matrix operation?

I'm making an vector/matrix library for Game which utilizes SIMD unit on iPhone (3GS or later). How can I do this? I searched about this, now I know several options: Accelerate framework (BLAS+LAPACK+...) from Apple (iPhone OS 4) OpenMAX implementation library from ARM GCC auto-vectorization feature What's the most suitable way for v...

Trouble creating a button matrix in Interface Builder

Hi, I am trying to create a matrix of buttons in Interface Builder 3.2.1 but can not find anyway to do it. I read the question and answer posted here: http://stackoverflow.com/questions/1771835/how-to-create-a-nsmatrix-of-nsimagecell-in-interface-builder-in-10-6 But following Layout > Embed Objects In, as suggested, I see only View and...

MATLAB setting matrix values in an array

I'm trying to write some code to calculate a cumulative distribution function in matlab. When I try to actually put my results into an array it yells at me. tempnum = ordered1(1); k=2; while(k<538) count = 1; while(ordered1(k)==tempnum) count = count + 1; k = k + 1; end if(ordered1(k)~=tempnum) o...

Reading values in MATLAB and assigning coordinates to the entries

Hi, I'm a bit new to MATLAB. Basically, I have a 20x20 values , complete with various random entries ranging from 0 to 3. I need to write a program that reads this 20x20 square, and assigns x-y coordinates to the entries, so that when I ask for an input of a particular x-y coordinate which has, say an entry of 3, then it will result in...

Rotation Matrix calculates by column not by row

I have a class called forest and a property called fixedPositions that stores 100 points (x,y) and they are stored 250x2 (rows x columns) in MatLab. When I select 'fixedPositions', I can click scatter and it will plot the points. Now, I want to rotate the plotted points and I have a rotation matrix that will allow me to do that. The...

Problem creating an array of objects C++

I have a class and I want to create an array of a number instances, specifically a matrix class: class Matrix { public: Matrix(int sizeX, int sizeY); Matrix(); ~Matrix(); ....//omiting the rest here private: int dx, dy; float **p void allocArrays() { assert(dx>0); assert(dy>0); p =...