Help solve a problem with importing a function from a dll - page 10

 

It turned out exactly as described in the documentation!

The function rmatrixsvd is "honest"!

The question of how to check it itself is no longer relevant - I checked it, it works.

Actually, the check consists in comparing source matrix

with product U x S x Vt.

.

Checked diagonal matrices too, all possible row sizes 3...10 - column sizes 3...10.

I put a rather strict check on the difference between the original matrix and the reconstructed matrix:

double delta = arr(row, col) - usRvt(row, col);
if(delta > 0.00000000001) { throw "Bad everything"; }

This condition has never worked for me.

.

Sent me a messagein a private message.

 

Great!!!

Sent me a messagein my personal email.

 
boysn >> :

OK, let me try to explain...


If a square matrix is big enough, say 1000x1000, finding all eigenvalues via bisections is inefficient and here the principle of modern singular decomposition algorithms comes to the fore: reducing the matrix to a bidiagonal form followed by diagonalization by a QR algorithm. This is the text I bring from the site http://alglib.sources.ru/. Further there is the following sentence: This simple scheme is quite operable, but it can be improved by making an addition which will noticeably increase speed of the program. The scheme of the improved algorithm described below is almost completely borrowed from the LAPACK package (xGESVD subroutine). A full description of the algorithm: http://alglib.sources.ru/matrixops/general/svd.php

I.e. for my tasks I need a fast algorithm, working with large matrices of 1000x1000 or even more... and I need exactly ALL singular values together with vectors, i.e. full expansion. That's why I settled on http://alglib.sources.ru/ library. Especially, since there's already some ready-made C++ code in it. There's an algorithm for 300 lines of code, but it's slower than 3000 lines of code.

Are you sure you will have a 1000x1000 matrix non-singular (not meaningless)?

https://ru.wikipedia.org/wiki/%D0%92%D1%8B%D1%80%D0%BE%D0%B6%D0%B4%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BC%D0%B0%D1%82%D1%80%D0%B8%D1%86%D0%B0

The point is that real non-random data with a million samples, i.e. 1000x1000, often and clearly shows a linear dependence between data and the matrix loses its meaning. I personally know several real multistage algorithms, for example, of integer optimization where such a large matrix is created specifically to solve a problem because the problem cannot be solved otherwise, i.e. the problem is solved by increasing its dimensionality. Such a big matrix is made artificially, its segments represent actually different variants of problems, i.e. they are hardly linearly dependent.

Before you make a program, you should answer the question: are you sure that your 1000x1000 matrix is not degenerate?

 
AlexEro писал(а) >>

Are you sure you will have a 1000x1000 matrix that is non-narrow (not meaningless)?

https://ru.wikipedia.org/wiki/%D0%92%D1%8B%D1%80%D0%BE%D0%B6%D0%B4%D0%B5%D0%BD%D0%BD%D0%B0%D1%8F_%D0%BC%D0%B0%D1%82%D1%80%D0%B8%D1%86%D0%B0

The point is that real non-random data with a million samples, i.e. 1000x1000, often and clearly shows a linear relationship between data and the matrix becomes meaningless. I personally know several real multistage algorithms, for example, of integer optimization where such a large matrix is created specifically to solve a problem because the problem cannot be solved otherwise, i.e. the problem is solved by increasing its dimensionality. Such a large matrix is made artificially; its segments actually represent different variants of problems, i.e. they are hardly linearly dependent.

Before you make a program, you should answer the question: are you sure your matrix of 1000x1000 is not degenerate?

Let's see, we'll see...

 
jartmailru писал(а) >>

I've sent a message to you in a private message.

Great!!!

>>Sent you a private message.

 

Can't import the DLL. (((

In MS Visual C++ I wrote a DLL:

//MyDll.h

#define MY_EXPORT extern "C" __declspec ( dllexport )
MY_EXPORT int CALLBACK Return1();

//MyDll.cpp

MY_EXPORT int CALLBACK Return1() { return 1; }

//MyDll.def

LIBRARY "MyDll"

EXPORTS Return1 @1

After compiling, I got MyDll.dll and MyDll.lib.

Also wrote a micro-prog in C++ using DLL. MyDll.lib was specified in the project settings. It works fine with DLL.

Then I tried to import DLL from MT4 by putting MyDll.dll file in experts\libraries directory. I didn't find anything about *.lib in documentation, so I didn't put it there.
//ImportDll.mqh (in the experts\include directory)
#import "MyDll.dll"

int Return1();

//ImportDll.mq4 (in the experts\indicators directory)
#include <ImportDll.mqh>
int init()

{

Print("Return1="+Return1();

return("0);
}

When running ImportDll.ex4 it says: dll calls are not allowed; 'MyDll.dll' - 'Return1'
HELP .... I already broke my brain ((((((((((((((((((((((((( My ICQ: 573794562, e-mail: AKalashnikov84@mail.ru