Search Results

Search found 1909 results on 77 pages for 'adjacency matrix'.

Page 23/77 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Is Matlab faster than Python?

    - by kame
    I want to compute magnetic fields of some conductors using the biot-savart-law and I want to use a 1000x1000x1000 matrix. Before I use Matlab, but now I want to use Python. Is Python slower than Matlab? How can I make Python faster? EDIT: Maybe the best way is to compute the big array with c/c++ and then transfering them to python. I want to visualise then with VPython. EDIT2: Could somebody give an advice for which is better in my case: C or C++?

    Read the article

  • More complex view matrix calculation required to composite 3d models with 2d video

    - by lzcd
    I'm utilising some 2d / 3d tracking data (provided by pfHoe) to help integrate some 3d models into the playback of some 2d video. Things are working.... okay... but there's still some visible 'slipping' of the models against the video background and I suspect this is may be because the XNA CreatePerspective helper method isn't taking into account some of the additional data supplied by pfHoe such as independent horizontal / vertical field of view angles and focal length. Would anyone be able to point me towards some examples of constructing view matrices that include such details?

    Read the article

  • MATLAB (MATrix LABoratory) interview questions?

    - by Shane
    I programmed in Matlab for many years, but switched to using R exclusively in the past few years so I'm a little out of practice. I'm interviewing a candidate today who describes himself as a Matlab expert. What MATLAB interview questions that I should be asking?

    Read the article

  • How to use Eclipse and versioning for a matrix of projects

    - by Nulldevice
    Our company develop several software products, which reuse each others packages (we use Java). Every product represented as separate Eclipse Java project and has it's own versioning repository (we use Mercurial). When we find a bug in some shared package, we need to transfer changes to all consuming projects, and this is a hell. The key problem is that Eclipse project can be associated only with one versioning repository. Could someone recommend some way to associate Eclipse Java project whith several versioning repositories which in ideal may be geterogeious (svn, git, mercurial) ?

    Read the article

  • How to set orthgraphic matrix for a 2d camera with zooming?

    - by MahanGM
    I'm using ID3DXSprite to draw my sprites and haven't set any kind of camera projection matrix. How to setup an orthographic projection matrix for camera in DirectX which it would be able to support zoom functionality? D3DXMATRIX orthographicMatrix; D3DXMATRIX identityMatrix; D3DXMatrixOrthoLH(&orthographicMatrix, nScreenWidth, nScreenHeight, 0.0f, 1.0f); D3DXMatrixIdentity(&identityMatrix); device->SetTransform(D3DTS_PROJECTION, &orthographicMatrix); device->SetTransform(D3DTS_WORLD, &identityMatrix); device->SetTransform(D3DTS_VIEW, &identityMatrix); This code is for initial setup. Then, for zooming I multiply zoom factor in nScreenWidth and nScreenHeight.

    Read the article

  • Operating on rows and then on columns of a matrix produces code duplication

    - by Chetan
    I have the following (Python) code to check if there are any rows or columns that contain the same value: # Test rows -> # Check each row for a win for i in range(self.height): # For each row ... firstValue = None # Initialize first value placeholder for j in range(self.width): # For each value in the row if (j == 0): # If it's the first value ... firstValue = b[i][j] # Remember it else: # Otherwise ... if b[i][j] != firstValue: # If this is not the same as the first value ... firstValue = None # Reset first value break # Stop checking this row, there's no win here if (firstValue != None): # If first value has been set # First value placeholder now holds the winning player's code return firstValue # Return it # Test columns -> # Check each column for a win for i in range(self.width): # For each column ... firstValue = None # Initialize first value placeholder for j in range(self.height): # For each value in the column if (j == 0): # If it's the first value ... firstValue = b[j][i] # Remember it else: # Otherwise ... if b[j][i] != firstValue: # If this is not the same as the first value ... firstValue = None # Reset first value break # Stop checking this column, there's no win here if (firstValue != None): # If first value has been set # First value placeholder now holds the winning player's code return firstValue # Return it Clearly, there is a lot of code duplication here. How do I refactor this code? Thanks!

    Read the article

  • What do gurus say about Requirements Traceability Matrix?

    - by Jaywalker
    Our organization is at CMMI Level 2, and as part of the requirements of the level, we have to maintain an RTM which more or less contains the following entries for each requirement: Requirement Description Reference Section Functional Specification Document Reference Section Design Document Reference Section Test Cases Document Now, this might be an overkill for a small project. But more importantly, this could be a nightmare to maintain when the requirements/ features keep changing, and documents have to be constantly updated. What do the gurus say about this? Should one avoid such level of documentation or are there any tools to manage when a "change" out dates so many artifacts? And by using the term 'gurus', I am not talking of coding champs; rather people like Steve McConnel or others who have worked on commercial projects of medium to large scale. Quotes/ book references/ articles will suit me. EDIT: It's not just requirements that change. Design Document can change; well, even test cases may change.

    Read the article

  • Models from 3ds max lose their transformations when input into XNA

    - by jacobian
    I am making models in 3ds max. However when I export them to .fbx format and then input them into XNA, they lose their scaling. -It is most likely something to do with not using the transforms from the model correctly, is the following code correct -using xna 3.0 Matrix[] transforms=new Matrix[playerModel.Meshes.Count]; playerModel.CopyAbsoluteBoneTransformsTo(transforms); // Draw the model. int count = 0; foreach (ModelMesh mesh in playerModel.Meshes) { foreach (BasicEffect effect in mesh.Effects) { effect.World = transforms[count]* Matrix.CreateScale(scale) * Matrix.CreateRotationX((float)MathHelper.ToRadians(rx)) * Matrix.CreateRotationY((float)MathHelper.ToRadians(ry)) * Matrix.CreateRotationZ((float)MathHelper.ToRadians(rz))* Matrix.CreateTranslation(position); effect.View = view; effect.Projection = projection; effect.EnableDefaultLighting(); } count++; mesh.Draw(); }

    Read the article

  • deteminant of matrix

    - by davit-datuashvili
    suppose there is given two dimensional array int a[][]=new int[4][4]; i am trying to find determinant of matrices please help i know how find it mathematical but i am trying to find it in programaticaly

    Read the article

  • transforming 1d (1column) into 5d(5column) matrix through copy paste or other

    - by Curious
    Ex. I want to take the column with 12345..... and order 5 columns across as seen. next 5 numbers in column will be next row. However my code creates a 4 row gap in between each successive row. I dont know what additional logic (possibly if then statement) I can embed into do loop to may make it cleaner. I am new to this, so showing as much sample code to learn the syntax would be most beneficial. thanks in advance. Below is the Result of my code. VBA code is below result. 1 1 2 3 4 5 2 3 4 5 6 6 7 8 9 10 7 8 9 10 11 11 12 13 14 15 12 13 14 15 16 16 17 17 Sub Working_Code() ' Working_Code Macro Do ActiveCell.Select Selection.Copy ActiveCell.Offset(0, 5).Select ActiveSheet.Paste ActiveCell.Offset(1, -5).Select Selection.Copy ActiveCell.Offset(-1, 6).Select ActiveSheet.Paste ActiveCell.Offset(2, -6).Select Selection.Copy ActiveCell.Offset(-2, 7).Select ActiveSheet.Paste ActiveCell.Offset(3, -7).Select Selection.Copy ActiveCell.Offset(-3, 8).Select ActiveSheet.Paste ActiveCell.Offset(4, -8).Select Selection.Copy ActiveCell.Offset(-4, 9).Select ActiveSheet.Paste ActiveCell.Offset(5, -9).Select Loop Until IsEmpty(ActiveCell.Offset(0, -1)) End Sub

    Read the article

  • 2D pixel array rotation and scaling

    - by Betamoo
    Hi I am working on C# program to process images ( given as int[,] ).. So I have 2D array of pixels, and I need to rotate them around a point, then scale them down to fit the original array.. I already found articles about using matrix to transform to a point and rotate then transform back.. What remains is to scale the resultant image to fit an array of original size.. How that can be done? (preferably with 2 equations one for x and one for y ) Thanks in advance

    Read the article

  • ILNumerics multiply complex with matrix<double>

    - by nik
    I m looking at ILNumerics to translate some matlab code into c#. How would I multiply a complex and a double? Simplified description: In Matlab: A=[1 2 3] i*A*A' Returns a complex number. How would I do the same in ILNumerics: ILArray<double> A = ILMath.array(1.0, 2.0, 3.0); complex B = complex.i * ILMath.multiply(A,A.T); Throws the error: Operator '*' cannot be applied to operands of type 'ILNumerics.complex' and 'ILNumerics.ILRetArray<double>' Update This works: double C = 14.0; complex D = complex.i * C; But shouldnt: ILMath.multiply(A,A.T) also return 14.0?

    Read the article

  • Error " Index exceeds Matrix dimensions"

    - by Mola
    Hi experts, I am trying to read an excel 2003 file which consist of 62 columns and 2000 rows and then draw 2d dendrogram from 2000 pattern of 2 categories of a data as my plot in matlab. When i run the script, it gives me the above error. I don't know why. Anybody has any idea why i have the above error? My data is here: http://rapidshare.com/files/383549074/data.xls Please delete the 2001 column if you want to use the data for testing. and my code is here: % Script file: cluster_2d_data.m d=2000; n1=22; n2=40; N=62 Data=xlsread('data.xls','A1:BJ2000'); X=Data'; R=1:2000; C=1:2; clustergram(X,'Pdist','euclidean','Linkage','complete','Dimension',2,... 'ROWLABELS',R,'COLUMNLABELS',C,'Dendrogram',{'color',5})

    Read the article

  • Indexing one-dimensional numpy.array as matrix

    - by Alain
    I am trying to index a numpy.array with varying dimensions during runtime. To retrieve e.g. the first row of a n*m array a, you can simply do a[0,:] However, in case a happens to be a 1xn vector, this code above returns an index error: IndexError: too many indices As the code needs to be executed as efficiently as possible I don't want to introduce an if statement. Does anybody have a convenient solution that ideally doesn't involve changing any data structure types?

    Read the article

  • printf'ing a matrix

    - by Flavius
    I'm trying to implement an all-purpose function for printing 2D data. What I've come up with is: int mprintf(FILE* f, char* fmt, void** data, size_t cols, size_t rows) The challenge is determining how many bits to read at once from data, based on fmt. The format fmt is going to be the stdlib's-specific format for printf() and alike. Do you have any knowledge of already-existing features from stdlibc (GNU GCC C's) I could use to ease this up? I try avoiding having to do it all manually, because I know "I am stupid" (I don't want to introduce stupid bugs). Thus, reusing code would be the bug-freest way. Thanks Addendum I see there's a /usr/include/printf.h. Can't I use any of those functions to do it right and ease my job at the same time?

    Read the article

  • Help Please, I want use LINQ to Query Count in a matrix according to a array!

    - by Bob Feng
    I have a matrix, IEnumerable<IEnumerable<int>> matrix, for example: { {10,23,16,20,2,4}, {22,13,1,33,21,11 }, {7,19,31,12,6,22}, ... } and another array: int[] arr={ 10, 23, 16, 20} I want to filter the matrix on the condition that I group all rows of the matrix which contain the same number of elements from arr. That is to say the first row in the matrix {10,23,16,20,2,4} has 4 numbers from arr, this array should be grouped with the rest of the rows with 4 numbers from arr. better to use linq, thank you very much!

    Read the article

  • Twisted Matrix and telnet server implementation

    - by ypercube
    I have a project which is essentially a game server where users connect and send text commands via telnet. The code is in C and really old and unmodular and has several bugs and missing features. The main function alone is half the code. I came to the conclusion that rewriting it in TwistedMachine could actually result in faster completement, besides other benefits. So, here is the questions: What packages and modules I should use? I see a "telnet" module inside "protocols" package. I also see "cronch" package with "ssh" and another "telnet" module. I'm a complete novice regarding Python.

    Read the article

  • How to create a matrix format in perl

    - by shaq
    I have an array of array in which each array is like: clusterA gene1 1 clusterA gene2 0 clusterB gene1 1 clusterB gene2 0 I want to produce a file like: name gene1 gene2 clusterA 1 0 clusterB 1 0 Current attempt: if (condition) { @array = ($cluster, $genes, "1"); } elsif (not condition) { @array = ($cluster, $genes, "0"); } push @AoA, [ @array ]; @A0A is my array of array.

    Read the article

  • Improve C function performance with cache locality?

    - by Christoper Hans
    I have to find a diagonal difference in a matrix represented as 2d array and the function prototype is int diagonal_diff(int x[512][512]) I have to use a 2d array, and the data is 512x512. This is tested on a SPARC machine: my current timing is 6ms but I need to be under 2ms. Sample data: [3][4][5][9] [2][8][9][4] [6][9][7][3] [5][8][8][2] The difference is: |4-2| + |5-6| + |9-5| + |9-9| + |4-8| + |3-8| = 2 + 1 + 4 + 0 + 4 + 5 = 16 In order to do that, I use the following algorithm: int i,j,result=0; for(i=0; i<4; i++) for(j=0; j<4; j++) result+=abs(array[i][j]-[j][i]); return result; But this algorithm keeps accessing the column, row, column, row, etc which make inefficient use of cache. Is there a way to improve my function?

    Read the article

  • putting data from a for loop into a table using matlab and fprintf

    - by user2928537
    I am trying to put the following data from my for loop into a table formatted so that there are 11 values of F in each column, with a total of 4 columns. but I am always ending up with one long column of my data instead of the four columns I want. I was wondering if there is some way to put the data into a matrix and then reshape it, but I am having trouble. Any help greatly appreciated. fprintf ('Electrostatic Forces:\n') for r = 1:4; q2 = 0: 1*10^-19: 1*10^-18; for F = coulomb(q2,r); fprintf ('%d\n',F) end end Where the code for the function coulomb is function F = coulomb (q2,r); k = 8.98*10^9; q1 = 1.6*10^-19; F = k*abs(q1*q2)/r^2; end

    Read the article

  • My OpenCL kernel is slower on faster hardware.. But why?

    - by matdumsa
    Hi folks, As I was finishing coding my project for a multicore programming class I came up upon something really weird I wanted to discuss with you. We were asked to create any program that would show significant improvement in being programmed for a multi-core platform. I’ve decided to try and code something on the GPU to try out OpenCL. I’ve chosen the matrix convolution problem since I’m quite familiar with it (I’ve parallelized it before with open_mpi with great speedup for large images). So here it is, I select a large GIF file (2.5 MB) [2816X2112] and I run the sequential version (original code) and I get an average of 15.3 seconds. I then run the new OpenCL version I just wrote on my MBP integrated GeForce 9400M and I get timings of 1.26s in average.. So far so good, it’s a speedup of 12X!! But now I go in my energy saver panel to turn on the “Graphic Performance Mode” That mode turns off the GeForce 9400M and turns on the Geforce 9600M GT my system has. Apple says this card is twice as fast as the integrated one. Guess what, my timing using the kick-ass graphic card are 3.2 seconds in average… My 9600M GT seems to be more than two times slower than the 9400M.. For those of you that are OpenCL inclined, I copy all data to remote buffers before starting, so the actual computation doesn’t require roundtrip to main ram. Also, I let OpenCL determine the optimal local-worksize as I’ve read they’ve done a pretty good implementation at figuring that parameter out.. Anyone has a clue? edit: full source code with makefiles here http://www.mathieusavard.info/convolution.zip cd gimage make cd ../clconvolute make put a large input.gif in clconvolute and run it to see results

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >