|
Joaquín M López Muñoz wrote:
Maybe RasDial is what the guy was looking for, but by VPN one usually refers to the secure stuff on top of raw dialup connections as provided by the OS.
As I understood he wants to use the VPN provided by Windows 2000, not a router/firewall specific one.
As such, this kind of VPN appears as a "virtual" DUN for RAS. And to connect, you use RasDial.
My latest article: GBVB - Converting VB.NET code to C#
|
|
|
|
|
We have alot of data we need to store. Sometimes on the order
of 3000 elements . Thus, I could declare a large square matrix
(ie: 3000 by 3000) entries for a double data type . This is,
obviously, totally undesirable. On a P4 it takes about 1/2 a minute
to initialize just the array, nevermind the calculation .
Furthermore, because we have a diagonal matrix (mirror symmetry
about the matrix diagonal) the lower half of the matrix is
redundant. Thus, we decided (for now) to go with a stair-case
type matrix. ie:
<br />
m_ppdDeltaMMatrix = new double*[m_uzMaxNodes];<br />
<br />
for (int i = 0; i < m_uzMaxNodes; i++)<br />
m_ppdDeltaMMatrix[i] = new double[i+1];<br />
For large matrix sizes (thousands) the memory savings converge
to approximately 50% or (n-1)/2 . The data is also sparse (quite a
few zeroes). I was wondering if anyone had a novel way of solving
this problem (I don't ). This would imply reducing the number of entries to
only those necessary, while being able to address arbitrary elements
of the matrix like: m_ppdDeltaMMatrix[3][2] or
m_ppdDeltaMMatrix[300][127] in the next access to the data.
Any help would be greatly appreciated.
|
|
|
|
|
One solution is a map.
Kuphryn
|
|
|
|
|
First question, before you go down and dirty: do you really need the huge matrix? is there another algorithm yielding similar results? (peterchens #1 rule in optimizaton: can you avoid it?)
Some 7 years ago I looked at some RogueWave libraries for matrix manipulaiton, they claimed to have effective and fast sparse matrices. (Rule #2 - can you use the implementaiton of someone else?)
Depends on the required lookup speed, required lookup methods, and if there's some rule in the sparseness.
For high sparseness, acceptable memory consumption and fairly fast lookup, you can use a map<int index,double value> for each row (or column, if this yields better results). Add to the map only the indices that are actually used, and provide an overloaded operator[], that looks uses map.find to see if the element is actually there, and return 0.0, or *find
This is deadly, however, if you want ot use a "normal" matrix multiplication for multiplying two of these.
Two other options (that are simple to implement only if index access can be slow, but iteration through a row must be fast): store which cells are occupied separate from the cell data itself. e.g. an int (or even byte) array: alternating one value number of zeroes, number of "used" values, then store the double's packed, e.g. a
( 0 0 0 1 0 0 2 3 4 0 0 0 ) matrix would be encoded
( 3,1,2,3,3 ) (1,2,3,4)
Index access is very slow here.
Or use a bit mask to identify occupied cells. (good compression of zeroes, fast iteration, but for index access you need some extra data and clever lookup table juggling.
If you need multiplication often, you can create a row-iterable and a column-iterable matrix, and use a specialized multiplication can very quickly identify where there are non-nulls "meeting" each other.
Well, there are more clever layots (I can *feel* it ) - but maybe you just say what you have to *do* with the matrix.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Ok, now we're talking. This is just the type of reply
that I was hoping for. Now a bit more on the nature of
the problem.
Problem 1: Huge matrices are UNAVOIDABLE.
Problem 2: Noone has ever tackled this particular
problem before (either in literature or
in another commercial product.)
Problem 3: Just coming up with a method of solution for
this problem required a solid week of
brain-wracking work by a trained physicist (me!)
and a mathematician.
Problem 4: I am not a programmer, and so am looking for a
better implementation for a data structure
One positive is that we don't ever (I repeat never) need
to multiply any of these matrices together. They are solely
used as "lookup tables" if you will. Each entry in the matrix
is addressed by (row,column) and this is important. Let's say
for now that each entry represents a connection between nodes
and the entry at that location is significant. For example:
entry (0, 2) represents a connection between city 0 and city 2 and the data stored at (0,2) would be, say, the distance between city 0 and city 2 (in double form). If you can imagine 7 cities with possible interconnections between all 7 cities (ie: (0, 1), (1, 7), (3, 4), (4, 3, etc...) where (3, 4) = (4,3) But ah! What redundancy through yonder window breaks!) you will see that connections may or may not exist, thus, there is no 'rule' per se on the sparseness of the matrix. Furthermore, entries can generally be made in any conceivable order (for 7 cities, that is quite a few permutations) However, the buck doesn't stop there! We're talking *thousands* of possible interlinks. (The data isn't cities and distances, but that is irrelevant - the behaviour is the same). Also, any given entry at some point may be removed. Speed *is*, unfortunately a great concern as the code is quite optimized right now.
I think the map idea is becoming attractive. Others I work with have proposed use of a linked list or STL vector, but I am a bit discouraged by those ideas - they make searching the table a bit daunting.
One question I do have concerns the maps. If each entry is indexed by 2 nodes (as above) how would a map of the form
map<int index, double value> help here? Is this not basically an STL vector style implementation?
Thanks for the help.
|
|
|
|
|
John Theal wrote:
One question I do have concerns the maps. If each entry is indexed by 2 nodes (as above) how would a map of the form
map<int index,="" double="" value=""> help here? Is this not basically an STL vector style implementation?
// 0 <= row < numberOfRows
// 0 <= col < numberOfCols
int mapIndex = row*numberOfColumns + col;
// row = mapIndex/numberOfCols
// col = mapIndex%numberOfCols
|
|
|
|
|
One solution is to use a Map for each row.
Another solution is a map < pair<int,int> xy, double distance >
However, I would use the latter only if it's *really* sparse. You could run performance checks against both, but I'd expect the one-map-per-row to be faster still.
OK, breakdown of my previous post (I guess it might have got lost): random index access is fastest with map, row/colum iteration can benefit from another storage scheme.
so you emulate the matrix by a vector < map<int, double=""> * >, and can keep unused rows as NULL pointer.
lookup is them basically:
double GetItem(int row, int col)
{
if (below diag)
return GetItem(above diag);
map<int,double> * rowMap = m_vector[row];
if (rowMap == NULL)
return 0.0;
map<int,double>::iterator it = rowMap->find(col);
if (it == rowMap.end())
return 0.0;
return it->second;
}
I'm still pondering a thought of a "better" storage scheme, however, the map will take you quite far. You can probably boost performance (if required) by a custom pool allocator.
May I asked what you're working on? I've got 5 years of successless physics study in my backlog...
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
We're trying to simulate real-time surface deformation
with possible extension to a collision detection algorithm.
Speed and low memory consumption are therefore very
desirable.
|
|
|
|
|
|
Slow at the moment - we're bug slaying. Our solution
engine is also cranking out correct solutions, but they
are sometimes translated and/or rotated (albiet correct...) .
I therefore haven't had time to code/implement the array
map yet. Soon though...
Let's just say we still have some work to do.
I think it will eventually be a go.
|
|
|
|
|
I am a physicist like you and the problem You have many of us had before.
The goal of the boost project is to provide fast number crunching libraries.
Your matrix can be represented by a sparse matrix which allocates only memory
for the needed elements. You can warp a class around to make use of the symmetry of your matrix.
http://www.boost.org/libs/numeric/ublas/doc/matrix_sparse.htm
Even if you do not like the coding style it is worth the effort. Your approach
with many pointers and arrays with no boundary checking is very error prone and I guarantee you that You will spend much more time with tracking down errors compared to the time you will need to integrate the sparse matrix.
|
|
|
|
|
HI,
I want to create menu item on the top of the modal dialog box so that the if the user clicks on the item it has to show drop down list as File Open, Save As ..etc. Any help would be appreciated.
Thanks
|
|
|
|
|
I have a machine which has a VPN connection and a LAN connection open at the same time. I would like to send and receive through the VPN connection instead of the LAN connection. My application is designed to listen on the IP address returned by gethostname/gethostbyname. I need to modify it to use the static IP address assigned to me for the VPN connection. What changes do I need to make to accomplish this?
On a related note where should I look in the MSDN to programatically start up the VPN connection and wait until the connection is established or an error occurs?
|
|
|
|
|
You need to explicitly bind your socket to a specific IP address (network card) prior to doing the listen.
|
|
|
|
|
I have a dll in which I dynamically create an owner draw button. I created the button with the BS_OWNERDRAW flag, but somehow the DrawItem method is not being called. Anyone has a suggestion about why it is not being called?
|
|
|
|
|
|
|
Anyone knows why am i getting this exception while using ado and what to do ?
Exception thrown for classes generated by #import Code = 8007007e
Code meaning = The specified module could not be found.
Source = (null)
Description = (null)
Thank you !
Also another question ---> which app posts the ado210.chm in the sysyem/ado folder ?
|
|
|
|
|
The error code is returned from LoadLibrary when it either doesn#t dind the DLL to load itself, or some implicitely linked DLL is missing.
When using COMponents, when you create an instance this usually indictaes that a control is registered, but not properly installed (either the physical .dll/.ocx is missing, or it implicitely links to a missing DLL)
If it happens at interface marshaling/QueryInterface, it could be a missing proxy/stub DLL.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
BlackRider wrote:
Also another question ---> which app posts the ado210.chm in the sysyem/ado folder ?
Try (re)installing MDAC (Microsoft Data Access Components), it might be the one which installs the chm file as well.
|
|
|
|
|
Hello,
I have created a binary file in Matlab and i am using it for my C code.
I would like to know how do i procedd, it's a sine wave.
Any DSP specialist in here?
Thx
F.K
|
|
|
|
|
Just out of curiosity, what is DSP?
|
|
|
|
|
DSP = Digital Signal Processor. I think. Unless it has another meaning.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Digital Signal Processing
|
|
|
|
|
DSP stands for Digital Signal Processing.
I'am an electrical engineering student, that's is why i have weird questions sometimes.
F.K
|
|
|
|
|