matrix

Templated Matrix Class Not Generating Functions Correctly

Basically, I have a matrix class like this (with a lot of operator overloads and other functions removed): template < uint32 TRows, uint32 TCols > struct Matrix { float values[TRows][TCols]; inline explicit Matrix() { } inline Matrix<TRows - 1, TCols - 1> minor(const uint32 col, const uint32 row) { ...

regexp-like library for matrix pattern search

Is there a library (in any language) that can search patterns in matrixes like regular expressions work for strings ? Something like regular expresions for matrixes, or any matrix pattern search method ? ...

Comparing columns using Matlab

How do you compare a column of a matrix with each previous column? Is there a way to do it without a couple for loops? ...

how to get first and last column of a matrix in MATLAB?

I have a matrix lets say: a = 401.4800 344.0900 305.0300 462.2100 310.0600 397.3400 502.5900 547.7100 429.9600 540.3400 737.3600 491.4700 474.7400 735.8700 I want to get the first and last columns only so that: b = 401.4800 502.5900 547.7100 735.8700 ...

What's wrong with my project and unproject functions?

I'm using OpenTK for a game in C#, and it doesn't come with the project and unproject functions, which convert between world and screen coordinates. Well, it does, but they're deprecated and I couldn't get them to work. I took a shot at implementing them myself based on the opengl spec (see left hand menu, gluProject and gluUnProject, an...

Baffling Index-Out-Of-Bounds

There a section in my code where I need to invert a matrix. That can only reasonably be done on a square matrix, in this case a 3x3 square matrix. The tool I'm using to invert the matrix kept saying that my array wasn't a proper square. So I did a little test: double[,] x = new double[3, 3]; MessageBox.Show(x.GetLength(0).ToString())...

Trying to use latin squares for constructing a pinball tournament

Hi, kind of random, but I am trying to design a preset matrix for running a pinball tournament. Not sure if anyone here would be able to advise me on this, but any thoughts or references would be appreciated. Essentially, I want to construct a design with the following conditions: 1) The tournament consists of 9 rounds. 2) Each round co...

Can someone show me what a good dependency matrix looks like and specify why?

I would like to start using DSM, but not sure how to get started. What does a good dependency matrix look like and why? How does it work? ...

Ruby matrix operation

I was trying to get familiarize myself with matrices in Ruby. I am trying to initialize a matrix with a input in string format. I tried the following code, but its not working. Please help me what I'm doing wrong. input = '08 02 22 97 49 49 99 40 81 49 31 73 52 70 95 23' x = Matrix.rows(input.lines() { |substr| substr.strip.spl...

OpenGL rotation vector from matrix

Ok, so here is what I have: -an abstract "Object" class which I made in a framework to use it as a base class for all 3D objects. -a Matrix4 member of this class which has the sole purpose of storing rotation info for the object. -some functions that multiply the matrix: for each of the yaw, pitch & roll rotations (both global and loc...

XNA: get Vector3 from Matrix

I thought I understood matrix math well enough, but apparently I'm clueless Here's the setup: I have an object at [0,0,0] in world space. I have a camera class controlled by mouse movements to rotate and zoom around the object such that it always looks at it. Here is how I calculate my viewMatrix from the camera: public Matrix viewM...

c++ sorting by depth using only a matrix. Possible?

If I have a std::vector of objects containing a rotated / translates matrix, is there a way I can use that matrix to calculate a Z position so that I can sort the objects by depth? ...

GSL/BLAS: Multiply a matrix with an inverse matrix

Hi! I'm using the GNU GSL to do some matrix calculations. I'm trying to multiply a matrix B with the inverse of a matrix A. Now I've noticed that the BLAS-part of GSL has a function to do this, but only if A is triangular. Is there a specific reason to this? Also, what would be the fastest way to do this computation? Should I invert A u...

Is there a data structure with these characteristics?

I'm looking for a data structure that would allow me to store an M-by-N 2D matrix of values contiguously in memory, such that the distance in memory between any two points approximates the Euclidean distance between those points in the matrix. That is, in a typical row-major representation as a one-dimensional array of M * N elements, th...

how do you swap two rows in a matrix (in C)?

for example, given a matrix: 1 2 3 4 5 6 7 8 9 if you are goint to swap row[0] and row[1], resulting matrix would be: 4 5 6 1 2 3 7 8 9 can you guys help me get a code in C for this? ...

Implementing a Fixed Coordinate system in OpenGL

The simple version of my project is rotating a sphere based on user input. However my rotations get weird after multiple rotations in certain situations due to openGL's local coordinate system. What I really need is to rotate based on a world/fixed coordinate system. Such that when I rotate the sphere once its rotation axes are not rota...

Algorithm to visit all points in a matrix of N (unknown) dimensions.

I have a multidimensional matrix that can have any number of dimensions greater than one. Looking for an efficient algorithm that can visit every point in the matrix. Some info about the code: The matrix has value accessors like (although these aren't really relevant). object value = matrixInstance.GetValue(int[] point); matrixInsta...

how do you transpose a non-square matrix? in C

i have my code for transposing my matrix: for(j=0; j<col; j++) { for(k=0; k<row; k++) { mat2[j][k] = mat[k][j]; } it seems to work on a square matrix but not on a nonsquare matrix. help me guys! ...

XNA ViewPort projection and SpriteBatch

I'm working on an XNA game and I am using ViewPort.Project and ViewPort.Unproject to translate to and from world coordinates. Currently I use these for each object I draw with SpriteBatch. What I would like to do is calculate a Matrix that I can send to SpriteBatch.Begin to do the screen-space transformation for me. Here are the functi...

Rotating a section of a two dimensional array.

I've read this SO question on how to rotate a two-dimensional array many times, and I was curious as to how you could expand this situation to work with a section of a two-dimensional array. I've thought about it for a while, and I can't seem to come up with a good equation. Essentially what I'm wanting to do is something like this: ...