Search Results

Search found 1011 results on 41 pages for 'linear algebra'.

Page 8/41 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Metric 3d reconstruction

    - by srand
    I'm trying to reconstruct 3D points from 2D image correspondences. My camera is calibrated. The test images are of a checkered cube and correspondences are hand picked. Radial distortion is removed. After triangulation the construction seems to be wrong however. The X and Y values seem to be correct, but the Z values are about the same and do not differentiate along the cube. The 3D points look like as if the points were flattened along the Z-axis. What is going wrong in the Z values? Do the points need to be normalized or changed from image coordinates at any point, say before the fundamental matrix is computed? (If this is too vague I can explain my general process or elaborate on parts)

    Read the article

  • Best open source Mixed Integer Optimization Solver

    - by Mark
    I am using CPLEX for solving huge optimization models (more than 100k variables) now I'd like to see if I can find an open source alternative, I solve mixed integer problems (MILP) and CPLEX works great but it is very expensive if we want to scale so I really need to find an alternative or start writing our own ad-hoc optimization library (which will be painful) Any suggestion/insight would be much appreciated

    Read the article

  • Rotation Matrix calculates by column not by row

    - by pinnacler
    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 below code should work: theta = obj.heading * pi/180; apparent = [cos(theta) -sin(theta) ; sin(theta) cos(theta)] * obj.fixedPositions; But it wont. I get this error. ??? Error using == mtimes Inner matrix dimensions must agree. Error in == landmarkslandmarks.get.apparentPositions at 22 apparent = [cos(theta) -sin(theta) ; sin(theta) cos(theta)] * obj.fixedPositions; When I alter forest.fixedPositions to store the variables 2x250 instead of 250x2, the above code will work, but it wont plot. I'm going to be plotting fixedPositions constantly in a simulation, so I'd prefer to leave it as it, and make the rotation work instead. Any ideas? Also, fixed positions, is the position of the xy points as if you were looking straight ahead. i.e. heading = 0. heading is set to 45, meaning I want to rotate points clockwise 45 degrees. Here is my code: classdef landmarks properties fixedPositions %# positions in a fixed coordinate system. [x, y] heading = 45; %# direction in which the robot is facing end properties (Dependent) apparentPositions end methods function obj = landmarks(numberOfTrees) %# randomly generates numberOfTrees amount of x,y coordinates and set %the array or matrix (not sure which) to fixedPositions obj.fixedPositions = 100 * rand([numberOfTrees,2]) .* sign(rand([numberOfTrees,2]) - 0.5); end function obj = set.apparentPositions(obj,~) theta = obj.heading * pi/180; [cos(theta) -sin(theta) ; sin(theta) cos(theta)] * obj.fixedPositions; end function apparent = get.apparentPositions(obj) %# rotate obj.positions using obj.facing to generate the output theta = obj.heading * pi/180; apparent = [cos(theta) -sin(theta) ; sin(theta) cos(theta)] * obj.fixedPositions; end end end P.S. If you change one line to this: obj.fixedPositions = 100 * rand([2,numberOfTrees]) .* sign(rand([2,numberOfTrees]) - 0.5); Everything will work fine... it just wont plot.

    Read the article

  • Static Typing and Writing a Simple Matrix Library

    - by duckworthd
    Aye it's been done a million times before, but damnit I want to do it again. I'm writing a simple Matrix Library for C++ with the intention of doing it right. I've come across something that's fairly obvious in mathematics, but not so obvious to a strongly typed system -- the fact that a 1x1 matrix is just a number. To avoid this, I started walking down the hairy path of matrices as a composition of vectors, but also stumbled upon the fact that two vectors multiplied together could either be a number or a dyad, depending on the orientation of the two. My question is, what is the right way to deal with this situation in a strongly typed language like C++ or Java?

    Read the article

  • SQL Server view: how to add missing rows using interpolation

    - by Christopher Klein
    Running into a problem. I have a table defined to hold the values of the daily treasury yield curve. It's a pretty simple table used for historical lookup of values. There are notibly some gaps in the table on year 4, 6, 8, 9, 11-19 and 21-29. The formula is pretty simple in that to calculate year 4 it's 0.5*Year3Value + 0.5*Year5Value. The problem is how can I write a VIEW that can return the missing years? I could probably do it in a stored procedure but the end result needs to be a view.

    Read the article

  • NSPredicate as a constraint solver?

    - by Felixyz
    I'm working on a project which includes some slightly more complex dynamic layout of interface elements than what I'm used to. I always feel stupid writing complex code that checks if so-and-so is close to such-and-such and in that case move it x% in some direction, etc. That's just not how programming should be done. Programming should be as declarative as possible! Precisely because what I'm going to do is fairly simple, I thought it would be a good opportunity to try something new, and I thought of using NSPredicate as a simple constraints solver. I've only used NSPredicate for very simple tasks so far, but I know that it capable of much more. Are there any ideas, experiences, examples, warnings, insights that could be useful here? I'll give a very simple example so there will be something concrete to answer. How could I use NSPredicate to solve the following constraints: viewB.xmid = (viewB.leftEdge + viewB.width) / 2 viewB.xmid = max(300, viewA.rightEdge + 20 + viewB.width/2) ("viewB should be horizontally centered on coordinate 300, unless its left edge gets within 20 pixels of viewB's right edge, in which case viewA's left edge should stay fixed at 20 pixels to the right of viewB's right edge and viewA's horizontal center get pushed to the right.") viewA.rightEdge and viewB.width can vary, and those are the 'input variables'. EDIT: Any solution would probably have to use the NSExpression method -(id)expressionValueWithObject:(id)object context:(NSMutableDictionary *)context. This answer is relevant.

    Read the article

  • Finding coordinates of a point between two points?

    - by Nicros
    Doing some 3D stuff in wpf- want to use a simpler test to see if everything is working (before moving to curves). The basic question is given two points x1,y1,z1 and x2,y2,z2 I have calculated the distance between the points. But how to find the coordinates of another point (x3,y3,z3) that lies on that line at some distance? I.e. if my line is 100 long between -50,0,0 and 50,0,0 what are the coordinates of the point at 100 * 0.1 along the line? I think this is a simple formula but I haven't found it yet....

    Read the article

  • Alternative to as3isolib?

    - by tedw4rd
    Hi everyone, I've been working on a Flash game that involves an isometric space. I've been using as3isolib for a while now, and I'm less than impressed with how easy it is to use. Whether I'm approaching it the wrong way or it's just not that great to use is a question for another post. Anyways, I've been thinking of a different way to approach the problem of isometric positions, and I think I've got an idea that might work. Essentially, each object that is to be rendered to the iso-space maintains a 3-coordinate position. Those items are then registered with a camera that projects that 3-coordinate position to a 2-coordinate point on the screen according to the math on this Wikipedia article. Then, the MovieClip is added to the stage (or to the camera's MovieClip, perhaps) at that point, and at a child index of the point's y-value. That way, I figure objects that are closer to the camera will be "above" the objects further away, and will get rendered over them. So my question, then, is two-fold: Do you think this idea will work the way I think it will? Are there any existing 3D matrix/vector packages that I should look at? I know there's a Matrix3 class in Flex 3, but we're not using Flex for this game. Thanks!

    Read the article

  • Examples of monoids/semigroups in programming

    - by jkff
    It is well-known that monoids are stunningly ubiquitous in programing. They are so ubiquitous and so useful that I, as a 'hobby project', am working on a system that is completely based on their properties (distributed data aggregation). To make the system useful I need useful monoids :) I already know of these: Numeric or matrix sum Numeric or matrix product Minimum or maximum under a total order with a top or bottom element (more generally, join or meet in a bounded lattice, or even more generally, product or coproduct in a category) Set union Map union where conflicting values are joined using a monoid Intersection of subsets of a finite set (or just set intersection if we speak about semigroups) Intersection of maps with a bounded key domain (same here) Merge of sorted sequences, perhaps with joining key-equal values in a different monoid/semigroup Bounded merge of sorted lists (same as above, but we take the top N of the result) Cartesian product of two monoids or semigroups List concatenation Endomorphism composition. Now, let us define a quasi-property of an operation as a property that holds up to an equivalence relation. For example, list concatenation is quasi-commutative if we consider lists of equal length or with identical contents up to permutation to be equivalent. Here are some quasi-monoids and quasi-commutative monoids and semigroups: Any (a+b = a or b, if we consider all elements of the carrier set to be equivalent) Any satisfying predicate (a+b = the one of a and b that is non-null and satisfies some predicate P, if none does then null; if we consider all elements satisfying P equivalent) Bounded mixture of random samples (xs+ys = a random sample of size N from the concatenation of xs and ys; if we consider any two samples with the same distribution as the whole dataset to be equivalent) Bounded mixture of weighted random samples Which others do exist?

    Read the article

  • Algorithm(s) for rearranging simple symbolic algebraic expressions

    - by Gabe Johnson
    Hi, I would like to know if there is a straightforward algorithm for rearranging simple symbolic algebraic expressions. Ideally I would like to be able to rewrite any such expression with one variable alone on the left hand side. For example, given the input: m = (x + y) / 2 ... I would like to be able to ask about x in terms of m and y, or y in terms of x and m, and get these: x = 2*m - y y = 2*m - x Of course we've all done this algorithm on paper for years. But I was wondering if there was a name for it. It seems simple enough but if somebody has already cataloged the various "gotchas" it would make life easier. For my purposes I won't need it to handle quadratics. (And yes, CAS systems do this, and yes I know I could just use them as a library. I would like to avoid such a dependency in my application. I really would just like to know if there are named algorithms for approaching this problem.)

    Read the article

  • rotate a plane around a diagonal

    - by compie
    I would like to rotate a plane, not around a single (X or Y) axis, but around the diagonal (45 degrees between X and Y). How do I calculate the Rx and Ry given the Rdiagonal? (Rdiagonal is the amount of rotation I would like to achieve around the diagonal axis).

    Read the article

  • implementation of interp1 function of MATLAB in J2ME

    - by Jeeka
    Hi, i am looking to implement the interp1, 1-D data interpolation (table lookup), function available in MATLAB in J2ME or JAVA. here is the link http://www.mathworks.com/access/helpdesk/help/techdoc/ref/interp1.html Is there any library available in J2ME or JAVA which has already implemented the same function ? If not can anybody help me in implementing interp1 function in J2ME or JAVA ?

    Read the article

  • Solve equation from string to result in C

    - by Alexandre Cassagne
    Hi, I would like to know if anyone has info or experience on how to do something which sounds simple but doesn't look like it when trying to program it. The idea is : give a string containing an equation, such as : "2*x = 10" for example (this is simple, but it could get very complex, such as sqrt(54)*35=x^2; and so on....) and the program would return x = 5 and possibly give a log of how he got there. Is this doable ? If so, does anyone have a lead ? For info there is this site (http://www.numberempire.com/equationsolver.php) which does the same thing in PHP, but isn't open source. Thanks for any help !

    Read the article

  • How to Create a Duotone Interpolation Color in GDI+ (.NET)?

    - by Otaku
    I have two colors that I need to linearly interpolate to create a duotone color based of another color's luminance value. Dim clr1 = Color.Black Dim clr2 = Color.FromArgb(224, 255, 165) Dim lum = Color.FromArgb(226, 189, 136).GetBrightness 'lum = 0.71 I know the result of this should be R=171, G=192, B=125, but I can't figure out how to do this. I've searched through SO quite a bit and all over Google, but have not discovered a way to produce this result. Can anyone help?

    Read the article

  • mystified by qr.Q(): what is an orthonormal matrix in "compact" form?

    - by gappy
    R has a qr() function, which performs QR decomposition using either LINPACK or LAPACK (in my experience, the latter is 5% faster). The main object returned is a matrix "qr" that contains in the upper triangular matrix R (i.e. R=qr[upper.tri(qr)]). So far so good. The lower triangular part of qr contains Q "in compact form". One can extract Q from the qr decomposition by using qr.Q(). I would like to find the inverse of qr.Q(). In other word, I do have Q and R, and would like to put them in a "qr" object. R is trivial but Q is not. The goal is to apply to it qr.solve(), which is much faster than solve() on large systems.

    Read the article

  • Simple encryption - Sum of Hashes in C

    - by Dogbert
    I am attempting to demonstrate a simple proof of concept with respect to a vulnerability in a piece of code in a game written in C. Let's say that we want to validate a character login. The login is handled by the user choosing n items, (let's just assume n=5 for now) from a graphical menu. The items are all medieval themed: eg: _______________________________ | | | | | Bow | Sword | Staff | |-----------|-----------|-------| | Shield | Potion | Gold | |___________|___________|_______| The user must click on each item, then choose a number for each item. The validation algorithm then does the following: Determines which items were selected Drops each string to lowercase (ie: Bow becomes bow, etc) Calculates a simple string hash for each string (ie: `bow = b=2, o=15, w=23, sum = (2+15+23=40) Multiplies the hash by the value the user selected for the corresponding item; This new value is called the key Sums together the keys for each of the selected items; this is the final validation hash IMPORTANT: The validator will accept this hash, along with non-zero multiples of it (ie: if the final hash equals 1111, then 2222, 3333, 8888, etc are also valid). So, for example, let's say I select: Bow (1) Sword (2) Staff (10) Shield (1) Potion (6) The algorithm drops each of these strings to lowercase, calculates their string hashes, multiplies that hash by the number selected for each string, then sums these keys together. eg: Final_Validation_Hash = 1*HASH(Bow) + 2*HASH(Sword) + 10*HASH(Staff) + 1*HASH(Shield) + 6*HASH(Potion) By application of Euler's Method, I plan to demonstrate that these hashes are not unique, and want to devise a simple application to prove it. in my case, for 5 items, I would essentially be trying to calculate: (B)(y) = (A_1)(x_1) + (A_2)(x_2) + (A_3)(x_3) + (A_4)(x_4) + (A_5)(x_5) Where: B is arbitrary A_j are the selected coefficients/values for each string/category x_j are the hash values for each string/category y is the final validation hash (eg: 1111 above) B,y,A_j,x_j are all discrete-valued, positive, and non-zero (ie: natural numbers) Can someone either assist me in solving this problem or point me to a similar example (ie: code, worked out equations, etc)? I just need to solve the final step (ie: (B)(Y) = ...). Thank you all in advance.

    Read the article

  • Body CSS Gradient that Stops and Continues as Solid Color

    - by Alfo
    Something similar to this question has been asked here - HTML/CSS Gradient that stops at a perticular height and continues further with a solid color, but as far as I can see this doesn't work when using it on the body for a background color - which is what I want to achieve. Specifically, I would like it to be light blue at the top of the page, gradient into dark blue 200px further down, and then continue in dark blue for ever. Thanks to anybody who can help, Alfo.

    Read the article

  • Rejigging a floating point equation ...

    - by Jamie
    I'd like to know if there is a way to improve the accuracy of calculating a slope. (This came up a few months back here). It seems by changing: float get_slope(float dXa, float dXb, float dYa, float dYb) { return (dXa - dXb)/(dYa - dYb); } to float get_slope(float dXa, float dXb, float dYa, float dYb) { return dXa/(dYa - dYb) - dXb/(dYa - dYb); } might be an improvement. Suggestions? Edit: It's precision I'm after, not efficiency.

    Read the article

  • Where can I find BLAS example code (in Fortran)?

    - by Feynman
    I have been searching for decent documentation on blas, and I have found some 315 pages of dense material that ctrl-f does not work on. It provides all the information regarding what input arguments the routines take, but there are a LOT of input arguments and I could really use some example code. I am unable to locate any. I know there has to be some or no one would be able to use these libraries! Specifically, I use ATLAS installed via macports on a mac osx 10.5.8 and I use gfortran from gcc 4.4 (also installed via macports). I am coding in Fortran 90. I am still quite new to Fortran, but I have a fair amount of experience with mathematica, matlab, perl, and shell scripting. I would like to be able to initialize and multiply a dense complex vector by a dense symmetric (but not hermitian) complex matrix. The elements of the matrix are defined through a mathematical function of the indices--call it f(i,j). Could anyone provide some code or a link to some code?

    Read the article

  • Why is glpk-java.jar not the same across all platforms?

    - by pruefsumme
    I'm using glpk-java in one of my projects. It provides a JNI to GLPK, a free LP/MIP solver. To use it under different platforms, you need different shared libraries (libglpk.so under Linux, libglpk.dylib under Mac OS X, glpk.dll under Windows) which is fully understandable. In addition, a java library is needed: glpk-java.jar. It's created as part of the build process. I was wondering why this JAR file (which only contains .class files) is different under different platforms? I.e., I cannot use the same glpk-java.jar under Linux and Mac OS X which means that I cannot put this file under revision control.

    Read the article

  • Permutations distinct under given symmetry (Mathematica 8 group theory)

    - by Yaroslav Bulatov
    Given a list of integers like {2,1,1,0} I'd like to list all permutations of that list that are not equivalent under given group. For instance, using symmetry of the square, the result would be {{2, 1, 1, 0}, {2, 1, 0, 1}}. Approach below (Mathematica 8) generates all permutations, then weeds out the equivalent ones. I can't use it because I can't afford to generate all permutations, is there a more efficient way? Update: actually, the bottleneck is in DeleteCases. The following list {2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 0, 0, 0} has about a million permutations and takes 0.1 seconds to compute. Apparently there are supposed to be 1292 orderings after removing symmetries, but my approach doesn't finish in 10 minutes removeEquivalent[{}] := {}; removeEquivalent[list_] := ( Sow[First[list]]; equivalents = Permute[First[list], #] & /@ GroupElements[group]; DeleteCases[list, Alternatives @@ equivalents] ); nonequivalentPermutations[list_] := ( reaped = Reap@FixedPoint[removeEquivalent, Permutations@list]; reaped[[2, 1]] ); group = DihedralGroup[4]; nonequivalentPermutations[{2, 1, 1, 0}]

    Read the article

  • prolog sets problem, stack overflow

    - by garm0nboz1a
    Hi. I'm gonna show some code and ask, what could be optimized and where am I sucked? sublist([], []). sublist([H | Tail1], [H | Tail2]) :- sublist(Tail1, Tail2). sublist(H, [_ | Tail]) :- sublist(H, Tail). less(X, X, _). less(X, Z, RelationList) :- member([X,Z], RelationList). less(X, Z, RelationList) :- member([X,Y], RelationList), less(Y, Z, RelationList), \+less(Z, X, RelationList). lessList(X, LessList, RelationList) :- findall(Y, less(X, Y, RelationList), List), list_to_set(List, L), sort(L, LessList), !. list_mltpl(List1, List2, List) :- findall(X, ( member(X, List1), member(X, List2)), List). chain([_], _). chain([H,T | Tail], RelationList) :- less(H, T, RelationList), chain([T|Tail], RelationList), !. have_inf(X1, X2, RelationList) :- lessList(X1, X1_cone, RelationList), lessList(X2, X2_cone, RelationList), list_mltpl(X1_cone, X2_cone, Cone), chain(Cone, RelationList), !. relations(List, E) :- findall([X1,X2], (member(X1, E), member(X2, E), X1 =\= X2), Relations), sublist(List, Relations). semilattice(List, E) :- forall( (member(X1, E), member(X2, E), X1 < X2), have_inf(X1, X2, List) ). main(E) :- relations(X, E), semilattice(X, E). I'm trying to model all possible graph sets of N elements. Predicate relations(List, E) connects list of possible graphs(List) and input set E. Then I'm describing semilattice predicate to check relations' List for some properties. So, what I have. 1) semilattice/2 is working fast and clear ?- semilattice([[1,3],[2,4],[3,5],[4,5]],[1,2,3,4,5]). true. ?- semilattice([[1,3],[1,4],[2,3],[2,4],[3,5],[4,5]],[1,2,3,4,5]). false. 2) relations/2 is working not well ?- findall(X, relations(X,[1,2,3,4]), List), length(List, Len), writeln(Len),fail. 4096 false. ?- findall(X, relations(X,[1,2,3,4,5]), List), length(List, Len), writeln(Len),fail. ERROR: Out of global stack ^ Exception: (11) setup_call_catcher_cleanup('$bags':'$new_findall_bag'(17852886), '$bags':fa_loop(_G263, user:relations(_G263, [1, 2, 3, 4|...]), 17852886, _G268, []), _G835, '$bags':'$destroy_findall_bag'(17852886)) ? abort % Execution Aborted 3) Mix of them to finding all possible semilattice does not work at all. ?- main([1,2]). ERROR: Out of local stack ^ Exception: (15) setup_call_catcher_cleanup('$bags':'$new_findall_bag'(17852886), '$bags':fa_loop(_G41, user:less(1, _G41, [[1, 2], [2, 1]]), 17852886, _G52, []), _G4767764, '$bags':'$destroy_findall_bag'(17852886)) ?

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >