Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using other library as base types #33

Closed
AustinFelipe opened this issue Aug 8, 2018 · 3 comments
Closed

Using other library as base types #33

AustinFelipe opened this issue Aug 8, 2018 · 3 comments
Assignees

Comments

@AustinFelipe
Copy link

Hey guys, how's doing?

Well, I'm wondering if is possible to use other libraries to deal with math instead of DlibDotNet related.

E.g: can I use Matrix from MathDotNet library instead of using DlibDotNet's Matrix<TElement>

Any direction on how to do it?

Thanks!

@takuya-takeuchi
Copy link
Owner

The following pseudo code

byte[] array = MathDotNet.ToArray();
var array2 = Dlib.LoadImageData(array);
var mat = new Matrix(array2);

Or

byte[] array = mat.ToArray();
var matrix = new MathDotNet(array);

Does MathDotNet.Matrix provide constructor which can accept T[] and provide interface to convert T[]?
If so, I can add Matrix.ToArray method.

@AustinFelipe
Copy link
Author

Hey @takuya-takeuchi, thanks!

Well, it seems to have the following

Matrix<T> Dense<T>(int rows, int columns, T[] storage)
Matrix<T> Dense<T>(int rows, int columns, T value)
Matrix<T> DenseOfArray<T>(T[,] array)

Vector<T> Dense<T>(T[] array)
Vector<T> Dense<T>(int length, T value)

Vector Creator
Matrix Creator

I'm not sure if is what you're looking for. Is that something like those builders?

Thanks!

@takuya-takeuchi
Copy link
Owner

I added new interface for Matrix. Please check 177af2d

var array = new byte[200];
// New Interface1
var dlibMat = new Matrix<byte>(array, 20, 10)

// New Interface2
var array2 = dlibMat.ToArray();

var mathMat = CreateMatrix.Dense<byte>(20, 10, array2);

// It may be ToRowMajorArray()
var array3 = mathMat.ToColumnMajorArray();

var dlibMat2 = new Matrix<byte>(array3, 20, 10)

I can not use MathDotNet.
So this modification may occur problem for compatible between Matrix.
If so, please let me know.

Have a try!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants