GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Math::GSL::SparseMatrix(3) User Contributed Perl Documentation Math::GSL::SparseMatrix(3)

Math::GSL::SparseMatrix - Sparse Matrices

    use Math::GSL::SparseMatrix qw/:all/;
    use Math::GSL::Matrix qw/gsl_matrix_alloc/;
    my $sparse = gsl_spmatrix_alloc(100,100);
    my $status = gsl_spmatrix_set($sparse,50,50,42.42);
    my $value  = gsl_spmatrix_get($sparse,50,50);

    # multiply every element by 5
    $status = gsl_spmatrix_scale($sparse, 5);

    # get the number of non-zero elements
    my $nnz = gsl_spmatrix_nnz($sparse);

    # fine min and max values, other than zero elements
    ($status, $min, $max) = gsl_spmatrix_minmax($sparse);

    # set all elements to zero
    $status = gsl_spmatrix_set_zero($sparse);

    my $dense  = gsl_matrix_alloc(100,100);
    # convert a sparse matrix to a dense matrix
    $status = gsl_spmatrix_sp2d($dense, $sparse);

    # convert a dense matrix to a sparse matrix
    $status = gsl_spmatrix_d2sp($sparse, $dense);

NOTE: This module requires GSL 2.0 or higher.

For more informations on the functions, we refer you to the GSL official documentation: <http://www.gnu.org/software/gsl/manual/html_node/>

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

Copyright (C) 2008-2021 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.