Blender  V2.93
linear_solver.h
Go to the documentation of this file.
1 /*
2  * Sparse linear solver.
3  * Copyright (C) 2004 Bruno Levy
4  * Copyright (C) 2005-2015 Blender Foundation
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * If you modify this software, you should include a notice giving the
21  * name of the person performing the modification, the date of modification,
22  * and the reason for such modification.
23  */
24 
25 #pragma once
26 
27 #include <stdbool.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* Solvers for Ax = b and AtAx = Atb */
34 
35 typedef struct LinearSolver LinearSolver;
36 
37 LinearSolver *EIG_linear_solver_new(int num_rows, int num_columns, int num_right_hand_sides);
38 
40  int num_columns,
41  int num_right_hand_sides);
42 
44 
45 /* Variables (x). Any locking must be done before matrix construction. */
46 
47 void EIG_linear_solver_variable_set(LinearSolver *solver, int rhs, int index, double value);
48 double EIG_linear_solver_variable_get(LinearSolver *solver, int rhs, int index);
49 void EIG_linear_solver_variable_lock(LinearSolver *solver, int index);
50 void EIG_linear_solver_variable_unlock(LinearSolver *solver, int index);
51 
52 /* Matrix (A) and right hand side (b) */
53 
54 void EIG_linear_solver_matrix_add(LinearSolver *solver, int row, int col, double value);
55 void EIG_linear_solver_right_hand_side_add(LinearSolver *solver, int rhs, int index, double value);
56 
57 /* Solve. Repeated solves are supported, by changing b between solves. */
58 
60 
61 /* Debugging */
62 
64 
65 #ifdef __cplusplus
66 }
67 #endif
uint col
void EIG_linear_solver_print_matrix(LinearSolver *solver)
LinearSolver * EIG_linear_solver_new(int num_rows, int num_columns, int num_right_hand_sides)
void EIG_linear_solver_variable_set(LinearSolver *solver, int rhs, int index, double value)
void EIG_linear_solver_right_hand_side_add(LinearSolver *solver, int rhs, int index, double value)
void EIG_linear_solver_variable_unlock(LinearSolver *solver, int index)
void EIG_linear_solver_delete(LinearSolver *solver)
LinearSolver * EIG_linear_least_squares_solver_new(int num_rows, int num_columns, int num_right_hand_sides)
double EIG_linear_solver_variable_get(LinearSolver *solver, int rhs, int index)
void EIG_linear_solver_matrix_add(LinearSolver *solver, int row, int col, double value)
bool EIG_linear_solver_solve(LinearSolver *solver)
void EIG_linear_solver_variable_lock(LinearSolver *solver, int index)