Exploring Unimplemented Data Structures in C: Matrix Storage by Columns

In summary, the textbook is correct and you can store a matrix by its columns in C using the following declaration: int arr[3][3] = {{1, 1, 1}, {2, 2, 2}, {3, 3, 3}};. However, there are two problems still: first, your declaration seems wrong, and second, why wouldn't you use {{1, 2, 3}, {1, 2, 3}, {1, 2, 3}} for this same matrix? If this was properly documented, I don't see a reason why not to (assuming the performance gain would be noticeable).
  • #36
mafagafo said:
And even when the author says that "the most widely used algorithms (...) Fortran.", from what I have seen MatLab is pretty widely used both in industry and research and its implemented mostly on C.

An algorithm is an algorithm, and a language is a language. I have no idea why the author mixed the two together.

Yes, C and C++ are popular choices.
 
<h2>1. What is the purpose of exploring unimplemented data structures in C?</h2><p>The purpose of exploring unimplemented data structures in C is to understand the various ways in which data can be stored and accessed efficiently in computer memory. This knowledge can help in developing better algorithms and improving the overall performance of software applications.</p><h2>2. What is a data structure in C?</h2><p>A data structure in C is a way of organizing and storing data in computer memory so that it can be accessed and manipulated efficiently. It can be implemented using various techniques such as arrays, linked lists, trees, etc.</p><h2>3. Why is matrix storage by columns important?</h2><p>Matrix storage by columns is important because it allows for efficient access to data in a matrix, especially when working with large datasets. It also makes it easier to perform operations on the matrix, such as matrix multiplication and transposition.</p><h2>4. How is matrix storage by columns different from matrix storage by rows?</h2><p>In matrix storage by columns, the elements of a matrix are stored in a column-major order, meaning that the elements of each column are stored sequentially in memory. In contrast, matrix storage by rows stores the elements of a matrix in a row-major order, meaning that the elements of each row are stored sequentially in memory. This can affect the performance of operations on the matrix, depending on the specific algorithm being used.</p><h2>5. Are there any drawbacks to using matrix storage by columns?</h2><p>One potential drawback of using matrix storage by columns is that it may not be as intuitive for some programmers, especially those who are used to working with matrices in a row-major order. Additionally, certain operations, such as adding or deleting rows, may be more complex to implement with matrix storage by columns compared to matrix storage by rows.</p>

Related to Exploring Unimplemented Data Structures in C: Matrix Storage by Columns

1. What is the purpose of exploring unimplemented data structures in C?

The purpose of exploring unimplemented data structures in C is to understand the various ways in which data can be stored and accessed efficiently in computer memory. This knowledge can help in developing better algorithms and improving the overall performance of software applications.

2. What is a data structure in C?

A data structure in C is a way of organizing and storing data in computer memory so that it can be accessed and manipulated efficiently. It can be implemented using various techniques such as arrays, linked lists, trees, etc.

3. Why is matrix storage by columns important?

Matrix storage by columns is important because it allows for efficient access to data in a matrix, especially when working with large datasets. It also makes it easier to perform operations on the matrix, such as matrix multiplication and transposition.

4. How is matrix storage by columns different from matrix storage by rows?

In matrix storage by columns, the elements of a matrix are stored in a column-major order, meaning that the elements of each column are stored sequentially in memory. In contrast, matrix storage by rows stores the elements of a matrix in a row-major order, meaning that the elements of each row are stored sequentially in memory. This can affect the performance of operations on the matrix, depending on the specific algorithm being used.

5. Are there any drawbacks to using matrix storage by columns?

One potential drawback of using matrix storage by columns is that it may not be as intuitive for some programmers, especially those who are used to working with matrices in a row-major order. Additionally, certain operations, such as adding or deleting rows, may be more complex to implement with matrix storage by columns compared to matrix storage by rows.

Similar threads

  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
1
Views
987
  • STEM Academic Advising
Replies
3
Views
1K
  • Programming and Computer Science
Replies
11
Views
7K
  • Programming and Computer Science
Replies
4
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
10
Views
1K
  • Programming and Computer Science
Replies
2
Views
3K
  • Programming and Computer Science
Replies
5
Views
2K
Back
Top