Skip to content

Commit 4bdb745

Browse files
committedAug 13, 2023
Fix outer comments
1 parent 905b13e commit 4bdb745

File tree

11 files changed

+96
-90
lines changed

11 files changed

+96
-90
lines changed
 

‎Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ members = [
1313
"sprs-benches",
1414
"sprs-tests",
1515
]
16+
resolver = "2"
1617

1718
[workspace.package]
1819
rust-version = "1.64"

‎sprs-ldl/src/lib.rs

+54-53
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,57 @@
1-
///! Cholesky factorization module.
2-
///!
3-
///! Contains LDLT decomposition methods.
4-
///!
5-
///! This decomposition operates on symmetric positive definite matrices,
6-
///! and is written `A = L D L` where L is lower triangular and D is diagonal.
7-
///! It is closely related to the Cholesky decomposition, but is often more
8-
///! numerically stable and can work on some indefinite matrices.
9-
///!
10-
///! The easiest way to use this API is to create a `LdlNumeric` instance from
11-
///! a matrix, then use the `LdlNumeric::solve` method.
12-
///!
13-
///! It is possible to update a decomposition if the sparsity structure of a
14-
///! matrix does not change. In that case the `LdlNumeric::update` method can
15-
///! be used.
16-
///!
17-
///! When only the sparsity structure of a matrix is known, it is possible
18-
///! to precompute part of the factorization by using the `LdlSymbolic` struct.
19-
///! This struct can the be converted into a `LdlNumeric` once the non-zero
20-
///! values are known, using the `LdlSymbolic::factor` method.
21-
// This method is adapted from the LDL library by Tim Davis:
22-
//
23-
// LDL Copyright (c) 2005 by Timothy A. Davis. All Rights Reserved.
24-
//
25-
// LDL License:
26-
//
27-
// Your use or distribution of LDL or any modified version of
28-
// LDL implies that you agree to this License.
29-
//
30-
// This library is free software; you can redistribute it and/or
31-
// modify it under the terms of the GNU Lesser General Public
32-
// License as published by the Free Software Foundation; either
33-
// version 2.1 of the License, or (at your option) any later version.
34-
//
35-
// This library is distributed in the hope that it will be useful,
36-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
37-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
38-
// Lesser General Public License for more details.
39-
//
40-
// You should have received a copy of the GNU Lesser General Public
41-
// License along with this library; if not, write to the Free Software
42-
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
43-
// USA
44-
//
45-
// Permission is hereby granted to use or copy this program under the
46-
// terms of the GNU LGPL, provided that the Copyright, this License,
47-
// and the Availability of the original version is retained on all copies.
48-
// User documentation of any code that uses this code or any modified
49-
// version of this code must cite the Copyright, this License, the
50-
// Availability note, and "Used by permission." Permission to modify
51-
// the code and to distribute modified code is granted, provided the
52-
// Copyright, this License, and the Availability note are retained,
53-
// and a notice that the code was modified is included.
1+
//! Cholesky factorization module.
2+
//!
3+
//! Contains LDLT decomposition methods.
4+
//!
5+
//! This decomposition operates on symmetric positive definite matrices,
6+
//! and is written `A = L D L` where L is lower triangular and D is diagonal.
7+
//! It is closely related to the Cholesky decomposition, but is often more
8+
//! numerically stable and can work on some indefinite matrices.
9+
//!
10+
//! The easiest way to use this API is to create a `LdlNumeric` instance from
11+
//! a matrix, then use the `LdlNumeric::solve` method.
12+
//!
13+
//! It is possible to update a decomposition if the sparsity structure of a
14+
//! matrix does not change. In that case the `LdlNumeric::update` method can
15+
//! be used.
16+
//!
17+
//! When only the sparsity structure of a matrix is known, it is possible
18+
//! to precompute part of the factorization by using the `LdlSymbolic` struct.
19+
//! This struct can the be converted into a `LdlNumeric` once the non-zero
20+
//! values are known, using the `LdlSymbolic::factor` method.
21+
//!
22+
//! This method is adapted from the LDL library by Tim Davis:
23+
//!
24+
//! LDL Copyright (c) 2005 by Timothy A. Davis. All Rights Reserved.
25+
//!
26+
//! LDL License:
27+
//!
28+
//! Your use or distribution of LDL or any modified version of
29+
//! LDL implies that you agree to this License.
30+
//!
31+
//! This library is free software; you can redistribute it and/or
32+
//! modify it under the terms of the GNU Lesser General Public
33+
//! License as published by the Free Software Foundation; either
34+
//! version 2.1 of the License, or (at your option) any later version.
35+
//!
36+
//! This library is distributed in the hope that it will be useful,
37+
//! but WITHOUT ANY WARRANTY; without even the implied warranty of
38+
//! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39+
//! Lesser General Public License for more details.
40+
//!
41+
//! You should have received a copy of the GNU Lesser General Public
42+
//! License along with this library; if not, write to the Free Software
43+
//! Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
44+
//! USA
45+
//!
46+
//! Permission is hereby granted to use or copy this program under the
47+
//! terms of the GNU LGPL, provided that the Copyright, this License,
48+
//! and the Availability of the original version is retained on all copies.
49+
//! User documentation of any code that uses this code or any modified
50+
//! version of this code must cite the Copyright, this License, the
51+
//! Availability note, and "Used by permission." Permission to modify
52+
//! the code and to distribute modified code is granted, provided the
53+
//! Copyright, this License, and the Availability note are retained,
54+
//! and a notice that the code was modified is included.
5455
use std::ops::Deref;
5556

5657
use num_traits::Num;

‎sprs/src/indexing.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
//! Abstraction over types of indices
2+
//!
3+
//! Our sparse matrices can use any integer type for its indices among
4+
//! `u16, u32, u64, usize, i16, i32, i64, isize`.
5+
//!
6+
//! By default, sprs matrices will use `usize`, but it can be useful to switch
7+
//! to another index type to reduce the memory usage of sparse matrices, of for
8+
//! compatibility purposes when calling into an existing library through FFI.
19
use std::fmt::Debug;
2-
///! Abstraction over types of indices
3-
///!
4-
///! Our sparse matrices can use any integer type for its indices among
5-
///! `u16, u32, u64, usize, i16, i32, i64, isize`.
6-
///!
7-
///! By default, sprs matrices will use `usize`, but it can be useful to switch
8-
///! to another index type to reduce the memory usage of sparse matrices, of for
9-
///! compatibility purposes when calling into an existing library through FFI.
1010
use std::ops::AddAssign;
1111

1212
use num_traits::int::PrimInt;

‎sprs/src/sparse/compressed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
//! Traits to generalize over compressed sparse matrices storages
12
use crate::indexing::SpIndex;
2-
///! Traits to generalize over compressed sparse matrices storages
33
use crate::sparse::prelude::*;
44
use std::ops::Deref;
55

‎sprs/src/sparse/csmat.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1+
//! A sparse matrix in the Compressed Sparse Row/Column format
2+
//!
3+
//! In the CSR format, a matrix is a structure containing three vectors:
4+
//! indptr, indices, and data
5+
//! These vectors satisfy the relation
6+
//! for i in [0, nrows],
7+
//! A(i, indices[indptr[i]..indptr[i+1]]) = data[indptr[i]..indptr[i+1]]
8+
//! In the CSC format, the relation is
9+
//! A(indices[indptr[i]..indptr[i+1]], i) = data[indptr[i]..indptr[i+1]]
110
use ndarray::ArrayView;
211
use num_traits::{Float, Num, Signed, Zero};
312
#[cfg(feature = "serde")]
413
use serde::{Deserialize, Serialize};
514
use std::cmp;
6-
///! A sparse matrix in the Compressed Sparse Row/Column format
7-
///
8-
/// In the CSR format, a matrix is a structure containing three vectors:
9-
/// indptr, indices, and data
10-
/// These vectors satisfy the relation
11-
/// for i in [0, nrows],
12-
/// A(i, indices[indptr[i]..indptr[i+1]]) = data[indptr[i]..indptr[i+1]]
13-
/// In the CSC format, the relation is
14-
/// A(indices[indptr[i]..indptr[i+1]], i) = data[indptr[i]..indptr[i+1]]
1515
use std::default::Default;
1616
use std::iter::{Enumerate, Zip};
1717
use std::mem;

‎sprs/src/sparse/linalg.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
//! Sparse linear algebra
2+
//!
3+
//! This module contains solvers for sparse linear systems. Currently
4+
//! there are solver for sparse triangular systems and symmetric systems.
5+
16
use crate::{DenseVector, DenseVectorMut};
2-
///! Sparse linear algebra
3-
///!
4-
///! This module contains solvers for sparse linear systems. Currently
5-
///! there are solver for sparse triangular systems and symmetric systems.
67
use num_traits::Num;
78

89
pub mod etree;

‎sprs/src/sparse/linalg/etree.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
///! Data structures to work with elimination trees (etree).
2-
///! etrees arise when considering cholesky factorization, QR factorization, ...
1+
//! Data structures to work with elimination trees (etree).
2+
//! etrees arise when considering cholesky factorization, QR factorization, ...
3+
34
use std::ops::{Deref, DerefMut};
45

56
pub type Parent = Option<usize>;

‎sprs/src/sparse/prod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
//! Sparse matrix product
2+
13
use crate::dense_vector::{DenseVector, DenseVectorMut};
24
use crate::indexing::SpIndex;
35
use crate::sparse::compressed::SpMatView;
4-
///! Sparse matrix product
56
use crate::sparse::prelude::*;
67
use crate::Ix2;
78
use ndarray::{ArrayView, ArrayViewMut, Axis};

‎sprs/src/sparse/special_mats.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
//! Common sparse matrices
12
use ndarray::ArrayView2;
2-
///! Common sparse matrices
33
use smallvec::SmallVec;
44

55
use crate::indexing::SpIndex;

‎sprs/src/sparse/to_dense.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
//! Utilities for sparse-to-dense conversion
2+
13
use super::{CsMatViewI, CsVecViewI};
24
use crate::indexing::SpIndex;
35
use crate::{Ix1, Ix2};
4-
///! Utilities for sparse-to-dense conversion
56
use ndarray::{ArrayViewMut, Axis};
67

78
/// Assign a sparse matrix into a dense matrix

‎sprs/src/sparse/triplet.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1+
//! Triplet format matrix
2+
//!
3+
//! Useful for building a matrix, but not for computations. Therefore this
4+
//! struct is mainly used to initialize a matrix before converting to
5+
//! to a [`CsMat`](CsMatBase).
6+
//!
7+
//! A triplet format matrix is formed of three arrays of equal length, storing
8+
//! the row indices, the column indices, and the values of the non-zero
9+
//! entries. By convention, duplicate locations are summed up when converting
10+
//! into `CsMat`.
111
use crate::indexing::SpIndex;
212
use crate::sparse::prelude::*;
313

4-
///! Triplet format matrix
5-
///!
6-
///! Useful for building a matrix, but not for computations. Therefore this
7-
///! struct is mainly used to initialize a matrix before converting to
8-
///! to a [`CsMat`](CsMatBase).
9-
///!
10-
///! A triplet format matrix is formed of three arrays of equal length, storing
11-
///! the row indices, the column indices, and the values of the non-zero
12-
///! entries. By convention, duplicate locations are summed up when converting
13-
///! into `CsMat`.
1414
use std::ops::{Add, Deref, DerefMut};
1515
use std::slice::Iter;
1616

0 commit comments

Comments
 (0)