Is there a mathematical matrix class?

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a mathematical matrix class?

dale.amon
I am virtually certain the answer is no, and NSMatrix is
certainly not it as it's aimed at the GUI. I have a need for
something that allows me to have a 2D sparse array which has methods
like 'transpose', horizontal and vertical reflection, column and
row operations for swapping, inserting and deleting; swapping
the contents of any two locations, etc.

It would just be incredibly useful, so much so that if it
does not exist, some day I will have to write one. However,
I'd rather not... I'm hoping someone is going to tell me
that Class XYZ, which says nothing about Matrices, actually
is one...

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Gregory Casamento
Are these the kinds of operations which would benefit from hardware acceleration? (I.e. utilizing the gpu?)

On Sun, May 6, 2018 at 04:12 <[hidden email]> wrote:
I am virtually certain the answer is no, and NSMatrix is
certainly not it as it's aimed at the GUI. I have a need for
something that allows me to have a 2D sparse array which has methods
like 'transpose', horizontal and vertical reflection, column and
row operations for swapping, inserting and deleting; swapping
the contents of any two locations, etc.

It would just be incredibly useful, so much so that if it
does not exist, some day I will have to write one. However,
I'd rather not... I'm hoping someone is going to tell me
that Class XYZ, which says nothing about Matrices, actually
is one...

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
--
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
http://ind.ie/phoenix/

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Fred Kiefer
In reply to this post by dale.amon
NSMatrx is OK for what it was designed for, 2D affine transformations. But what you are asking for is more like a general propose mathematical matrix implementation. I don’t know anything like this for Objective C. What you could try is to take a C++ matrix implementation and wrap it into an Objective-C class.

Cheers,
Fred

> Am 06.05.2018 um 07:52 schrieb <[hidden email]> <[hidden email]>:
>
> I am virtually certain the answer is no, and NSMatrix is
> certainly not it as it's aimed at the GUI. I have a need for
> something that allows me to have a 2D sparse array which has methods
> like 'transpose', horizontal and vertical reflection, column and
> row operations for swapping, inserting and deleting; swapping
> the contents of any two locations, etc.
>
> It would just be incredibly useful, so much so that if it
> does not exist, some day I will have to write one. However,
> I'd rather not... I'm hoping someone is going to tell me
> that Class XYZ, which says nothing about Matrices, actually
> is one...
>
> --
> +---------------------------------------------------------------+
> |  Dale Amon         Immortal Data          |
> |  CEO       Midland International Air and Space Port  |
> | [hidden email]    "Data Systems for Deep Space and Time"  |
> +---------------------------------------------------------------+
>
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Matt Rice-2
I seem to recall Adam Fedor having a library of such things, not sure
what its current state is though.

http://ftp.gnustep.org/pub/gnustep/contrib/MathArray-1.0.README
http://ftp.gnustep.org/pub/gnustep/contrib/MathArray-1.3.tar.gz

On Sun, May 6, 2018 at 3:03 AM, Fred Kiefer <[hidden email]> wrote:

> NSMatrx is OK for what it was designed for, 2D affine transformations. But what you are asking for is more like a general propose mathematical matrix implementation. I don’t know anything like this for Objective C. What you could try is to take a C++ matrix implementation and wrap it into an Objective-C class.
>
> Cheers,
> Fred
>
>> Am 06.05.2018 um 07:52 schrieb <[hidden email]> <[hidden email]>:
>>
>> I am virtually certain the answer is no, and NSMatrix is
>> certainly not it as it's aimed at the GUI. I have a need for
>> something that allows me to have a 2D sparse array which has methods
>> like 'transpose', horizontal and vertical reflection, column and
>> row operations for swapping, inserting and deleting; swapping
>> the contents of any two locations, etc.
>>
>> It would just be incredibly useful, so much so that if it
>> does not exist, some day I will have to write one. However,
>> I'd rather not... I'm hoping someone is going to tell me
>> that Class XYZ, which says nothing about Matrices, actually
>> is one...
>>
>> --
>> +---------------------------------------------------------------+
>> |  Dale Amon         Immortal Data          |
>> |  CEO       Midland International Air and Space Port  |
>> | [hidden email]    "Data Systems for Deep Space and Time"  |
>> +---------------------------------------------------------------+
>>
>>
>>
>> _______________________________________________
>> Discuss-gnustep mailing list
>> [hidden email]
>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep
>
>
> _______________________________________________
> Discuss-gnustep mailing list
> [hidden email]
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep

_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Wolfgang Lux
In reply to this post by Fred Kiefer


> Am 06.05.2018 um 12:03 schrieb Fred Kiefer <[hidden email]>:
>
> NSMatrx is OK for what it was designed for, 2D affine transformations.

Presumably you meant NSAffineTransform and not MSMatrix, which is a UI interface class grouping a bunch of radio buttons into a single control.

Wolfgang


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Ivan Vučica-2
In reply to this post by Gregory Casamento
That would be useful only if the matrix class wasn't storing individual matrices but a large number of them. Both for GPU and CPU uses. I don't think you want to iterate over an NSArray to do matrix multiplication or transposes individually.

As intended, GPUs and CPUs probably accelerate matrices up to 4x4, so I don't think they apply to a general purpose matrix either (maybe I am wrong).

It's hard to advise Dale without knowing the specific use case.

On May 6, 2018 9:22:23 AM GMT+01:00, Gregory Casamento <[hidden email]> wrote:
Are these the kinds of operations which would benefit from hardware acceleration? (I.e. utilizing the gpu?)

On Sun, May 6, 2018 at 04:12 <[hidden email]> wrote:
I am virtually certain the answer is no, and NSMatrix is
certainly not it as it's aimed at the GUI. I have a need for
something that allows me to have a 2D sparse array which has methods
like 'transpose', horizontal and vertical reflection, column and
row operations for swapping, inserting and deleting; swapping
the contents of any two locations, etc.

It would just be incredibly useful, so much so that if it
does not exist, some day I will have to write one. However,
I'd rather not... I'm hoping someone is going to tell me
that Class XYZ, which says nothing about Matrices, actually
is one...

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
--
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
http://ind.ie/phoenix/

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

H. Nikolaus Schaller
AFAIR, Cocoa has an Accelerate.framework and there is OpenCL.
But neither one is available for GNUstep.

I think there is also some quaternion classes in SpriteKit or SceneKit
but that does not seem to be what you are looking for. And it is
also not provided by GNUstep.

The closest to your problem what I found by Google seems to be


though it is a wrapper around Accelerate.framework.

But it might give you a direction when writing your own Matrix
class, maybe based on some C code. The transformations
you mention are just loop operations over rows or columns.

-- hns


Am 06.05.2018 um 14:50 schrieb Ivan Vučica <[hidden email]>:

That would be useful only if the matrix class wasn't storing individual matrices but a large number of them. Both for GPU and CPU uses. I don't think you want to iterate over an NSArray to do matrix multiplication or transposes individually.

As intended, GPUs and CPUs probably accelerate matrices up to 4x4, so I don't think they apply to a general purpose matrix either (maybe I am wrong).

It's hard to advise Dale without knowing the specific use case.

On May 6, 2018 9:22:23 AM GMT+01:00, Gregory Casamento <[hidden email]> wrote:
Are these the kinds of operations which would benefit from hardware acceleration? (I.e. utilizing the gpu?)

On Sun, May 6, 2018 at 04:12 <[hidden email]> wrote:
I am virtually certain the answer is no, and NSMatrix is
certainly not it as it's aimed at the GUI. I have a need for
something that allows me to have a 2D sparse array which has methods
like 'transpose', horizontal and vertical reflection, column and
row operations for swapping, inserting and deleting; swapping
the contents of any two locations, etc.

It would just be incredibly useful, so much so that if it 
does not exist, some day I will have to write one. However,
I'd rather not... I'm hoping someone is going to tell me
that Class XYZ, which says nothing about Matrices, actually
is one...

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
-- 
Gregory Casamento
GNUstep Lead Developer / OLC, Principal Consultant
http://www.gnustep.org - http://heronsperch.blogspot.com
http://ind.ie/phoenix/

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity._______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

dale.amon
In reply to this post by dale.amon
Thanks for the discussion. The specific application is one in
which I have an NSArray of NSArray's of Objects. In this case
the objects are for the most part NSStrings and NSNumbers or
related, but the actual content is not what I am dealing with.

The thing that one of the objects represents may or may not
be present. I am presently dealing with that by pre-building
the row NSArrays to have the largest number of columns expected
and inserting @"" in each cell so that each index is pre-existing.

I then populate them as I read in data and when it is all done
I do all the transforms; I swap row and column (transpose) mirror
the result right to left and then swap columns around to get things
in a preferred mapping. Not as much computing as it sounds because
I can pre-calculate the initial and final index of each cell and
write them into an output 'matrix' of filled in NSArrays of NSArrays
of NSStrings and copy source to destination.

It just bothers my engineering soul that I can't do it with simple
math though.

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

Fred Kiefer
In reply to this post by Wolfgang Lux


> Am 06.05.2018 um 13:54 schrieb Wolfgang Lux <[hidden email]>:
>
>
>
>> Am 06.05.2018 um 12:03 schrieb Fred Kiefer <[hidden email]>:
>>
>> NSMatrx is OK for what it was designed for, 2D affine transformations.
>
> Presumably you meant NSAffineTransform and not MSMatrix, which is a UI interface class grouping a bunch of radio buttons into a single control.

Oops, you are right.


_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep
Reply | Threaded
Open this post in threaded view
|

Re: Is there a mathematical matrix class?

dale.amon
In reply to this post by dale.amon
Since Fred Kiefer brought up coordinate transforms, something
different than what I'm looking at right now, I thought I'd
note that I did a bunch of things in that area for MiscKit
working with Don Yachtman back in the 90's. I gave a copy of
the last or near last release to Greg. It might be worth mining
as there was a lot of interesting and useful stuff in MiscKit,
not just my GISKit and GUI controls.

--
+---------------------------------------------------------------+
|  Dale Amon         Immortal Data          |
|  CEO       Midland International Air and Space Port  |
| [hidden email]    "Data Systems for Deep Space and Time"  |
+---------------------------------------------------------------+



_______________________________________________
Discuss-gnustep mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep