isl_vec.c File Reference

#include "isl_vec.h"

Go to the source code of this file.

Functions

struct isl_vecisl_vec_alloc (struct isl_ctx *ctx, unsigned size)
struct isl_vecisl_vec_copy (struct isl_ctx *ctx, struct isl_vec *vec)
struct isl_vecisl_vec_dup (struct isl_ctx *ctx, struct isl_vec *vec)
struct isl_vecisl_vec_cow (struct isl_ctx *ctx, struct isl_vec *vec)
void isl_vec_free (struct isl_ctx *ctx, struct isl_vec *vec)
void isl_vec_dump (struct isl_ctx *ctx, struct isl_vec *vec, FILE *out, int indent)
void isl_vec_lcm (struct isl_ctx *ctx, struct isl_vec *vec, isl_int *lcm)


Function Documentation

struct isl_vec* isl_vec_alloc ( struct isl_ctx *  ctx,
unsigned  size 
) [read]

Definition at line 3 of file isl_vec.c.

00004 {
00005         struct isl_vec *vec;
00006 
00007         vec = isl_alloc_type(ctx, struct isl_vec);
00008         if (!vec)
00009                 return NULL;
00010 
00011         vec->block = isl_blk_alloc(ctx, size);
00012         if (isl_blk_is_error(vec->block))
00013                 goto error;
00014 
00015         vec->ref = 1;
00016         vec->size = size;
00017 
00018         return vec;
00019 error:
00020         isl_blk_free(ctx, vec->block);
00021         return NULL;
00022 }

struct isl_vec* isl_vec_copy ( struct isl_ctx *  ctx,
struct isl_vec vec 
) [read]

Definition at line 24 of file isl_vec.c.

00025 {
00026         if (!vec)
00027                 return NULL;
00028 
00029         vec->ref++;
00030         return vec;
00031 }

struct isl_vec* isl_vec_dup ( struct isl_ctx *  ctx,
struct isl_vec vec 
) [read]

Definition at line 33 of file isl_vec.c.

00034 {
00035         struct isl_vec *vec2;
00036 
00037         if (!vec)
00038                 return NULL;
00039         vec2 = isl_vec_alloc(ctx, vec->size);
00040         isl_seq_cpy(vec2->block.data, vec->block.data, vec->size);
00041         return vec2;
00042 }

struct isl_vec* isl_vec_cow ( struct isl_ctx *  ctx,
struct isl_vec vec 
) [read]

Definition at line 44 of file isl_vec.c.

00045 {
00046         struct isl_vec *vec2;
00047         if (!vec)
00048                 return NULL;
00049 
00050         if (vec->ref == 1)
00051                 return vec;
00052 
00053         vec2 = isl_vec_dup(ctx, vec);
00054         isl_vec_free(ctx, vec);
00055         return vec2;
00056 }

void isl_vec_free ( struct isl_ctx *  ctx,
struct isl_vec vec 
)

Definition at line 58 of file isl_vec.c.

00059 {
00060         if (!vec)
00061                 return;
00062 
00063         if (--vec->ref > 0)
00064                 return;
00065 
00066         isl_blk_free(ctx, vec->block);
00067         free(vec);
00068 }

void isl_vec_dump ( struct isl_ctx *  ctx,
struct isl_vec vec,
FILE *  out,
int  indent 
)

Definition at line 70 of file isl_vec.c.

00072 {
00073         int i;
00074 
00075         if (!vec) {
00076                 fprintf(out, "%*snull vec\n", indent, "");
00077                 return;
00078         }
00079 
00080         fprintf(out, "%*s[", indent, "");
00081         for (i = 0; i < vec->size; ++i) {
00082                 if (i)
00083                     fprintf(out, ",");
00084                 isl_int_print(out, vec->block.data[i], 0);
00085         }
00086         fprintf(out, "]\n");
00087 }

void isl_vec_lcm ( struct isl_ctx *  ctx,
struct isl_vec vec,
isl_int lcm 
)

Definition at line 89 of file isl_vec.c.

00090 {
00091         isl_seq_lcm(vec->block.data, vec->size, lcm);
00092 }


Generated on Fri Jul 17 16:32:58 2009 for CLooG / ISL by  doxygen 1.5.9