473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Arrays in .NET (cli)

I have c++ code, showed below, for allocating lower triangular matrix
and I have to write that in .NET (cli). I can't use 1D array because
I want to use property [,] with 2D notation (like LowerTriM[r,c]).
This works fine in native c++ but I have no idea how to do it in cli.
Any suggestions?
typedef float Type;

Type **conteiner_;
//alocate row pointers
conteiner_ = new Type*[r]

//alocate lower triangular matrix
conteiner_[0] = new Type[(r*(r+1))/2];

//set row pointers
for(int i = 1; i < row_; ++i )
{
conteiner_[i] = conteiner_[i-1] + i;
}

Thx!

Best regards,
Zoran Stipanicev

Jan 29 '06 #1
3 958
Hi Zoran!
I want to use property [,] with 2D notation (like LowerTriM[r,c]).


See article from MVP Nishant: Arrays in C++/CLI
http://www.codeproject.com/managedcpp/cppcliarrays.asp

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Jan 29 '06 #2
Something like this:

typedef array<Type> Type_Array ;

Type_Array^ conteiner_ = gcnew Type_Array(r) ;

[==P==]

"Zoran Stipanicev" <st*************@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I have c++ code, showed below, for allocating lower triangular matrix
and I have to write that in .NET (cli). I can't use 1D array because
I want to use property [,] with 2D notation (like LowerTriM[r,c]).
This works fine in native c++ but I have no idea how to do it in cli.
Any suggestions?
typedef float Type;

Type **conteiner_;
//alocate row pointers
conteiner_ = new Type*[r]

//alocate lower triangular matrix
conteiner_[0] = new Type[(r*(r+1))/2];

//set row pointers
for(int i = 1; i < row_; ++i )
{
conteiner_[i] = conteiner_[i-1] + i;
}

Thx!

Best regards,
Zoran Stipanicev

Jan 30 '06 #3
Oh, for 2D stuff it's like this I think:

typedef array<Type,2> Type_Array_2D ;

Type_Array_2D^ array_2d = gcnew Type_Array_2D(r,c) ;

array_2d[0,0] = Type(0) ;

[==P==]

"Zoran Stipanicev" <st*************@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
I have c++ code, showed below, for allocating lower triangular matrix
and I have to write that in .NET (cli). I can't use 1D array because
I want to use property [,] with 2D notation (like LowerTriM[r,c]).
This works fine in native c++ but I have no idea how to do it in cli.
Any suggestions?
typedef float Type;

Type **conteiner_;
//alocate row pointers
conteiner_ = new Type*[r]

//alocate lower triangular matrix
conteiner_[0] = new Type[(r*(r+1))/2];

//set row pointers
for(int i = 1; i < row_; ++i )
{
conteiner_[i] = conteiner_[i-1] + i;
}

Thx!

Best regards,
Zoran Stipanicev

Jan 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Ioannis Vranos | last post by:
I have initiated a similar discussion thread in clc++m, however because of the "m" in the name, the discussion is progressing slowly, so I am setting another thread here. Well the story is...
6
by: Herby | last post by:
How do you use a dynamic array or equivalent in C++\CLI? When using CArray in MFC its simple you say array.Add( item ) If the size needs to grow it will do that for you. Iv tried using...
5
by: _iycrd | last post by:
After numerous problems, I'm having second thoughts about using C++/CLI to wrap a native DLL. On the other hand, PInvoke seems like it will take a huge amount of work, if it will work at all. ...
3
by: alcabo | last post by:
Hello, I'd like to improve several critical routines involving arrays (vectors and matrices)... How are arrays stored in memory? Row major or column major? (Like in C or like Fortran?)
1
by: joesfer | last post by:
I'm trying to develop a graphical user interface for a renderer i've got written in an unmanaged C++ DLL with C#. During the rendering process, several images are sent to a delegate as float*...
0
by: Jim Carlock | last post by:
$aThePosts = array_change_key_case($_POST, CASE_LOWER); define("CONTACT_IS_LOCAL", 0); define("CONTACT_IS_REMOTE", 1); /* $aWho contains an array of arrays (contact details) * array( *...
64
by: Zytan | last post by:
I know there are no pointers in C#, but if you do: a = b; and a and b are both arrays, they now both point to the same memory (changing one changes the other). So, it makes them seem like...
2
by: =?Utf-8?B?Sm9hY2hpbQ==?= | last post by:
How can I transport int arrays between C# and C++ so that an int array created in C# will be filled with contents in the C++ dll and so that this content is accessible in the C# dll again.
1
by: xontrn | last post by:
Hello, I am building a .net control in C++/CLI, and it will be hosted by a C# form. The form will load some data from file and pass it to the control (an array of bytes): byte data = new...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.