Fortran中的自动稀疏矩阵 [英] Automated sparse matricies in Fortran

查看:578
本文介绍了Fortran中的自动稀疏矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道Intel Fortran的库具有用于处理稀疏矩阵的函数和子例程,但是我想知道首先是否还有某种数据类型或自动方法来创建稀疏矩阵.

I know that Intel Fortran has libraries with functions and subroutines for working with sparse matricies, but I'm wondering if there is also some sort of data type or automated method for creating the sparse matricies in the first place.

背景:我有一个程序使用了3&在前两个维度中可能非常大的4维数组(每个维度中的〜10k到〜100k元素,也许更多).在前2维中,每个数组的填充数最多(占95%左右)为零.为了使程序对具有正常" RAM数量的计算机友好,我想转换为稀疏矩阵.当前常规阵列的处理方式在整个代码中进行更新非常依赖于代码应用程序,因此我正在寻找一种无需大量修改即可转换为稀疏矩阵存储的方法.基本上,我很懒,并且我不想修改整个内存管理实现或不想编写一个新的模块来管理和管理我的数组.是否有用于Fortran的库或其他东西来实现数据类型或其他东西,以便我可以使用稀疏矩阵存储而无需重新设计每个数组以及如何处理它?谢谢您的帮助.干杯.

BACKGROUND: I have a program that uses some 3 & 4 dimensional arrays that can be very large in the first 2 dimensions (~10k to ~100k elements in each dimension, maybe more). In the first 2 dimensions, each array is mostly (95% or so) populated w/ zeroes. To make the program friendly to machines with a "normal" amount of RAM available, I'd like to convert to sparse matricies. The manner in which the current conventional arrays are handled & updated throughout the code is pretty dependent on the code application, so I'm looking for a way to convert to sparse matrix storage without significant modification to the code. Basically, I'm lazy, and I don't want to revise the entire memory management implementation or write an entire new module where my arrays live and are managed. Is there a library or something else for Fortran that would implement a data type or something so that I can use sparse matrix storage without re-engineering each array and how it is handled? Thanks for the help. Cheers.

推荐答案

在Fortran中,有许多不同的稀疏格式和用于处理稀疏矩阵的库(例如 petsc ,...)但是,它们都无法提供紧凑的数组处理形式,这在Fortran中可用于固有的密集数组(尤其是子数组表示法).因此,当您想更改代码以使用稀疏矩阵时,必须在多个位置触摸代码.

There are many different sparse formats and many different libraries for handling sparse matrices in Fortran (e.g. sparskit, petsc, ...) However, none of them can offer that compact array handling formalism, which is available in Fortran for intrinsic dense arrays (especially the subarray notation). So, you'll have to touch your code at several places, when you want to change it to use sparse matrices.

这篇关于Fortran中的自动稀疏矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆