Skip to content
Snippets Groups Projects
Select Git revision
  • c31de00284cbbb655b3c33be2c60dd899e5da18a
  • CyclesPhi-dev default
  • blenderphi-v4.5-v1
  • main protected
  • blender-v4.5-release
  • cycles-v4.5-aurora
  • anari-v4.5
  • anari3
  • anari2
  • anari
  • blender-v4.4-release
  • anary-cycles-device
  • xml-exporter-main
  • blender-v4.3-release
  • temp-sculpt-dyntopo
  • blender-v3.3-release
  • brush-assets-project
  • pr-extensions-tidy-space
  • blender-v4.0-release
  • universal-scene-description
  • blender-v4.1-release
  • v4.4.0
  • v4.2.8
  • v3.6.21
  • v4.2.7
  • v3.6.20
  • v4.2.6
  • v4.3.2
  • v4.2.5
  • v3.6.19
  • v4.3.1
  • v4.3.0
  • v3.6.18
  • v4.2.4
  • v3.6.17
  • v4.2.3
  • v3.6.16
  • v4.2.2
  • v4.2.1
  • v3.6.15
  • v4.2.0
41 results

BPY_interface.c

Blame
  • cs_lsolve.c 1.26 KiB
    #include "cs.h"
    /* solve Lx=b where x and b are dense.  x=b on input, solution on output. */
    
    csi cs_lsolve (const cs *L, double *x)
    {
        csi p, j, n, *Lp, *Li ;
        double *Lx ;
        if (!CS_CSC (L) || !x) return (0) ;                     /* check inputs */
        n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
        for (j = 0 ; j < n ; j++)
        {
            x [j] /= Lx [Lp [j]] ;
            for (p = Lp [j]+1 ; p < Lp [j+1] ; p++)
            {
                x [Li [p]] -= Lx [p] * x [j] ;
                //printf("XPU: %f", x [Li [p]]);
    
            }
        }
        return (1) ;
    }
    
    
    csi cs_lsolve_mrhs (const cs *L, double *x, csi n_rhs)
    {
        csi r, p, j, n, *Lp, *Li ;
        double *Lx ;
        if (!CS_CSC (L) || !x) return (0) ;                     /* check inputs */
        n = L->n ; Lp = L->p ; Li = L->i ; Lx = L->x ;
        
        for (j = 0 ; j < n ; j++)
        {
            for (r = 0; r < n_rhs; r++)
            {
                csi addr = j * n_rhs + r; 
                x [addr] /= Lx [Lp [j]] ;
            }
    
            for (p = Lp [j]+1 ; p < Lp [j+1] ; p++)
            {
                for (r = 0; r < n_rhs; r++)
                {
                    csi addr = j * n_rhs + r;
                    x [Li [p] * n_rhs + r] -= Lx [p] * x [addr] ;
                    //printf("XPU: %f", x [Li [p]]);
                }
            }
        }
        
        return (1) ;
    }